Deriv ticks_history
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.
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.
This is a message of the Deriv WebSocket API, not an HTTP endpoint. It has no method and no path: it is sent as JSON over an open WebSocket connection.
The message
- Name
- ticks_history
- Direction
- Request, sent by the client
- Carried by
- WebSocket. Deriv's page marks this call as needing no login, so it can be sent on the public connection as well. The demo and real addresses are not opened as printed: POST /trading/v1/options/accounts/{accountId}/otp returns the address for one account with a one time password already in it.
- Public market data, no login
- wss://api.derivws.com/trading/v1/options/ws/public
- Demo account
- wss://api.derivws.com/trading/v1/options/ws/demo
- Real account
- wss://api.derivws.com/trading/v1/options/ws/real
Fields
| Name | Type | Description |
|---|---|---|
| ticks_historyrequired | string | The symbol, by the short name that active_symbols returns. |
| adjust_start_time | integer | 1 moves the interval back where the market is closed at the end time or the licence limit falls before it. The only value allowed is 1. |
| count | integer | The most ticks or candles to return. |
| endrequired | string | The newest moment wanted: the word latest, or Unix time in seconds as a string. |
| granularity | integer | The width of a candle in seconds, used only with the style candles. One of 60, 120, 180, 300, 600, 900, 1800, 3600, 7200, 14400, 28800 and 86400. The definition gives 60 as the default. |
| start | integer | The oldest moment wanted, as Unix time in seconds. The definition says it defaults to one day ago for ticks, and for candles where neither count nor granularity is given. |
| style | string | candles or ticks: which of the two shapes to return. |
| subscribe | integer | 1 keeps the stream open after the history has been sent. The only value allowed is 1. |
| passthrough | object | Anything you want carried through the call. It comes back unchanged inside echo_req. |
| req_id | integer | A number of your own that is returned on the answer, so answers can be matched to requests. |
What arrives
The history comes first, with msg_type history for ticks or candles for candles. On a stream, each later message has msg_type tick or ohlc.
| Name | Type | Description |
|---|---|---|
| candles | array of objects | Sent for the style candles only. Each entry holds open, high, low, close and epoch. |
| candles[].open | number | The opening price of the candle. |
| candles[].high | number | The highest price of the candle. |
| candles[].low | number | The lowest price of the candle. |
| candles[].close | number | The closing price of the candle. |
| candles[].epoch | integer | The time of the candle, as Unix time in seconds. |
| history.prices | array | The tick prices, in the same order as history.times. |
| history.times | array | The time of each price, as Unix time in seconds. |
| pip_size | number | How many decimal places the prices are meant to be shown with. |
| subscription.idrequired | string | The id of the stream on this connection. Sent with forget to stop it. The subscription object is present only where the request asked for a stream. |
| echo_reqrequired | object | A copy of the request that was sent. |
| msg_typerequired | string | Names the kind of answer. One of history, tick, candles and ohlc, by the style asked for and by whether it is the first answer or a later one. |
| req_id | integer | The number the request carried. Present only where the request had one. |
Sample
Written by this site from the fields recorded on this page. It has not been run against a terminal, a server or an account, and the values in it are placeholders. No credential is typed into it: where a field holds one, the placeholder says where it comes from. Nothing is entered on this site.
{
"ticks_history": "R_50",
"adjust_start_time": 1,
"count": 10,
"end": "latest",
"start": 1,
"style": "ticks"
}Limits that apply at Deriv
| Limit | Value | Scope | Source |
|---|---|---|---|
| Headline limit | 80/min per logged in user (REST)Sources conflict developers.deriv.com states 60, checked . Deriv's API overview in the text form it publishes for AI tools gives REST 60 requests a minute per token, where its Limits page gives 80 a minute per logged in user. The same overview also gives 100 WebSocket requests a second per connection, 100 active subscriptions per connection and 5 concurrent WebSocket connections per user, none of which the Limits page mentions. Deriv's own pages disagree; the conflict is labelled, not resolved. Pace against 60. | user, REST | developers.deriv.comchecked |