command.trade_order.cancel
Cancel a trade order.
Method
command.trade_order.cancel
Description
Cancels an open trade order. Only orders in PENDING, OPEN, or PARTIALLY_FILLED status can be cancelled.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
tradeOrderId | string | Yes | Trade order ID to cancel |
Result
Returns the cancelled trade order object.
Trade Order Object
| Field | Type | Description |
|---|---|---|
tradeOrderId | string | Order identifier |
status | string | Updated status (CANCELLED) |
cancelReason | string | Cancellation reason |
canceledAt | integer | Cancellation timestamp (ms) |
| ... | ... | Other order fields |
Usage
result = await client.rpc("command.trade_order.cancel", {
"tradeOrderId": "770e8400-e29b-41d4-a716-446655440002"
})
Example Response
{
"tradeOrderId": "770e8400-e29b-41d4-a716-446655440002",
"tradingAccountId": "550e8400-e29b-41d4-a716-446655440000",
"venue": "BINANCE",
"instrumentId": "BINANCE:BTC/USDT",
"orderSide": "BUY",
"orderType": "LIMIT",
"status": "CANCELLED",
"cancelReason": "USER_REQUESTED",
"quantity": "0.1",
"executedQuantity": "0.05",
"executedCost": "2499.925",
"createdAt": 1703052635110,
"updatedAt": 1703152635110,
"canceledAt": 1703152635110
}
Error Codes
| Code | Description |
|---|---|
| 101 | Order not found |
| 102 | Order cannot be cancelled (already filled/cancelled) |
Notes
- Partially filled orders can be cancelled; filled quantity is retained
- Cancel requests are best-effort; order may fill before cancellation
- Subscribe to trading account channel for confirmation