Skip to main content

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

FieldTypeRequiredDescription
tradeOrderIdstringYesTrade order ID to cancel

Result

Returns the cancelled trade order object.

Trade Order Object

FieldTypeDescription
tradeOrderIdstringOrder identifier
statusstringUpdated status (CANCELLED)
cancelReasonstringCancellation reason
canceledAtintegerCancellation 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

CodeDescription
101Order not found
102Order 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