Skip to content

Historical Exchange Rates, Currency Conversion With An API

What are forex rates?

Forex (Foreign Exchange) is the market in which one currency is exchanged for another. Currency conversion is the process of converting one currency into another.

Forex and currency conversion can be done either over-the-counter (OTC, through a broker or bank), or on an exchange (either electronically or with human traders).

What are historical exchange rates?

Historical exchange rates are the values at which one currency was exchanged for another in the past. They have value because they help answer questions like: How many US dollars will I need to buy a British pound next month? What does the trend look like? What was the exchange rate for New Zealand dollars to Indian rupees last year?

Historical exchange rates are useful because they allow you to compare currencies, and therefore better understand their behavior over time. When you compare two currencies using historical exchange rates, then you know that they’re being compared at equal values, which helps avoid confusing discrepancies due to changes in value.

Historical Exchange Rates, Currency Conversion With An API

Why should you use an API for historical exchange rates and forex rates?

An API is a tool that allows you to access data from other websites or applications, usually in a more automated fashion than if you were manually entering the data yourself. They allow you to get the information you need easily and quickly, so you can make better decisions faster than ever before.

We recommend you try out Exchangr’s API

Exchangr

Historical Exchange Rates, Currency Conversion With An API

Exchangr is a REST API that uses the JSON data format to deliver accurate currency exchange rates and conversions to consumers and businesses.

The forex API from Exchangr not only supports common currency pairs, but it also calculates cross rates by linking major currencies. They make every attempt to obtain correct data from a variety of trustworthy sources in order to cover even the smallest traded currencies. A link to past data coverage may be found here. As a consequence, you can trust the Exchangr FX API to handle even the most difficult business needs.

Create a free account and acquire your API key to use the Exchangr API; no credit card is necessary. You can also join up with your Google account.

Data on past currency rates is available.

If you’re looking for an API to access live and historical pricing, you’ve come to the right place. Historical data, daily closing rates, and historical currency exchange rates are all available through the Exchangr API. It’s also a great API for getting cryptocurrency information, like as current and historical prices. More than 164 currencies, including eight cryptos, are supported through an efficient historical FX API.

You may query the Exchangr API for historical rates by adding a date (format YYYY-MM-DD) to the base URL.

The URL for this endpoint is https://api.getexchangr.com/historical/DATE, and here’s a sample curl command to get historical USD currency values for 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 the difference in currency exchange rates between two dates in the past.

You may use this endpoint to look up historical rates between two dates in the API. It is the most efficient method of obtaining time-series data for studying trends in historical forex data. It may also be used to map and track historical exchange rates over time for certain days, months, or years.

https://api.GetExchangr.com/timeseries is the URL for this endpoint. Here’s a curl example for collecting 30 days of LKR (Sri Lanka Rupee), OMR (Rial Omani), PHP (Philippine Peso), and TRY (Turkish Lira) time series analysis by base TWD from 2021-03-025 to 2021-04-26. (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"
       },
       [...]
   }
}

You can sign up here to Exchangr’s Foreign Exchange API

Related posts:

Tips To Make Foreign Exchange APIs Less Overwhelming


Also published on Medium.

Published inAppsTechnology
%d bloggers like this: