Cancel Order
Interface Description
Function description: Cancel the order.
Note: Before calling this interface, you must have successfully called the corresponding order interface.
URL: /trade/order/cancel
Method: POST
Rate limit: The calling frequency of each App ID is limited to 2 times per second.
Request Parameters
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
account_id | String | Yes | Account ID | ac231e01 |
client_order_id | String | Yes | Webull Pay Order ID | CO0358O5QRRC83E0KHK8G8000000 |
Response Parameter
Parameter | Type | Required fields | Description | Example value |
---|---|---|---|---|
client_order_id | String | Yes | Webull Pay Order ID | CO0358O5QRRC83E0KHK8G8000000 |
Request Example
- Python
- Java
from webullpaysdktrade.api import API
from webullpaysdkcore.client import ApiClient
from webullpaysdkcore.common.region import Region
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
account_id = "account_id"
client_order_id = "client_order_id"
api_client = ApiClient(your_app_key, your_app_secret, Region.US.value)
api = API(api_client)
response = api.order.cancel_order(account_id, client_order_id)
if response.status_code == 200:
order_res = response.json()
print(order_res)
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey("<your_app_key>")
.appSecret("<your_app_secret>")
.regionId(Region.us.name())
.build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
OrderResponse orderResponse = apiService.cancelOrder("accountId", "clientOrderId");
//print
System.out.println(JsonSerializer.toJson(orderResponse, SerializeConfig.builder().underscoresToCamel(true).build()));
Response Example
{
"client_order_id": "01916462123512190"
}
Exception Example
{
"error_code": "TRADE_WEBULL_REQUEST_PROCESSING",
"message": "The order is processing, please try later"
}