get_candles
Fetch OHLC candle data for Oanda instruments with adjustable granularity, count, or time range. Choose mid, bid, or ask prices and receive volume and completion status for each candle.
Instructions
Fetch OHLC candles for an instrument.
Specify either count (most recent N candles) or an RFC3339
from_time/to_time range; count cannot be combined with both
range bounds. A single request returns at most 5000 candles — for
longer ranges, paginate by setting from_time to the exact time
of the last candle received (not past it, or one candle is silently
skipped) and include_first to false (note the excluded first
candle still counts against count, so a full follow-up page holds
one candle fewer).
Returns instrument, granularity and candles: each candle
has an RFC3339 time, volume (number of price ticks, an
integer), complete (false means the candle is still forming — skip
it for analysis), and o/h/l/c prices as decimal strings (flattened for
a single price component, nested under mid/bid/ask when
several components are requested).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of most-recent candles to return (max 5000; API default 500). Must not be combined with both from_time and to_time. | |
| price | No | Price components to include: M=mid, B=bid, A=ask, or a combination such as BA or MBA. | M |
| smooth | No | When true, each candle's open equals the previous candle's close. | |
| to_time | No | Range end, RFC3339 timestamp (sent as the 'to' parameter). | |
| from_time | No | Range start, RFC3339 timestamp (sent as the 'from' parameter). | |
| instrument | Yes | Instrument name in Oanda format, e.g. EUR_USD or DE30_EUR. | |
| granularity | No | Candle granularity: S/M/H prefixes are seconds/minutes/hours (e.g. M15, H4), D=day, W=week, M=month. | H1 |
| include_first | No | Only used with from_time: include the candle covering from_time (which may be timestamped before it). Set false when paginating with from_time equal to the last candle already received. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||