Sanic Currency Exchange Rates Api


This is a self hosted, free, currency exchange rate api, free demo at

The current and historical foreign exchange rates data are from European Central Bank.

How to

Make sure docker is installed.

  • git clone
  • run docker docker build -t rate-api . && docker run --name rate-api -t -i -e DATABASE_URL=postgresql://dbuser:[email protected]:5432/dbname rate-api

Why a new frok

This project is a fork from ExchangeRatesApi project, the original project is great, but as a project, is seems like they have some outdated dependencies (security issues) and difficulties to deploy.

Difference Original Fork
sanic version 0.8.x latest/19.12.2
python 3.6 3.7
pin dependencies false true
deploy to heroku one click (can be too)
deploy as container got some problem easy
xml parser xml.etree defusedxml


Lates & specific date rates

Get the latest foreign exchange rates.

GET /latest

Get historical rates for any day since 1999.

GET /2018-03-26

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

Rates history

Get historical rates for a time period.

GET /history?start_at=2018-01-01&end_at=2018-09-01

Limit results to specific exchange rates to save bandwidth with the symbols parameter.

GET /history?start_at=2018-01-01&end_at=2018-09-01&symbols=ILS,JPY

Quote the historical rates against a different currency.

GET /history?start_at=2018-01-01&end_at=2018-09-01&base=USD

Client side usage

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))

  .then((resp) => resp.json())
  .then((data) => fx.rates = data.rates)


contributing guide



Sanic Currency Exchange Rates API

This is a self hosted, free, currency rate api.

Sanic Currency Exchange Rates API Info

⭐ Stars 18
πŸ”— Homepage
πŸ”— Source Code
πŸ•’ Last Update 5 months ago
πŸ•’ Created 2 years ago
🐞 Open Issues 8
βž— Star-Issue Ratio 2
😎 Author tim-hub