Historical exchange rates for a time range
getRangeReturns exchange rates for every interval between datetime_start and datetime_end at the requested accuracy. Requires a plan that includes the range endpoint (medium and up). The allowed span and look-back depend on the chosen accuracy:
day: not more than 366 days between start and end.hour: not more than 7 days between start and end, and not more than 3 months back.quarter_hour: not more than 24 hours between start and end, and not more than 7 days back.minute: not more than 6 hours between start and end, and not more than 7 days back.week: the daily rate at the end of each week (Sunday), not more than 1830 days between start and end.month: the daily rate at the end of each month, any span back to
For week and month the last point is datetime_end itself when it falls inside a period. Add format=csv for one row per point and currency: datetime,base_currency,currency,value.
orient=currency returns one series per currency instead of one point per datetime (data.EUR is a list of {datetime, value}), shape=compact drops the code/value objects (with orient=currency each point is [datetime, value]), and precision rounds.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Filter the returned currencies by type. | |
| shape | No | `default`: every rate as `{"code": "EUR", "value": 0.918456}`. `compact`: plain values, `"EUR": 0.918456`. | |
| format | No | `json` (default), `csv` or `xlsx`. CSV has a header line and one row per currency (and point in time), values without exponent notation. `xlsx` is the same table as an Excel workbook (one sheet, bold frozen header row, numbers as numbers), sent as a download named after the endpoint, e.g. `latest.xlsx`. | |
| orient | No | `datetime` (default): one point per datetime. `currency`: one series per currency, keyed by code. | |
| accuracy | No | The interval accuracy of the returned data. | |
| precision | No | Round every value to this many decimals (0 to 10). By default values carry up to 10 decimals (10 significant digits below 0.1). | |
| currencies | No | Comma-separated list of currency codes to include (e.g. `EUR,USD,CAD`). The array form `currencies[]=EUR¤cies[]=USD` is also accepted. By default all supported currencies are returned. | |
| datetime_end | Yes | End of the range as an ISO 8601 datetime (e.g. `2021-12-31T23:59:59Z`). Must be after or equal to `datetime_start`. | |
| base_currency | No | The base currency that all returned values are relative to. Defaults to `USD`. | |
| datetime_start | Yes | Start of the range as an ISO 8601 datetime (e.g. `2021-11-30T23:59:59Z`). Must be before or equal to `datetime_end`. |