撤銷訂單
接口说明
- 功能說明:撤銷訂單。 
- 注意事項:調用此接口前,必須已經成功調用對應的下單接口。 
- 適用對象:通過OpenApi開發平台對接webull的客戶。 
- 請求URL:/trade/order/cancel 
- 請求方式:POST 
- 頻次限制:每個AppId調用頻次限制為1秒1次 
請求參數
| 參數 | 類型 | 是否必填 | 描述 | 示例值 | 
|---|---|---|---|---|
| account_id | String | 是 | 賬戶id | 20150320010101001 | 
| client_order_id | String | 是 | 第三方訂單ID | 2022021819071234 | 
響應參數
| 參數 | 類型 | 是否必填 | 描述 | 示例值 | 
|---|---|---|---|---|
| client_order_id | String | 是 | 第三方訂單ID | 2022021819071234 | 
請求示例
- Python
- Java
from webullsdktrade.api import API
from webullsdkcore.client import ApiClient
from webullsdkcore.common.region import Region
api_client = ApiClient(your_app_key, your_app_secret, Region.HK.value)
api = API(api_client)
response = api.order.cancel_order(account_id, client_order_id)
if response.status_code == 200:
    order_res = response.json()
HttpApiConfig apiConfig = HttpApiConfig.builder()
        .appKey(Env.APP_KEY)
        .appSecret(Env.APP_SECRET)
        .regionId(Region.hk.name())
        .build();
TradeApiService apiService = new TradeHttpApiService(apiConfig);
OrderResponse orderResponse = apiService.cancelOrder(accountId, clientOrderId);