REST API & Websocket Documentation

REST API Documentation

websocket

Websocket Documentation

REST API Documentation

Authentication

There are 2 ways to authenticate with the REST API:

Sinlge & Multiple Pair Requests

Endpoint URL:

https://currencydatafeed.com/api/data.php

Required Parameters:

currency=CURRENCIES seperated by +

Example:

https://currencydatafeed.com/api/data.php?currency=EUR/USD+USD/JPY+EUR/NOK+AUD/USD+USD/SGD+USD/MXN+XAU/USD+GBP/CAD

Sample Response:

Source Currency Requests

Switching the source currency is an important feature as you can set a source currency and get values of the target currencies according to source currency. For example, if you set JPY as source currency and want to get USD,EUR,NOK,AUD,KRW,NZD the API will give you the values of target currencies for 1 JPY

Endpoint URL:

https://currencydatafeed.com/api/source_currency.php

Required Parameters:

source=SOURCE_CURRENCY&target=TARGET_CURRENCIES

Example:

https://currencydatafeed.com/api/source_currency.php?source=AUD&target=USD+EUR+KRW+NZD+JPY

Sample Response:

Currency Conversion Requests

You can convert between 2 currencies with the specified amount.

Endpoint URL:

https://currencydatafeed.com/api/converter.php

Required Parameters:

from=CURRENCY&to=CURRENCY&amount=AMOUNT

Example:

https://currencydatafeed.com/api/converter.php?from=EUR&to=AUD&amount=5500

Sample Response:

Historical Data Requests

You can request the historical rate of multiple currencies with this endpoint up to 4 years back.

Endpoint URL:

https://currencydatafeed.com/api/historical.php

Required Parameters:

currency=CURRENCIES&date=DATE

Example:

https://currencydatafeed.com/api/historical.php?token=YOUR_ACCESS_TOKEN¤cy=EUR/USD+EUR/GBP&date=2018-11-20

Sample Response:

Historical Timeframe Requests

You can request a pair's OHLC daily data between 2 specified dates.

Endpoint URL:

https://currencydatafeed.com/api/timeframe.php

Required Parameters:

currency=CURRENCY&from=DATE&to=DATE

Example:

https://currencydatafeed.com/api/timeframe.php?currency=EUR/USD&from=2018-04-18&to=2019-01-10

Sample Response:

1 Hour OHLC Data

You can request a pair's 1 hour OHLC data up to 365 days back. You can specify 2 dates or you can specify a data_count which means if you specify 90, you will get last 90 days of 1 hour data.

Endpoint URL:

https://currencydatafeed.com/api/intraday1h.php

Required Parameters:

currency=CURRENCY&from=DATE(YYYY-MM-DD HH:ii:ss)(optional)&to=DATE(YYYY-MM-DD HH:ii:ss)(optional)&last=DATA_COUNT(optional)

Example:

https://currencydatafeed.com/api/intraday1h.php?currency=EUR/USD&from=2020-08-15 00:00:00&to=2020-08-20 00:00:00

Sample Response:

1 Minute OHLC Data

You can request a pair's 1 minute OHLC data up to 7 days back. You can specify 2 dates or you can specify a data_count which means if you specify 90, you will get last 90 days of 1 hour data.

Endpoint URL:

https://currencydatafeed.com/api/intraday1m.php

Required Parameters:

currency=CURRENCY&from=DATE(YYYY-MM-DD HH:ii:ss)(optional)&to=DATE(YYYY-MM-DD HH:ii:ss)(optional)&last=DATA_COUNT(optional)

Example:

https://currencydatafeed.com/api/intraday1m.php?currency=EUR/USD&from=2020-08-15 00:00:00&to=2020-08-20 00:00:00

Sample Response:

Crypto Currency Data

You can request multiple crypto currencies for latest rate and daily change rate.

Endpoint URL:

https://currencydatafeed.com/api/symbol.php

Required Parameters:

symbol=SYMBOLS

Example:

https://currencydatafeed.com/api/symbol.php?token=ACCESS_TOKEN&symbol=BTC+ETH+XRP+LTC

Sample Response:

Websocket Documentation

Websocket Connection

Websocket provides live data for the specified currencies upon login. Websockets are available only to ultimate plan or upper. The websocket URL is provided on your control panel's navigation if you are a subscribed user for ultimate plan or upper. Using this url, you can connect to our websocket. After the connection, you will recieve:

{"data":[],"etype":"setAutomaticEvents"}

which means that you have successfuly connected to our websocket. After recieving this, you have to send login parameters in 30 seconds or you will be disconneceted:

{type: "event", event: "user_login", params: {mail: "YOUR_REGISTERED_MAIL_ADDRESS", apikey: "YOUR_API_KEY", symbols: "EUR/USD,XAU/USD,GBP/USD"}}

You have to specify the currencies you want with the login. That’s all. You will recieve all pairs in the first push, after that, only the pairs that has an update on latest price will be pushed to you. If no pair has an update there won’t be any data delivered to you until the next check which is half second later than the previous check. This means it will be 2x faster than the rest api if your pair has an update. The response will be the same as the REST API response provided to live data requests.

Details of Using REST API and Websocket

How API Requests Are Counted?

Nearly all the data feed companies count each quote request as 1 API request. For example, if you make a single request that asks for multiple currencies like EUR/USD, USD/JPY, EUR/SEK, USD/RUB and GBP/USD, this counts 5 API requests but with CurrencyDataFeed.Com, to give you more opportunities and space, we count this example request as 1 API request. We count 1 API request for each 5 quotes.

Some Examples:

For Source Currency requests , each 5 target currency counts as 1 API request.

Some Examples:

For historical and time range queries, every request for a single currency is counted as 1 API request. Only 1 currency pair may be requested for time range queries but you can ask for many currencies for a historical close price with a single call.

Some Examples:

For Currency Conversion queries, each request is counted as 1 API request.

Which Values Are Provided?

The values provided vary according to subscribed plan. You can check all the plans by clicking pricing link on the navigation bar.

© 2015-2020 currencydatafeed.com - All rights reserved