Skip to main content

Cancel an Order

API Description​

This interface allows users to cancel an unfilled order by specifying the order ID.

Note: Cancel an order is only available via RESTful API.

Precautions​

  1. This interface does not support batch order cancellations. To cancel batch orders, refer to Futures > Place Orders > Cancel Batch Orders.

  2. This interface does not support filled order cancellations. To close a filled order, refer to Futures > Place Orders > Close a Position.

  3. If the specified order ID does not exist, the following response will be returned:

    {'code': 9012, 'msg': 'Position not found.'}

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/order

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
idtrueLongOrder ID

Response Parameters​

ParameterTypeDescription
msgstringSuccess
tsLongTimestamp (ms)

Request Example​

The following Python code shows how to cancel an unfilled order.

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

params = {
"id": "33308749002645666",
}

api_url = "/v1/perpum/order"
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:

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