Import History Trade
ImportHistoryTrade¶
Description:
Imports a historical trade into the system. This is used for reconstructing or migrating trade history, typically for reporting, correction, or account migration purposes. The trade is automatically marked as closed.
Access Control¶
🛡️ Access Level Required:
SESSION_ADMIN,SESSION_MANAGER,SESSION_DEALER
Endpoint¶
This method is routed internally as ImportHistoryTrade.
Request Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
| order | int | Yes | Trade order ID |
| login | int | Yes | Login ID of the trader |
| cmd | int | Yes | Command type (e.g., OP_BUY, 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 for trade |
| expiration | int64 | No | Expiration time (if any) |
Request Example¶
{
"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,
"comment": "Manual correction"
}
Response Example¶
{
"data": "OK"
}
Error Responses¶
Account Not Found¶
{
"error": "ACCOUNT_NOT_AVAILABLE"
}
Validation Error¶
{
"error": "INVALID_DATA",
"message": "volume is required"
}
Internal Failure¶
{
"error": "IMPORT_TRADE_ERROR",
"message": "Trade already exists or invalid state"
}