How to get historical FX rates in code

Fetch the exchange rate for any currency pair on any past date. Examples in curl, JavaScript, and Python.

curl

curl "https://fx.wrapper-agency.com/api/v1/rate?from=USD&to=EUR&date=2020-03-23"

JavaScript (fetch)

const res = await fetch(
  "https://fx.wrapper-agency.com/api/v1/rate?from=USD&to=EUR&date=2020-03-23"
);
const { rate } = await res.json();
console.log(rate); // 0.92739

Python (requests)

import requests
r = requests.get(
    "https://fx.wrapper-agency.com/api/v1/rate",
    params={"from": "USD", "to": "EUR", "date": "2020-03-23"},
)
print(r.json()["rate"])  # 0.92739

Converting an amount

Multiply the amount by the rate, or pass amount to get it computed for you. Note: for weekends and holidays, reference rates fall back to the most recent trading day.

See the full API reference. Data: European Central Bank reference rates.