Skip to main content

Cancel an Order

API Description

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

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

Precautions

  1. This interface only supports one order ID per request. Multiple order IDs are not supported.

Authentication

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

Request Method

POST

Endpoint

/api/v1/private?command=cancelOrder

Frequency Limit

The frequency limit for this interface is 30 requests/2s per user ID. 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
orderNumberTrueStringOrder id

Response Parameters

ParameterTypeDescription
clientOrderIdStringOrder id

Request Example

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

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

api_url = "/api/v1/private?command=cancelOrder"
method = "post"
params = {
"orderNumber": "4624385377826472939"
}
SpotRestfulPrivate(host, api_url, method, api_key, params, secret_key) # function SpotRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Spot > RESTful Private Interface)

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

Response Example

The following is an example response returned by the above Python request:

 {'code': '200',
'data': {'clientOrderId': 4624385377826472939},
'msg': 'SUCCESS',
'success': True,
'failed': False}