Cancel Order
This endpoint allows users to cancel a pending or partially filled order by providing either the system-generated order_no or a client-defined reference_id. If both are provided, the system will prioritize order_no. Two order cancellation methods are available:
- Single Crypto Cancel Order: Cancel order for a single crypto
- Batch Crypto Cancel Order: Cancel order for multiple cryptos (up to 5 simultaneous cryptocurrency orders)
Single Crypto Cancel Order
HTTP Request
DELETE /trade/v1/ordersRequest Parameters
| Name | Type | Required | Description |
|---|---|---|---|
order_no | STRING | No | Internal order number generated by the system. |
reference_id | STRING | No | Custom client-defined identifier for the order. |
Example cURL Request
curl --location --request DELETE '{$base_url}/trade/v1/orders' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'X-API-Signature: YOUR_GENERATED_SIGNATURE' \
--header 'X-API-Timestamp: 1746774142003' \
--header 'Content-Type: application/json' \
--data-raw '{
"order_no": "22000000022"
"reference_id": ""
}'Successful Response Example
{
"code": 0
}Error Response Example
{
"code": 030202,
"message": "Invalid Parameter",
"details": "order_no or reference_id is invalid"
}See the Error Code Reference for details on possible error codes.
Batch Crypto Cancel Order
HTTP Request
DELETE /trade/v1/orders/batchRequest Parameters
| Name | Type | Required | Description |
|---|---|---|---|
order_no | STRING | No | Internal order number generated by the system. |
reference_id | STRING | No | Custom client-defined identifier for the order. |
Example cURL Request
curl --location --request DELETE '{$base_url}/trade/v1/orders/batch' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'X-API-Signature: YOUR_GENERATED_SIGNATURE' \
--header 'X-API-Timestamp: 1746774142003' \
--header 'Content-Type: application/json' \
--data-raw '[{
"order_no": "22000000022"
"reference_id": ""
},{
"order_no": "22000000023"
"reference_id": ""
},{
"order_no": "22000000024"
"reference_id": ""
}]'Successful Response Example
{
"code": 0,
"data": [
{
"order_no": "22000000022",
"result": {
"code": 0,
}
},
{
"order_no": "22000000023",
"result": {
"code": 0,
}
},
{
"order_no": "22000000024",
"result": {
"code": 11030204,
"message": "Order Limit"
}
}
]
}Error Response Example
{
"code": 030202,
"message": "Invalid Parameter",
"details": "order_no or reference_id is invalid"
}WebSocket Callback - Cancel Order Notification
To receive order status notifications, you should use a WebSocket connection. This allows your system to stay updated on changes such as order submission, partial fills, full fills, cancellations, or rejections.
WebSocket Endpoint for Order Status
To subscribe to order status updates, connect to the following WebSocket endpoint:
wss://{{base_url}}/ws/trade/v1Once connected and authenticated, the server will push real-time updates regarding your active orders directly through this WebSocket channel.
WebSocket Message Fields
| Field | Type | Description |
|---|---|---|
market | ENUM | Market code (e.g., hkex, nasdaq) |
order_type | ENUM | Order type (e.g., limit, enhanced limit) |
symbol | STRING | Code of the traded product |
name | STRING | Name of the product |
order_side | ENUM | Order direction: buy or sell |
account_code | STRING | Trading account ID |
order_no | STRING | System-generated order number |
order_status | ENUM | Order status after cancellation (can) |
price | DECIMAL | Order price |
qty | DECIMAL | Original quantity |
reference_id | STRING | Client-defined identifier |
portfolio_id | STRING | Portfolio ID (which is a user-defined external id ) to distinguish between orders from different portfolios. |
update_time | LONG | Last updated timestamp (UNIX seconds) |
create_time | LONG | Order creation timestamp |
WebSocket Callback Example
{
"type": "order",
"data": {
"market": "hkex",
"order_type": "enhanced_limit_order",
"symbol": "00700",
"name": "TENCENT",
"order_side": "buy",
"account_code": "80114138",
"order_no": "22000000022",
"order_status": "can",
"price": 423.83,
"qty": 1000,
"outstand_qty": 0,
"execute_qty": 0,
"execute_amount": 0,
"charge": 0,
"charge_base_currency": "HKD",
"base_currency": "HKD",
"reference_id": "",
"portfolio_id": "",
"reject_reason": "",
"update_time": 1746775317,
"create_time": 1746775257
}
}
