Read history orders by time range#
About#
Returns the history of completed orders for a specific time range
GET /users/current/accounts/:accountId/history-orders/time/:startTime/:endTime
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 |
startTime | string(datetime) | Yes | start of time range, inclusive (in ISO format) |
endTime | string(datetime) | Yes | end of time range, exclusive (in ISO format) |
Query parameters#
Name | Type | Required | Description |
---|---|---|---|
offset | number | pagination offset, default: 0 , min: 0 |
|
limit | number | pagination limit, default: 1000 , min: 1 , max: 1000 |
Responses:
- 200 - History orders with requested time range for a specified MetaTrader account returned successfully. Response schema: Array<MetatraderOrder>
- 401 - Authorization failed. Response schema: Error
- 404 - MetaTrader account not found or not provisioned yet. Response schema: Error
Examples#
Example request:
curl -X GET --header 'Accept: application/json' --header 'auth-token: token' 'https://mt-client-api-v1.new-york.agiliumtrade.ai/users/current/accounts/865d3a4d-3803-486d-bdf3-a85679d9fad2/history-orders/time/2020-04-20T04:00:00.000Z/2020-04-21T06:00:00.000Z'
Example response:
[
{
"clientId": "AS_AUDNZD_YSwKkvRe1B",
"currentPrice": 1.05068,
"currentVolume": 0,
"doneTime": "2020-04-20T05:30:04.361Z",
"doneBrokerTime": "2020-04-20 08:30:04.361",
"id": "46849507",
"magic": 1000,
"platform": "mt5",
"positionId": "46849507",
"state": "ORDER_STATE_FILLED",
"symbol": "AUDNZD",
"time": "2020-04-20T05:30:04.101Z",
"brokerTime": "2020-04-20 08:30:04.101",
"type": "ORDER_TYPE_BUY",
"volume": 0.12
}
]