Market data
This API part grants access to market data
This section includes several endpoints that serve different purposes:
GET/depth - is used to get a current depth of the market for the instrument.
GET/history - request for history bars.
GET/quotes - get the best bid and best ask of the instrument.
GET/trades - get the last trade price on the market.
GET/dailyBar – request for the latest daily bar.
All methods must include tradableInstrumentId, which can be received via GET/accounts /{accountId}/instruments, and accountId.
A full list of available methods and their parameters can be found here:
https://sandbox-api.traderevolution.com/traderevolution/v1/swagger-ui/index.html#/Market%20data
Get daily bar
GET/traderevolution/v1/dailyBar
This method allows you to request the current (latest) day bar. Please note that you should specify the bar type in the query, i.e. ask, bid, or trade (last). Also, the tradableInstrumentId should be specified, it can be found via GET/accounts /{accountId}/instruments method.
Query
accountId*
integer
Account identifier.
barType*
string
Defines the OHCL data source. Available values: ASK, BID, TRADE.
tradableInstrumentId*
integer
Identifier of the instrument that is used for trading purposes.
CURL (for ASK bar)
Response
As a result, you will get a data set in the response, which includes Open, High, Low, Previous close price and Volume.
Standard errors can be received as well. If some data is absent, the null value will be returned (see Volume in the response).
A detailed description of this method can be found here:
Market depth
GET/traderevolution/v1/depth
This method allows requesting the current market depth info (order book) for the selected instrument by its tradable ID, which can be found via GET/accounts /{accountId}/instruments.
Query
accountId*
integer
Account identifier.
tradableInstrumentId*
integer
Identifier of the instrument that is used for trading purposes.
CURL
Response
The response will contain current bids and asks as well as the size value for each row. The info can be requested for a certain instrument once at a time. Standard errors can be received as well.
A detailed description of this method can be found here:
Historical data
GET/traderevolution/v1/history
This method allows you to request specific historical data for the selected instrument (by its tradable ID), which can be found via GET/accounts/{accountId}/instruments.
Please note that the time for bars ≥ 1D (daily, weekly, monthly) will be set to 00:00 in UTC timezone.
Note that QH (quote history) node is required for the Client API.
All the parameters in the table below are required:
Query
accountId*
integer
This parameter specifies the identifier of the account for which the history is requested.
from*
integer
Specifies the Unix timestamp in milliseconds (UTC) for the leftmost required bar, inclusive.
resolution*
string
Parameter defines the symbol resolution, with possible values: daily (1D), weekly (1W), monthly (1M), hourly (1H, 4H), and intra-day resolutions such as minutes (1m, 5m, 15m, 30m)
to*
integer
Parameter specifies the Unix timestamp in milliseconds (UTC) for the rightmost required bar.
The to parameter represents the upper time boundary: if it falls inside a bar interval, that bar is returned but cut at the specified to timestamp (see examples below).
tradableInstrumentId*
integer
The identifier of the instrument for which the history is requested.
CURL
Response
The response object for this method contains detailed historical data for the specified instrument over the requested period. Each entry in the barDetails array represents a single bar, including properties such as the Timestamp of the bar in milliseconds (UTC), Open, High, Low, and Close prices + Volume.
Bars are returned for the time interval [from, to). Also note that the rightmost bar may not be full and is cut to the specified Unix timestamp. For better understanding see examples below:
Example 1 (Hourly bar with partial minutes):
resolution: 1Hfrom: 1769612400000 → 17:00to: 1769613008877 → 17:10
Response:
In the response, the 1H bar starting at 17:00 is aggregated from minute bars in the interval 17:00, 17:01... → 17:09.
Example 2 (Multiple hourly bars):
resolution: 1Hfrom: 1769605200000 → 13:00to: 1769616000000 → 16:00
Response:
In the response, there are 3 hourly bars:
13:00 (1769605200000) → aggregated from minute bars 13:00–13:59;
14:00 (1769608800000) → aggregated from minute bars 14:00–14:59;
15:00 (1769612400000) → aggregated from minute bars 15:00–15:59.
The 16:00 hourly bar is not included, because to = 16:00 is exclusive. Each bar’s t corresponds to the start of the aggregation period. Aggregation always happens from all minute bars within the hour.
Note that possible errors include receiving a no_data status code if there is no data in the requested period. If there is no data in the requested period, but there is data in the previous period, the status code will be set to no_data and the nb property to UNIX timestamp of the next available bar behind the range.
A detailed description of this method can be found here:
Quotes
GET/traderevolution/v1/quotes
This method allows you to get the current prices for the selected instrument (by its tradable ID). This ID can be found via the GET/accounts/{accountId}/instruments request. Note that all the parameters in the table below are required:
Query
accountId*
integer
Specifies the identifier of the account.
tradableInstrumentId*
integer
Specifies the identifier of the instrument for which quotes are requested.
CURL
Response
The response includes: ap - Ask price, bp - Bid price, as - Ask size, and bs - Bid size.
Standard errors can also be received, and if any data is absent, the null value will be returned.
A detailed description of this method can be found here:
Get last bar
GET/traderevolution/v1/lastBar
This method allows you to request the latest daily bar (current OHLCV) for a given instrument, along with the previous close price and the previous bar’s date. The following parameters from the table below are required:
Query
accountId*
integer
Specifies the identifier of the account.
tradableInstrumentId*
integer
Specifies the identifier of the instrument for which the trades history is requested.
barType*
string
Defines the OHCL data source. Available values are: BID, TRADE, ASK.
CURL
Response
If there is no bar for today (e.g., non-trading day or session not started), current bar fields will be null, but previous bar data will still be returned:
The response for this method includes the Open (o), High (h), Low (l), Close (c) prices, Volume (v), Number of Ticks (t), and the Timestamp (dt) of the current bar, as well as the Previous Close (pc) and Previous Bar Timestamp (pdt).
Trades
GET/traderevolution/v1/trades
This method allows you to retrieve trade operations for the selected instrument by its tradable ID, which can be found via GET/accounts/{accountId}/instruments. Note that all parameters from the table below are required:
Query
accountId*
integer
Specifies the identifier of the account.
tradableInstrumentId*
integer
Specifies the identifier of the instrument for which the trades history is requested.
CURL
Response
The response for this method includes the Price (p), Size (s), Source (src), and the Timestamp (t) of the trade. Standard errors can be received, and if any data is absent, the null value will be returned.
A detailed description of this method can be found here:
Last updated