Historical candles: broker API endpoints compared
14 documented calls from 9 of the 12 APIs with endpoint records here, and 8 functions and messages from 4 APIs whose interfaces are not HTTP, each with the page it was read on.
Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.
What this task is
A candle, or bar, summarises the price over a fixed interval as an open, a high, a low and a close, sometimes with a volume. Historical candles are what a backtest or a chart is built from.
Historical data is often rationed separately from other calls, by the number of points or the number of requests. Cache what you have downloaded and request only the bars you are missing.
The documented endpoint, API by API
Ordered by the name of the broker or platform API, then by path. The order is not a ranking. Open a row for the parameters, the response and a sample request.
| Broker or platform | Endpoint | What the record says it does | Source |
|---|---|---|---|
| Capital.com | GET/api/v1/prices/{epic} | Historical bid and ask candles for one epic. By default, minute prices for the last 10 minutes. | open-api.capital.comchecked |
| eToro | GET/api/v1/market-data/instruments/{instrumentId}/history/candles/{direction}/{interval}/{candlesCount} | Returns open, high, low, close and volume candles for one instrument, from one minute to one week per candle. | api-portal.etoro.comchecked |
| IG | GET/prices/{epic} | Historical OHLC prices for an epic, paged. Each call eats into your weekly historical data allowance, so cache aggressively. | labs.ig.comchecked |
| IG | GET/prices/{epic}/{resolution}/{numPoints} | The most recent historical prices for an epic at one resolution, as a fixed number of data points. Each point counts against the historical data allowance. | labs.ig.comchecked |
| IG | GET/prices/{epic}/{resolution}/{startDate}/{endDate} | Historical prices for an epic at one resolution between two date times given in the path. Each point counts against the historical data allowance. | labs.ig.comchecked |
| Interactive Brokers | GET/iserver/marketdata/history | OHLC bars for a contract over a period, with bar size, start time, data source and outside hours option. | interactivebrokers.comchecked |
| Match-Trader Platform API | GET/mtr-api/{SYSTEM_UUID}/candles | Download historical candles for a symbol at a chosen interval between two times: open, high, low, close and volume. | app.theneo.iochecked |
| MetaApi | GET/users/current/accounts/{accountId}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles | Download historical candles for one symbol and timeframe, loaded backwards from a start time, up to 1000 at a time. | metaapi.cloudchecked |
| MetaApi | GET/users/current/accounts/{accountId}/symbols/{symbol}/current-candles/{timeframe} | Read the candle now forming for one symbol at one timeframe. | metaapi.cloudchecked |
| OANDA | GET/v3/accounts/{accountID}/candles/latest | The candle still forming and the most recently completed ones, for several combinations of instrument, granularity and price component in one call. | developer.oanda.comchecked |
| OANDA | GET/v3/accounts/{accountID}/instruments/{instrument}/candles | Historical candlesticks for one instrument, requested through an account. Up to 5000 candles per request. | developer.oanda.comchecked |
| OANDA | GET/v3/instruments/{instrument}/candles | Historical candlesticks (OHLC) for one instrument. Up to 5000 candles per request. | Unverifiedraw.githubusercontent.comchecked |
| Saxo OpenAPI | GET/chart/v3/charts | Returns timestamped open, high, low and close samples for one instrument, up to 1,200 samples a call. Horizon sets the bar length in minutes. | developer.saxochecked |
| TradeLocker API | GET/trade/history | Download historical bars for one instrument between two times, at a resolution from one minute to one month. | public-api.tradelocker.comchecked |
The same task where the interface is not HTTP
Some platform APIs, and the streaming interfaces of some broker APIs, are not sent as HTTP requests. A function is called from a program in its language, and a message is sent over an open connection. None has a method or a path, so each row is labelled with its kind and its interface. A record is put on this page by hand, from what the vendor's page says the call does, and one call can do several jobs, so the same function can be on more than one task page. Ordered by the name of the broker or platform API, then interface, then name.
| API | Call | What the record says it does | Source |
|---|---|---|---|
| cTrader Open API | messageProtoOAGetTrendbarsReq cTrader Open API | Asks for historical bars of one size for one symbol, by period of time or by count. | help.ctrader.comchecked |
| Deriv | messageticks_history Deriv WebSocket API | Returns past prices of one symbol, as single ticks or as candles of a chosen width. With subscribe set to 1 it then keeps sending each new tick or the candle now forming. | developers.deriv.comchecked |
| MetaTrader 4 (MQL4) | functionCopyRates() MQL4 | Copies historical bars of a symbol and timeframe into an array of MqlRates structures, by start position and count, by start time and count, or between two times. | docs.mql4.comchecked |
| MetaTrader 4 (MQL4) | functioniClose() MQL4 | Returns the close price of one bar of a symbol and timeframe, counted back from the current bar. | docs.mql4.comchecked |
| MetaTrader 5 (Python package and MQL5) | functioncopy_rates_from() MetaTrader5 Python package | Returns a number of bars for one instrument and timeframe, counting back from a date. | mql5.comchecked |
| MetaTrader 5 (Python package and MQL5) | functioncopy_rates_from_pos() MetaTrader5 Python package | Returns a number of bars for one instrument and timeframe, starting from a bar index where 0 is the bar now forming. | mql5.comchecked |
| MetaTrader 5 (Python package and MQL5) | functioncopy_rates_range() MetaTrader5 Python package | Returns the bars for one instrument and timeframe that open between two dates. | mql5.comchecked |
| MetaTrader 5 (Python package and MQL5) | functionCopyRates() MQL5 | Copies historical bars of a symbol and timeframe into an array of MqlRates structures, by start position and count, by start time and count, or between two times. | mql5.comchecked |
None documented here yet
These APIs have endpoint records on this site, but none is assigned to this task. That describes this dataset. It is not a statement that the API lacks such a call.
- Deriv: none documented here yet
- Trading 212: none documented here yet
- DXtrade APIs: none documented here yet
Brokers and platforms with no endpoint records at all are not listed above. The broker directory shows what is recorded for each.