CodingNic

Live and Historical Data

Request Historical Reference Rates

Live and Historical Data 30 min read

Request Historical Reference Rates

Request Historical Reference Rates

Open components/Chart.js.

Use Frankfurter v2 to request historical reference data for the selected pair and range.

javascript
const url =
  `https://api.frankfurter.dev/v2/rates` +
  `?from=${iso(start)}` +
  `&to=${iso(end)}` +
  `&base=${encodeURIComponent(from)}` +
  `&quotes=${encodeURIComponent(to)}`;

The response is an array of rows containing dates, base currency, quote currency, and rates.

Test it

Select 1W, 1M, and 1Y and confirm the network request dates change.

Checkpoint

The chart receives actual historical data rather than simulated points.