Get historical Open, High Low, Close (OHLC) and Average exchange rates for a given time period, ranging from 1 month to 1 minute, where available. Please read all the details before starting integration.
Values for 'high', 'low' and 'average' are based on all recorded prices we published (up to every 1 second).
OHLC requests are currently available for clients of our VIP Platinum tier.
The following parameters are available for OHLC requests:
app_id
(required)
- Your Open Exchange Rates App ID
start
(required)
- A full ISO 8601 formatted timestamp in UTC timezone, with any hour/minute and zero seconds.
- Format: "YYYY-MM-DDThh:mm:00Z".
- Example:
&start=2017-07-17T08:30:00Z
. - There are limitations to the start time, depending on the chosen
period
(see below).
period
(required)
- The requested time period for the OHLC data.
- Allowed periods are:
1m
,5m
,15m
,30m
,1h
,12h
,1d
,1w
, and1mo
. - Example:
&period=30m
. - There are limitations to the period, depending on the chosen 'start' time (see below).
base
(optional)
- Choose base currency for OHLC prices (default USD).
- Example:
&base=GBP
symbols
(optional)
- Limit the number of currencies returned. Recommended to reduce file size.
- Example:
&symbols=XAU,XAG,XPD,XPT
show_alternative
(optional)
- Include alternative, digital and black currency prices
- Example:
&show_alternative=true
prettyprint
(optional)
- Get a human-readable (whitespace formatted) response. Not recommended for production use.
- Example:
&prettyprint=true
Limitations
The following restrictions apply to the combination of start_time
and period
:
start_time
must always have zero seconds (i.e. "hh:mm:00") and must be on/after December 19th 2016.- The format for
start_time
must be ISO-8601 and limited to UTC (timezones are not currently supported) – i.e: "YYYY-MM-DDThh:mm:00Z". - Periods of
1m
must not start more than 60 minutes ago (i.e.start_time
should be within the past hour). - Periods of
5m
must not start more than 24 hours ago, and must be aligned to a whole 5 minute period (e.g. 00, 05, 10, 15 etc.) - Periods of
15m
must not start more than 24 hours ago, and must be aligned to a whole 15 minute period (i.e. 00, 15, 30, 45) - Periods of
30m
or60m
/1h
must not start more than 32 days ago, and must be aligned to a whole 30 minute period (i.e. 00 or 30) - Periods of
12h
or24h
/1d
must be aligned to whole 30 minute period (i.e. 00, 30) - Periods of
7d
/1w
must be aligned to the start of a whole calendar day (i.e. YYYY-MM-DDT00:00:00Z) - Periods of
1mo
must be aligned to the start of a whole calendar month (i.e. YYYY-MM-01T00:00:00Z) - The requested combination of
start_time
andperiod
must not produce anend_time
that is in the future (i.e. an incomplete period).
Important
With a full list of currencies, OHLC responses can be very large in size. For better performance, use the
symbols
parameter to cut down response weight, and setprettyprint=false
to remove whitespace.
API Response Format
The OHLC endpoint response format is similar to the standard API response in latest.json. Please familiarise yourself with the standard API response format before using this endpoint.
The start_time
is the ISO-8601 formatted timestamp (UTC) of the start of period, corresponding to the 'open' rate.
The end_time
is the ISO-8601 formatted timestamp (UTC) of the end of period (inclusive), corresponding to the 'close' rate. (For example, a period of 60m
would begin on hh:00:00
and end on hh:59:59
).
The base
property provides the 3-letter currency code to which all the delivered exchange rates are relative.
The rates
object contains an object for each currency in the result set, labelled by its international-standard 3-letter currency code. Each object contains five values:
open
– The midpoint rate recorded atstart_time
high
– The highest midpoint rate recorded at any time during the periodlow
– The lowest midpoint rate recorded at any time during the periodclose
– The midpoint rate recorded atend_time
average
– The time-weighted average midpoint exchange rate for the entire period
All the values are relative to 1 unit of the requested base
currency.
Errors
Please see API Error Messages for a list of possible errors not specified above.