WS Cancel Order
WS Cancel Order
Cancel orders via private WebSocket connection. Up to 50 orders per request.
Prerequisites
A valid listenKey must be obtained and the private WebSocket connection must be established before sending trade requests.
Request Format
{"action":"batch-cancel-orders","param":{"id":"1004","args":[{...},{...}]}}
| Field | Required | Type | Description |
|---|---|---|---|
| action | Yes | string | Fixed as "batch-cancel-orders" |
| param | Yes | object | Batch cancel parameters |
| param.id | Yes | string | Client request ID, used to match response |
| param.args | Yes | array | Cancel arguments array, 1 to 50 objects |
args[N] Object Fields
| Field Name | Required | Type | Description |
|---|---|---|---|
| ordId | Yes | string | Order ID |
Request Example
{
"action": "batch-cancel-orders",
"param": {
"id": "1004",
"args": [
{"ordId": "1000587865918838"},
{"ordId": "1000587865914949"}
]
}
}
Response Format
{"id":"1004","action":"batch-cancel-orders","code":"0","msg":"","data":[{"ordId":"1000587865918838","sCode":"0","sMsg":""},{"ordId":"","sCode":"50012","sMsg":"cancel failed: OrderNotFound"}]}
Response Parameters
| Field Name | Type | Description |
|---|---|---|
| id | string | Client request ID, matching the request |
| action | string | Fixed as "batch-cancel-orders" |
| code | string | Result code, "0" means all items processed |
| msg | string | Result message |
| data | array | Per-order results, in the same order as args |
| data[].ordId | string | Order ID, empty on failure |
| data[].sCode | string | Per-item result code, "0" means success |
| data[].sMsg | string | Per-item result message |
Processing Rules
| Scenario | Code | Message |
|---|---|---|
| All orders cancelled | 0 | |
param is not valid JSON | 50018 | Invalid request json |
args empty or > 50 | 50005 | args length must be between 1 and 50 |
| Single item: invalid arg | 50003 | Invalid arg (per-item sCode) |
| Single item: ordId is required | 50003 | ordId is required (per-item sCode) |
| Single item: cancel failed | 50012 | cancel failed (per-item sCode) |