Import History Trades List
ImportHistoryTradesList¶
Description:
Imports multiple historical closed market trades in one request. Each imported row is stored as a closed trade snapshot with state TS_CLOSED_NORMAL.
Access Control¶
🛡️ Access Level Required:
SESSION_ADMIN,SESSION_MANAGER,SESSION_DEALER
Endpoint¶
This method is routed internally as ImportHistoryTradesList.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
| rows | array | Yes | Array of historical trade objects |
| __access | object | Yes | Access object containing session type information |
Each row supports the same payload as ImportHistoryTrade:
| Name | Type | Required | Description |
|---|---|---|---|
| order | int | Yes | Trade order ID |
| login | int | Yes | Login ID of the trader |
| cmd | int | Yes | Supported values: OP_BUY or OP_SELL |
| volume | int | Yes | Volume in minimal lots |
| open_time | int | Yes | Open time (Unix timestamp) |
| close_time | int | Yes | Close time (Unix timestamp) |
| open_price | double | Yes | Trade open price |
| close_price | double | Yes | Trade close price |
| profit | double | Yes | Total profit |
| commission | double | Yes | Commission applied |
| storage | double | Yes | Storage swap value |
| symbol | string | Yes | Symbol traded |
| sl | double | Yes | Stop Loss |
| tp | double | Yes | Take Profit |
| comment | string | No | Optional comment |
| expiration | int64 | No | Optional expiration time |
| digits | int | No | Symbol precision override |
| reason | int | No | Trade source reason |
| taxes | double | No | Optional taxes value |
| magic | int | No | Optional magic number |
| activation | int | No | Optional activation source |
| gw_source | string | No | Optional external gateway source/provider |
| gw_uuid | string | No | Optional external gateway UUID |
Request Example¶
{
"rows": [
{
"order": 123456,
"login": 1011,
"cmd": 0,
"volume": 100,
"open_time": 1670000000,
"close_time": 1670003600,
"open_price": 1.2345,
"close_price": 1.2360,
"profit": 150.0,
"commission": -5.0,
"storage": -1.5,
"symbol": "EURUSD",
"sl": 1.2300,
"tp": 1.2400
},
{
"order": 123457,
"login": 1011,
"cmd": 1,
"volume": 100,
"open_time": 1670007200,
"close_time": 1670010800,
"open_price": 1.2365,
"close_price": 1.2335,
"profit": 300.0,
"commission": -5.0,
"storage": -1.5,
"symbol": "EURUSD",
"sl": 1.2400,
"tp": 1.2300
}
],
"__access": {
"type": 1
}
}
Response Example¶
{
"rows": [
{
"imported": true,
"order": 123456,
"state": 3,
"login": 1011,
"symbol": "EURUSD",
"cmd": 0,
"volume": 100,
"close_time": 1670003600
}
],
"matched": 2,
"imported": 1,
"failed": 1,
"failures": [
{
"index": 1,
"order": 123457,
"error": "RET_TRADE_EXIST",
"message": "Trade already exists"
}
]
}
Notes¶
rowsmust not be empty.- Each row is processed independently.
- A successful row means the historical trade snapshot was accepted and stored immediately.
- If all rows fail, the method returns
409. - If some rows succeed and some fail, the method returns
207.