frankfurter/README.md

75 lines
1.6 KiB
Markdown
Raw Normal View History

2018-04-16 17:19:15 +02:00
# Frankfurter
2018-10-04 13:04:26 +02:00
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hakanensari/frankfurter)
2015-07-28 17:27:10 +02:00
2018-10-18 14:31:59 +02:00
Frankfurter is a free and open source API for current and historical foreign exchange rates. It tracks data published by the European Central Bank. Rates update around 4PM CET every working day.
2018-09-11 18:59:18 +02:00
2018-10-18 14:31:59 +02:00
Use our public instance or self host with Heroku or Docker.
2018-09-11 18:59:18 +02:00
## Examples
Get the current foreign exchange rates.
2016-04-11 15:38:28 +02:00
```http
2018-09-11 18:59:18 +02:00
GET /latest HTTP/1.1
2016-04-11 15:38:28 +02:00
```
Get historical rates for any day since 1999.
```http
2018-09-11 18:59:18 +02:00
GET /2000-01-03 HTTP/1.1
```
Get historical rates for a time period.
```http
GET /2010-01-01..2010-01-31 HTTP/1.1
2016-04-11 15:38:28 +02:00
```
2018-09-18 14:16:10 +02:00
Get historical rates for a time period up to the present.
```http
GET /2010-01-01.. HTTP/1.1
```
2018-10-10 14:39:25 +02:00
Get a list of available currency symbols, along with their full names.
```http
GET /currencies HTTP/1.1
```
Rates quote against the Euro by default. Quote against a different currency.
```http
2018-09-11 18:59:18 +02:00
GET /latest?from=USD HTTP/1.1
```
Request specific exchange rates.
2016-04-11 15:38:28 +02:00
```http
2018-09-11 18:59:18 +02:00
GET /latest?to=USD,GBP HTTP/1.1
2016-04-11 15:38:28 +02:00
```
2018-09-11 18:59:18 +02:00
Convert a specific amount.
2016-04-11 15:38:28 +02:00
```http
2018-09-11 18:59:18 +02:00
GET /latest?amount=1000&from=GBP&to=USD HTTP/1.1
2016-04-11 15:38:28 +02:00
```
2018-09-11 18:59:18 +02:00
With a full list of currencies, time series grow large in size. For better performance, use the to parameter to reduce the response weight.
2018-03-17 15:28:52 +01:00
```http
2018-09-11 18:59:18 +02:00
GET /2016-01-01..2016-12-31?from=GBP&to=USD HTTP/1.1
2018-03-17 15:28:52 +01:00
```
2018-09-11 18:59:18 +02:00
Here we return the current GBP/USD currency pair with JavaScript.
2016-04-11 15:38:28 +02:00
```js
2018-09-11 18:59:18 +02:00
// Fetch and display GBP/USD
fetch('/latest?from=GBP&to=USD')
.then(resp => resp.json())
.then((data) => { alert(`GBPUSD = ${data.rates.USD}`); });
```
2016-04-11 15:38:28 +02:00
2018-09-11 18:59:18 +02:00
Cache data whenever possible.