Go to file
2018-09-17 22:14:21 +01:00
bin Minor tweaks 2018-09-11 17:59:42 +01:00
config Revert "Replace Unicorn with Puma" 2018-09-12 00:54:39 +01:00
db/migrate Repack app 2018-03-08 23:51:36 +00:00
lib Fix tracking code 2018-09-17 22:14:21 +01:00
spec Fix ECB url 2018-09-11 18:05:14 +01:00
.dockerignore Don't ignore markdown 2018-09-11 18:15:07 +01:00
.env.example Rebrand, serve HTML 2018-06-08 15:32:52 +01:00
.eslintrc Rebrand, serve HTML 2018-06-08 15:32:52 +01:00
.gitignore Update homepage 2018-09-11 17:59:42 +01:00
.rubocop.yml Implement time series 2018-07-05 21:30:17 +01:00
.tool-versions Rebrand, serve HTML 2018-06-08 15:32:52 +01:00
.travis.yml Rebrand, serve HTML 2018-06-08 15:32:52 +01:00
app.json Add a Heroku app.json 2018-06-08 15:32:52 +01:00
config.ru Rebrand, serve HTML 2018-06-08 15:32:52 +01:00
docker-compose.override.yml Revert "Replace Unicorn with Puma" 2018-09-12 00:54:39 +01:00
docker-compose.prod.yml Rebrand, serve HTML 2018-06-08 15:32:52 +01:00
docker-compose.yml Revert "Replace Unicorn with Puma" 2018-09-12 00:54:39 +01:00
Dockerfile Revert "Replace Unicorn with Puma" 2018-09-12 00:54:39 +01:00
Gemfile Revert "Replace Unicorn with Puma" 2018-09-12 00:54:39 +01:00
Gemfile.lock Revert "Replace Unicorn with Puma" 2018-09-12 00:54:39 +01:00
LICENSE Remove dates from license 2017-01-03 12:44:13 +00:00
limit_req.conf Repack app 2018-03-08 23:51:36 +00:00
Rakefile Repack app 2018-03-08 23:51:36 +00:00
README.md Add cookie notice 2018-09-13 17:34:44 +01:00

Frankfurter

Travis

Foreign exchange (forex) rates and currency conversion API

Getting Started

Frankfurter is a free and open source API for current and historical foreign exchange rates. It tracks data published by the European Central Bank.

Rates are updated around 4PM CET every working day.

Examples

Get the current foreign exchange rates.

GET /latest HTTP/1.1

Get historical rates for any day since 1999.

GET /2000-01-03 HTTP/1.1

Get historical rates for a time period.

GET /2010-01-01..2010-01-31 HTTP/1.1

Rates quote against the Euro by default. Quote against a different currency.

GET /latest?from=USD HTTP/1.1

Request specific exchange rates.

GET /latest?to=USD,GBP HTTP/1.1

Convert a specific amount.

GET /latest?amount=1000&from=GBP&to=USD HTTP/1.1

With a full list of currencies, time series grow large in size. For better performance, use the to parameter to reduce the response weight.

GET /2016-01-01..2016-12-31?from=GBP&to=USD HTTP/1.1

Here we return the current GBP/USD currency pair with JavaScript.

// Fetch and display GBP/USD
fetch('/latest?from=GBP&to=USD')
  .then(resp => resp.json())
  .then((data) => { alert(`GBPUSD = ${data.rates.USD}`); });

Cache data whenever possible.

Deployment

To build locally, type

docker-compose up -d

Now you can access the API at http://localhost:8080.

In production, create a .env file and run with

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

To update to a newer image, run

docker-compose -f docker-compose.yml -f docker-compose.prod.yml pull
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Within a few minutes, you will access the API at https://yourdomain.com.