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
-
This interface does not support batch order cancellations. To cancel batch orders, refer to Futures > Place Orders > Cancel Batch Orders.
-
This interface does not support filled order cancellations. To close a filled order, refer to Futures > Place Orders > Close a Position.
-
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 Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Request Method
DELETE
Endpoint
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
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | true | Long | Order ID |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| msg | string | Success |
Request Example
The following Python code shows how to cancel an unfilled order.
Note: For a complete code example, please refer to Introduction > 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 (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)
Note: For a complete Java code example, please refer to Introduction > 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'}