Sign inSign up

hakanensari/fixer

By hakanensari

•Updated over 8 years ago

A foreign exchange rates and currency conversion API

Image
4

585

hakanensari/fixer repository overview

⁠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

Finally, use all the above together.

GET /latest?from=EUR&to=GBP&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

Tag summary

Content type

Image

Digest

Size

360.2 MB

Last updated

over 8 years ago

docker pull hakanensari/fixer