A foreign exchange rates and currency conversion API that exposes data published by European Central Bank.
The rates are updated daily around 4PM CET.
Get the latest foreign exchange reference rates in JSON format.
GET /v1/latest
Host: localhost:3000Get historical rates for any day since 1999-01-04.
GET /v1/historical/2008-03-18
Host: localhost:3000Rates are quoted against the Euro by default. Quote against a different currency by setting the base parameter in your request.
GET /v1/latest?base=USD
Host: localhost:3000Request specific exchange rates by setting the codes parameter.
GET /v1/latest?codes=USD,GBP
Host: localhost:3000Response format.
{
"base": "EUR",
"date": "2021-05-05",
"rates": {
"AUD": 1.4832,
"PLN": 4.2173,
"MYR": 4.7543,
"USD": 1.0961,
[41 world currencies],
}
}# Build and start containers:
docker compose up -d
# Enter api container:
docker exec -it api bash
# Apply database migrations:
make db/migrations/up
# Populate database with rates published by ECB (check goexrates-cli --help):
goexrates-cli load historical
# Run the API:
goexrates-apiAPI's endpoints can be accessed at localhost:3000. Both API (3000) and database (5432) ports
are published and can be accessed via localhost:port.
Run make help to see all available commands and goexrates-cli --help to see more informations
about additional CLI commands that help to manage common/recurring tasks.