Batch Cancel Order
tip
This endpoint provides the batch order mode to cancel a bunch of open orders.
- Order cancellation of future and option cannot be cancelled in one request.
- If both future and option orders are in one request, then by given the category type, only the orders whose symbol matches the category will be operated.
HTTP Request
POST /unified/v3/private/order/cancel-batch
Request Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| category | true | string | Product type. linear,option |
| request | true | array | Object |
| > symbol | true | string | Symbol name |
| > orderId | false | string | Order id. Either orderId or orderLinkId is required |
| > orderLinkId | false | string | User customised order id. Either orderId or orderLinkId is required |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| result | Object | |
| > list | array | Object |
| >> category | string | Products category |
| >> symbol | string | Symbol name |
| >> orderId | string | Order id |
| >> orderLinkId | string | User customised order id |
| retExtInfo | Object | |
| > list | array | Object |
| >> code | integer | Success/error code |
| >> msg | string | Success/error message |
Request Example
POST /unified/v3/private/order/cancel-batch HTTP/1.1
Host: api-testnet.bybit.com
X-BAPI-SIGN-TYPE: 2
X-BAPI-SIGN: XXXXX
X-BAPI-API-KEY: XXXXX
X-BAPI-TIMESTAMP: 1672818987475
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"category": "linear",
"request": [
{
"symbol": "ETHUSDT",
"orderLinkId": "test-002"
},
{
"symbol": "XRPUSDT",
"orderLinkId": "test-003"
}
]
}
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"list": [
{
"category": "linear",
"symbol": "ETHUSDT",
"orderId": "",
"orderLinkId": "test-002"
},
{
"category": "linear",
"symbol": "XRPUSDT",
"orderId": "",
"orderLinkId": "test-003"
}
]
},
"retExtInfo": {
"list": [
{
"code": 0,
"msg": "success"
},
{
"code": 110001,
"msg": "order not exists or too late to cancel"
}
]
},
"time": 1672818989928
}