Skip to main content

Cancel Batch Orders

API Description​

This interface allows users to cancel multiple unfilled orders in a batch.

Note: Cancel batch orders is only available via Restful API.

Precautions​

  1. This interface does not return any response parameters. Receiving "code:0" implies success.
{'code': 0, 'msg': ''}

Authentication​

This is a private interface and requires authentication. For details on using the RESTful API, refer to Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

Request Method​

DELETE

Endpoint​

/v1/perpum/batchOrders

Frequency Limit​

The frequency limit for this interface is 10 requests/s per user ID and IP. In addition to this per-interface limit, a global rate limit is also enforced.

For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here

Request Parameters​

ParameterMandatoryTypeDescription
posTypefalseStringSpecifies the type of orders to be cancelled:
execute/plan/moveStop/stopProfitLoss
execute: Market orders,
plan: Limit orders,
moveStop: for moving stop-loss and take-profit order,
stopProfitLoss: Stop loss and take profit orders
sourceIdstrueListList of order IDs as strings.
Example: [orderId1, orderId2] or ["orderId1","orderId2"] (both formats are valid).
Note: The list cannot contain more than 20 order IDs.

Response Parameters​

ParameterTypeDescription
codeIntegerReturn status code (0 means success)
tsLongTimestamp (ms)

Request Example​

The following Python code shows how cancel batch unfilled orders.

Note: For a complete code example, please refer to Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

params = {
# "posType": "plan",
"sourceIds" : ["33308750270880236","33308750270538609"]
}

api_url = "/v1/perpum/batchOrders"
method = "DELETE"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function FuturesRestfulPrivate() is defined in section (Common > Authentication & Code Snippet > Futures > RESTful Private Interface)

Note: For a complete Java code example, please refer to Common > Authentication & Code Snippet > Futures > RESTful Private Interface.

Response Example​

The following is an example response returned by the above Python request; receiving "code:0" implies success.

{'code': 0, 'ts': 1775443378356, 'msg': ''}