Go to file
Hakan Ensari 3e78e0ab6e Gardening
- Upgrade to Ruby 2.5
- Update dependencies
2017-12-31 16:35:03 +00:00
app Gardening 2017-12-31 16:35:03 +00:00
gem Release 1.0.0 2017-12-31 16:28:36 +00:00
.env.example Move to correct container 2017-11-10 12:58:38 +00:00
.gitignore Gardening 2017-12-31 16:35:03 +00:00
.travis.yml Spring clean code base 2017-11-09 23:30:13 +00:00
docker-compose.override.yml Improve docker setup 2017-11-09 12:37:50 +00:00
docker-compose.prod.yml Limit log sizes 2017-11-23 10:03:58 +00:00
docker-compose.yml Add scheduler 2017-11-09 23:30:14 +00:00
LICENSE Remove dates from license 2017-01-03 12:44:13 +00:00
limit_req.conf Improve docker setup 2017-11-09 12:37:50 +00:00
README.md Improve README 2017-11-12 23:17:18 +00:00

Fixer

Travis

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

A public instance of the API lives at https://api.fixer.io. Alternatively, you can run privately with the provided Docker image.

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 are quoted against the Euro by default. Quote against a different currency by setting the base parameter in your request.

GET /latest?base=USD

Request specific exchange rates by setting the symbols parameter.

GET /latest?symbols=USD,GBP

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://api.fixer.io/latest')
  .then((resp) => resp.json())
  .then((data) => fx.rates = data.rates)
  .then(demo)

Installation

To run locally with Docker, type

docker-compose up -d

Then seed data with

docker-compose run web rake db:migrate rates:load

Now you can access the API at

http://localhost:8080

In production, create a .env file in the project root and run with

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