Free Historical Forex Data
fxdata.foorilla.com provides a free and open API to access historical foreign exchange rates in USD based on statistical data provided by the Bank for International Settlements (BIS).
About fxdata.foorilla.com
When we launched a public salary database for remote workers in 2021 (see https://salaries.freshremote.work/) with dozens of different currencies, we wanted to add a reference column by converting all non-USD salaries into USD in the resulting dataset (https://salaries.freshremote.work/download/).
For this we needed historical daily data to calculate a yearly average USD rate for these currencies and we didn't want to go with complicated APIs or paid data providers. As a result this little project came into existence serving exactly this need.
We ended up making this API public so you can use it for something similar as well and having a free, quick, and simple way to access this kind of historical foreign exchange rate data with currently 81 areas covered by 62 currencies, of which some even date back to the 1950s.
Data source and updates
The data behind this API is being updated roughly once a week with the most recent CSV vertical file available on the BIS website, which depends on their release schedule.
Here are the links to the BIS statistics page (overview) and the original dataset (US dollar exchange rates, Daily data, CSV vertical).
- Statistics overview: https://www.bis.org/statistics
- US dollar exchange rates: https://www.bis.org/statistics/xrusd.htm
- Copyright and permissions: https://www.bis.org/terms_conditions.htm
Documentation and functionality
Introduction
The root URL for the fxdata API web service is https://fxdata.foorilla.com/api/
All data is sent and received as JSON over HTTPS, using the Unicode UTF-8 text encoding. Unencrypted HTTP is not supported.
Using the API web service doesn't require authentication but there is a rate limit of 5,000 requests per hour for anonymous clients. You can reach out to us via fxdata@foorilla.com if you have any special needs or require a higher request limit.
Data endpoints
List results support pagination (via the page
GET parameter) and always return a maximum of 200 items per page.
Areas
Get a list of all areas with their name, country code and attached currency code.
Endpoint: https://fxdata.foorilla.com/api/areas/ (GET, JSON)
Example:
$ curl https://fxdata.foorilla.com/api/areas/
Response:
{"count":81,"next":null,"previous":null,"results":[{"code":"AE","name":"United Arab Emirates","currency":"AED"},{"code":"AL","name":"Albania","currency":"ALL"},{"code":"AR","name":"Argentina","currency":"ARS"},{"code":"AT","name":"Austria","currency":"EUR"},...
Currencies
Get a list of all currencies with their currency code and name.
Endpoint: https://fxdata.foorilla.com/api/currencies/ (GET, JSON)
Example:
$ curl https://fxdata.foorilla.com/api/currencies/
Response:
{"count":62,"next":null,"previous":null,"results":[{"code":"AED","name":"UAE Dirham"},{"code":"ALL","name":"Albanian Lek"},{"code":"ARS","name":"Argentine Peso"},{"code":"AUD","name":"Australian Dollar"},...
Currency - yearly average
Get the yearly average USD rate for a specific currency calculated across all its rates for that year. This endpoint needs the currency code as a URL parameter and the following additional get parameter:
- yearly_average - the year to calculate the averate USD rate for (required)
Endpoint: https://fxdata.foorilla.com/api/currencies/<currency:required>/ (GET, JSON)
Example:
$ curl https://fxdata.foorilla.com/api/currencies/CHF/?yearly_average=2019
Response:
{"code":"CHF","name":"Swiss Franc","avg_year":"2019","avg_usdrate":"0.993719"}
USD rates
Get a list of all USD rates for all currencies with their date, currency code and USD rate decimal value. This endpoint also accepts the following GET parameters for filtering the results:
- currency - get results for a specific currency only (optional)
- date_max - get all rates for and before the given date (optional)
- date_min - get all rates for and after the given date (optional)
Endpoint: https://fxdata.foorilla.com/api/usdrates/ (GET, JSON)
Example:
$ curl https://fxdata.foorilla.com/api/usdrates/
Response:
{"count":639017,"next":"https://fxdata.foorilla.com/api/usdrates/?page=2","previous":null,"results":[{"id":639017,"date":"2021-07-05","currency":"ZAR","value":"14.226614"},{"id":639015,"date":"2021-07-05","currency":"USD","value":"1.000000"},{"id":639014,"date":"2021-07-05","currency":"UAH","value":"27.412100"},{"id":639013,"date":"2021-07-05","currency":"TRY","value":"8.670908"},...
Example (with parameters):
$ curl "https://fxdata.foorilla.com/api/usdrates/?currency=CHF&date_min=2015-01-13&date_max=2015-01-16"
Response:
{"count":4,"next":null,"previous":null,"results":[{"id":540887,"date":"2015-01-16","currency":"CHF","value":"0.874008"},{"id":540827,"date":"2015-01-15","currency":"CHF","value":"0.878032"},{"id":540765,"date":"2015-01-14","currency":"CHF","value":"1.019958"},{"id":540703,"date":"2015-01-13","currency":"CHF","value":"1.019352"}]}