Skip to content

Use A Forex API To Get Historical Currency Rates

Do you need historical foreign currency data for a financial settlement, production, historical currency conversion straight into your app, or any other use? An API will surely fit your needs.

What Is the Definition of Historical Currency Exchange Rates?

Historical Currency Prices are a historical depiction of several currency pairs on the foreign exchange market, displaying variations in exchange rates between certain dates in the past.

Historical foreign exchange rates are currency rates that traders may use to figure out how a currency pair has traded in the past.

Use A Forex API To Get Historical Currency Rates

What Are The Benefits Of Using Historical Foreign Exchange And Cryptocurrency Rates?

  • Many forex market traders use it to track the movement of any currency pair over a set period.
  • It may also be used to forecast future currency rate fluctuations.
  • It helps create currency reports.
  • Forex traders use historical currency exchange rates to figure out how a currency pair has traded in the past and how it will trade in the future.
  • As part of their quantitative research, forex traders use historical exchange rates data.
  • To make better-informed trades, software developers integrate historical currency data in web UI platforms for technical analysis and forex charting.

Exchangr

Exchangr is a REST API that leverages the JSON data format to provide consumers and companies with accurate currency exchange rates and conversions.

Use A Forex API To Get Historical Currency Rates

The API has five customizable endpoints for various activities. The live endpoint provides real-time exchange rates, the historical endpoint historical currency rates, the convert endpoint multiple currencies, the time-series endpoint exchange rates over a defined period, and the fluctuation endpoint returns change parameters for any currency.

The Exchangr API accepts 164 currencies and 8 cryptocurrencies from all around the world. Before being sent to customers, the data is obtained from a variety of commercial forex data sources and banks and blended algorithmically. It refreshes data regularly, with intervals ranging from 60 minutes to 24 hours.

Get historical currency rates data.

You’ve come to the correct spot if you’re seeking an API to access live and historical prices. The Exchangr API provides historical data, daily closing rates, and historical currency exchange rates. It’s also a fantastic API for obtaining cryptocurrency data, like current and historical values. An efficient historical forex API provides support for more than 164 currencies including 8 cryptos.

By attaching a date (format YYYY-MM-DD) to the base URL, you may query the Exchangr API for historical rates.

This endpoint’s URL is https://api.getexchangr.com/historical/DATE, and here’s an example curl command to get historical USD currency rates for the date 2021-04-26:

$ curl 'https://api.getexchangr.com/historical/2021-04-26?apikey=YOUR_APIKEY'
{
    "date": "2021-04-26",
    "base": "USD",
    "rates": {
        "FJD": "2.033",
        "MXN": "19.8618",
        "STD": "20738.069016",
        "SCR": "14.146",
        "CDF": "1991.5905",
        "BBD": "2.0",
        "HNL": "24.0876",
        "UGX": "3600.499",
        "ZAR": "14.2733",
        "STN": "20.500089"
        }

Get historical currency rates conversion.

The historical rates conversion endpoint also has two very useful features. The first is that it allows you to switch between past currency rates by changing the base currency in the history rates, and the second is that it allows you to get historical forex rates for any currency with any base currency.

The QAR (Qatari Rial), CNH (Chinese Yuan Renminbi), and BTC (Bitcoin) to SGD (Singapore Dollar) conversion endpoint leverages past cross rates to offer other historical currency values, as seen in the sample below.

Note: You just need to supply the value of the query parameter “base” and any previous date. Here’s a curl example for converting historical cross rates on April 5, 2021.

$ curl 'https://api.getexchangr.com/historical/2021-04-05?apikey=YOUR_APIKEY&symbols=QAR,CNH,BTC&base=SGD'
{
   "date": "2021-04-05",
   "base": "SGD",
   "rates": {
       "QAR": "2.7133",
       "CNH": "4.890211842443814",
       "BTC": "0.000012648815118471506"
   }
}

Get historical currency exchange rates between two dates.

You may use this endpoint to search the API for historical rates between two dates. It’s the most effective way to obtain time-series data for analyzing trends in forex historical data. It’s also used to plot and track historical exchange rates for certain days, months, or years.
This endpoint’s URL is https://api.GetExchangr.com/timeseries. and here’s a curl example to collect 30 days of LKR (Sri Lanka Rupee), OMR (Rial Omani), PHP (Philippine Peso), TRY (Turkish Lira) time series analysis from 2021-03-025 to 2021-04-26 by base TWD (New Taiwan Dollar).

$ curl 'https://api.getexchangr.com/timeseries?apikey=YOUR_APIKEY&start_date=2021-03-025&end_date=2021-04-26&symbols=LKR,OMR,PHP,TRY&base=TWD'
{
   "start_date": "2021-03-25",
   "end_date": "2021-04-26",
   "base": "TWD",
   "rates": {
       "2021-03-25 00:00:00+00": {
           "LKR": "6.96",
           "OMR": "0.0136",
           "PHP": "1.7055",
           "TRY": "0.279"
       },
       "2021-03-26 00:00:00+00": {
           "LKR": "6.9554",
           "OMR": "0.0135",
           "PHP": "1.6893",
           "TRY": "0.2843"
       },
       "2021-03-27 00:00:00+00": {
           "LKR": "6.9554",
           "OMR": "0.0135",
           "PHP": "1.6893",
           "TRY": "0.2843"
       },
       [...]
   }
}

Conclusion

Exchangr’s forex API not only supports popular currency pairings but also calculates cross rates by linking significant currencies. They make every effort to acquire accurate data from numerous reliable sources to cover even the most little traded currencies. Here is a link to previous data coverage. As a result, you can rely on the Exchangr FX API for even the most complex business requirements.

To get access to Exchangr API create a free account and get your API key, no credit card is required. You can also use your Google account to sign up.


Also published on Medium.

Published inAppsTechnology
%d bloggers like this: