Go to file
2018-03-09 12:35:43 +00:00
bin Repack app 2018-03-08 23:51:36 +00:00
config Repack app 2018-03-08 23:51:36 +00:00
db/migrate Repack app 2018-03-08 23:51:36 +00:00
lib Add back base 2018-03-09 12:20:25 +00:00
public Repack app 2018-03-08 23:51:36 +00:00
spec Fix broken test 2018-03-09 00:01:34 +00:00
.dockerignore Repack app 2018-03-08 23:51:36 +00:00
.env.example Repack app 2018-03-08 23:51:36 +00:00
.gitignore Gardening 2017-12-31 16:35:03 +00:00
.rubocop.yml Repack app 2018-03-08 23:51:36 +00:00
.tool-versions Repack app 2018-03-08 23:51:36 +00:00
.travis.yml Repack app 2018-03-08 23:51:36 +00:00
config.ru Repack app 2018-03-08 23:51:36 +00:00
docker-compose.override.yml Repack app 2018-03-08 23:51:36 +00:00
docker-compose.prod.yml Move scheduler back to separate container 2018-01-08 12:12:54 +00:00
docker-compose.yml Move scheduler back to separate container 2018-01-08 12:12:54 +00:00
Dockerfile Repack app 2018-03-08 23:51:36 +00:00
Gemfile Repack app 2018-03-08 23:51:36 +00:00
Gemfile.lock Repack app 2018-03-08 23:51:36 +00: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 More notes on Docker 2018-03-09 12:35:43 +00:00

Fixer

Travis

Fixer is a free API for current and historical foreign exchange rates published by the European Central Bank.

Rates are updated around 4PM CET every working day.

Usage

Get the latest foreign exchange rates.

GET /latest

Get historical rates for any day since 1999.

GET /2000-01-03

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

GET /latest?from=USD

Request specific exchange rates.

GET /latest?to=GBP

Change the amount requested.

GET /latest?amount=100

The primary use case is client side. For instance, with money.js in the browser

let demo = () => {
  let rate = fx(1).from("GBP").to("USD")
  alert("£1 = $" + rate.toFixed(4))
}

fetch('https://yourdomain.com/latest')
  .then((resp) => resp.json())
  .then((data) => fx.rates = data.rates)
  .then(demo)

Installation

To build locally, type

docker-compose up -d

Now you can access the API at

http://localhost:8080

In production, first create a .env file based on .env.example. Then, run with

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

To update to a newer image

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 be able to access the API at

https://yourdomain.com:8080