REST API & Websocket Documentation

Explore our comprehensive API documentation to get started with real-time and historical data retrieval for currency pairs and crypto.

REST API Documentation Websocket Documentation

REST API Documentation

Authentication

There are 2 ways to authenticate with the REST API:

  • You can send the "token" key with every request to our API but this may subject to some security problems:
    Example: https://currencydatafeed.com/api/data.php?currency=EUR/USD&token=YOUR_ACCESS_TOKEN
  • You can send the token as a part of the request header. If token is sent via header, you don't need to send it again with every request so your API_KEY won't be exposed with the request. Header should be: 'Authorization: Bearer ACCESS_TOKEN'

Available Symbols Per SectionStandardPremiumUltimate

You can requst every available symbol per section. This will not consume your available requests.

Endpoint URL:

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

Required Parameters:

section=One of Available Sectors: forex, crypto, crypto_extended

Example:

https://currencydatafeed.com/api/symbolslist.php?section=forex

Sinlge & Multiple Pair RequestsFreeStandardPremiumUltimate

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:


          {
                      "status":true,
                      "currency":
                      [{
                        "currency":"EUR/USD",
                        "value":"1.14629",
                        "change":"-0.00352",
                        "change_percent":"-0.30614",
                        "ask":"1.14635",
                        "bid":"1.14623",
                        "daily_lowest":"1.1458",
                        "daily_highest":"1.15408",
                        "date":"2019-01-12 15:30:06",
                        "type":"original"
                      }, {
                        "currency":"USD/JPY",
                        "value":"108.54",
                        "change":"0.05",
                        "change_percent":"0.04609",
                        "ask":"108.56",
                        "bid":"108.52",
                        "daily_lowest":"108.145",
                        "daily_highest":"108.59",
                        "date":"2019-01-12 15:30:06",
                        "type":"original"
                      }, {
                        "currency":"EUR/NOK",
                        "value":"9.7829",
                        "change":"0.0342",
                        "change_percent":"0.35082",
                        "ask":"9.784",
                        "bid":"9.7818",
                        "daily_lowest":"9.7361",
                        "daily_highest":"9.78895",
                        "date":"2019-01-12 15:30:06",
                        "type":"original"
                      } ]
                    }
        

Source Currency RequestsStandardPremiumUltimate

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 RequestsPremiumUltimate

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:

Pair PerformanceUltimate

You can get the percentage of gain or loss from 1 hour to 2 years for a specific pair ex:EUR/USD.

Endpoint URL:

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

Required Parameters:

symbol=REQUESTED_SYMBOL ex: EUR/USD

Example:

https://currencydatafeed.com/api/performance.php?symbol=EUR/USD

Sample Response:

Historical Data RequestsUltimate

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 RequestsUltimate

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 DataUltimate

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,5 Minutes, 15 Minutes OHLC DataUltimate

You can request a pair's 1,5,15 minute OHLC data up to 90 days back. For 1 minutes data, timeframe must be 2 days max, for 5 minutes data, 10 days and for 15 minutes data, 30 days. You can also specify a data_count. You either have to supply 'from&to' parameters or 'last' parameter

1m Endpoint URL:

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

5m Endpoint URL:

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

15m Endpoint URL:

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

Required Parameters:

currency=CURRENCY&from=DATE(YYYY-MM-DD HH:ii:ss)&to=DATE(YYYY-MM-DD HH:ii:ss)&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:

Gainers & Losers (Currency Pairs)Ultimate

This endpoint will list you the top 15 gainers and losers of day, week we are in, month we are in or year we are in upon request.

Endpoint URL:

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

Required Parameters:

interval=ONE OF THESE INTERVALS: day,week,month,year

Example:

https://currencydatafeed.com/api/gainerloser.php?token=YOUR_ACCESS_TOKEN&interval=day

Consumes 3 requests.

Crypto Currency DataPremiumUltimate

You can request multiple crypto currencies for the latest USD and BTC price, daily change rate and daily low & high values.

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:

Extended Crypto Currency DataPremiumUltimate

This is a more advanced endpoint for crypto currencies. You can request multiple crypto currency pairs for the latest rate, daily change rate and daily low & high values. Symbols need to include the crypto exchange they are traded on. For example to get the ETHBTC pair traded on Binance you need to use ETHBTC@binance. Every crypto currency exchange may have different formats. For example you can request the same pair from Kucoin with symbol : ETH-BTC@kucoin. You can find all these pairs on our Supported Pairs page.

Endpoint URL:

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

Required Parameters:

symbol=SYMBOLS

Example:

https://currencydatafeed.com/api/symbolextended.php?token=ACCESS_TOKEN&symbol=ETHBTC@binance+XRPBTC@huobi+LSK-BTC@kucoin

Sample Response:

Crypto On-Chain MetricsUltimate

Provides following on-chain metrics: Whale Ratio, Sopr, Mvrv, Puell, Open Interest, Leverage, Funding, Active Address since 3 years back.

Endpoint URL:

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

Required Parameters:

type=REQUESTED_METRIC (one of the following:sopr, puell, mvrv, open_interest, leverage, funding, active_address)

Example:

https://currencydatafeed.com/api/crypto_onchain.php?type=mvrv

Sample Response:

Coin PerformanceUltimate

You can get the percentage of gain or loss from 1 day to 2 years for a specific coin ex:ETH.

Endpoint URL:

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

Required Parameters:

symbol=REQUESTED_SYMBOL ex: ETH

Example:

https://currencydatafeed.com/api/crypto_performance.php?symbol=ETH

Sample Response:

Historical Crypto Currency DataUltimate

Daily close rates of crypto currencies. Available as "last number of periods"

Endpoint URL:

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

Required Parameters:

currency=CRYPTOCURRENCY&period=NUMBEROFPERIODS

Example:

https://currencydatafeed.com/api/crypto_historical.php?token=ACCESS_TOKEN¤cy=BTC&period=365

Historical Crypto Currency Extended DataNew EndpointUltimate

Daily close rates of extended crypto currency pairs. Available as "last number of periods"

Endpoint URL:

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

Required Parameters:

currency=CRYPTOCURRENCYPAIR&period=NUMBEROFPERIODS

Example:

https://currencydatafeed.com/api/crypto_extended_historical.php?token=ACCESS_TOKEN¤cy=ETHBTC@binance&period=365

Websocket Documentation (Open BETA)

Websocket Connection

Websocket provides live data for the specified currencies. 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:

Welcome, you are connected to CDF websocket!. Please login in 10 seconds.

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

login_YourMailAddress:YourAPIKey

After a successful login you will receive:

Login success. Please subscribe to quotes to start recieving data...

You have to subscribe to currencies you would like to get data as JSON as below:

subscribe_EUR/USD+USD/JPY+EUR/JPY+USD/SEK+EUR/USD

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. 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:

  • You made a single request to get 5 currency pairs. This counts as 1 API request.
  • You made a single request to get 46 currency pairs. This counrs as 10 API requests.

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

Some Examples:

  • You set the source currency as NZD and set 5 target currencies. This counts as 1 API request.
  • You set the source currency as NZD and set 9 target currencies. This counts as 2 API request.

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:

  • You made a request to get the EUR/USD Close Value for 01/04/2017 , this counts as 1 API request.
  • You made a request to get the EUR/USD , USD/RUB and EUR/SEK Close Value for 01/04/2017 , this counts as 3 API requests.

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

For Crypto queries, every 5 requests are 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.

  • For historical values, we provide open,close,low and high values.
  • For time-range queries, we provide open,close,low and high values.
  • For classical currency requests, we provide last price,change number,change percent,ask,bid,daily low and daily high values.
  • For currency conversion, we convert the requested value between requested currencies and provide the converted result.
  • For source & target currency requests, we provide last price.
  • For crypto currency requests, we provide latest rate and daily change

© 2015-2022 currencydatafeed.com - All rights reserved