Read historical symbol ticks#
About#
Returns historical ticks for a specific symbol from a MetaTrader account. This API is not suppoted by MT4 accounts.
GET /users/current/accounts/:accountId/historical-market-data/symbols/:symbol/ticks
Note: this API is hosted on a different hostname than other MetaApi APIs. Please check the code example below.
Note: this API might require MT terminal to download and process much data at once causing delays in request execution which may be greater than default timeout of 4 minutes.
For more information see Swagger documentation. Note, that this URL is valid for new-york region only. You can find URLs for other regions on API access page.
Headers#
Name | Type | Required | Description |
---|---|---|---|
auth-token | string | Yes | authorization token. See Authentication & authorization |
Path parameters#
Name | Type | Required | Description |
---|---|---|---|
accountId | string | Yes | MetaTrader account id. You can retrieve account id from Web application after you add your MetaTrader account to our platform. The account id can also be obtained via Provisioning API |
symbol | string | Yes | symbol to retieve historical ticks for (e.g. a currency pair or an index) |
Query parameters#
Name | Type | Required | Description |
---|---|---|---|
startTime | datetime | time to start loading ticks from. Note that ticks are loaded in forward direction, so this should be the earliest time. Leave empty to request latest ticks | |
offset | integer | number of ticks to skip (you can use it to avoid requesting ticks from previous request twice) | |
limit | integer | maximum number of ticks to retrieve. Must be less or equal to 1000 |
Responses:
- 200 - Historical ticks for a specified symbol and MetaTrader account returned successfully. Response schema: array<MetatraderTick>
- 401 - Authorization failed. Response schema: Error
- 404 - MetaTrader account not found or not provisioned yet or symbol is not defined for this broker. Response schema: Error
Examples#
Example request:
curl -X GET --header 'Accept: application/json' --header 'auth-token: token' 'https://mt-market-data-client-api-v1.new-york.agiliumtrade.ai/users/current/accounts/865d3a4d-3803-486d-bdf3-a85679d9fad2/historical-market-data/symbols/AUDNZD/ticks?startTime=2020-04-07T03:45:00.000Z&limit=1'
Example response:
[{
"symbol": "AUDNZD",
"time": "2020-04-07T03:45:00.000Z",
"brokerTime": "2020-04-07 06:45:00.000",
"bid": 1.05297,
"ask": 1.05309,
"last": 0.5298,
"volume": 0.13,
"side": "buy"
}]