Cancel or Modify Orders
Cancel Order
Request class: TigerHttpRequest(MethodName.CANCEL_ORDER)
Description
Cancel a placed order. Cancellation is asynchronous. A successful response contains only the order ID in data and confirms that the request was accepted; it does not mean the order has been canceled. Query the order afterward and check both status and cancelStatus. Use them together to determine the final result.
After submitting an order using TradeOrderRequest, the submitted order will enter various states depending on different circumstances. Orders that have already been filled or rejected by the system cannot be canceled. Only orders in submitted or partially filled status can be canceled. Please refer to the description of the TigerHttpRequest(MethodName.ORDERS) method to understand the possible order states.
For batch orders, you can use TigerHttpRequest(MethodName.ACTIVE_ORDERS) to get the list of pending orders and cancel them one by one. For orders that have already been requested for cancellation, do not repeat the request. After executing the cancellation command, wait for a period of time and then check the pending orders again.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| account | string | Yes | User authorized account: DU000001 |
| id | long | Yes | Order ID returned when placing order |
| secret_key | string | No | Trader secret key, for institutional users only |
Response
| Name | Type | Description |
|---|---|---|
| id | long | Unique order ID, can be used to query/modify/cancel orders |
Example
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
TigerHttpRequest request = new TigerHttpRequest(MethodName.CANCEL_ORDER);
String bizContent = TradeParamBuilder.instance()
.account("DU000001")
.id(100000000000000001L)
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);
JSONObject data = JSON.parseObject(response.getData());
Long id = data.getLong("id");Example Response
{
"code": 0,
"message": null,
"timestamp": 1525938835697,
"data": {
"id":100000000000000001
}
}Rate Limit
The base rate limit is 120 requests/min.
Modify Order
Request class: TigerHttpRequest(MethodName.MODIFY_ORDER)
Description
Modification rules depend on the account and original order type:
- Global accounts: There is no universal rule that every request must explicitly contain at least one changed field or that
order_typecan never be supplied. Supported fields and omission behavior depend on the original order type. Supply only fields supported for that order. - Prime/Paper accounts: The original order type determines how the modification is handled;
order_typecannot convert the order to another type. Orders such as LMT, STP, STP_LMT, and TRAIL require an effective quantity, price, or trailing parameter appropriate to the original order type. See the table below.
Zero and omission are handled by account path:
| Account path | total_quantity=0 | Applicable price field is 0 | order_type | Omitted time_in_force |
|---|---|---|---|---|
| Global | Retains the original quantity when the resulting request has order_type=LMT | Retains the original limit price when the resulting request has order_type=LMT | An explicit value is retained; omission copies the original order type | Completed as DAY |
| Prime/Paper | Not sent as a new quantity | LMT/STP/STP_LMT/TRAIL prices are not sent as new values; multi-leg orders may use negative prices | The service queries and enforces the original order type | Completed as DAY |
A Prime/Paper standard-order request must contain at least one quantity, price, or trailing change effective for the original order type. An Iceberg request may change only display sizes, check intervals, or effective times in algo_params; see the rules below.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| account | string | Yes | User authorized account: DU000001 |
| id | long | Yes | Order ID returned when placing order |
| order_type | string | No | Its use for Global accounts depends on the original order; Prime/Paper uses the queried original order type and cannot use this field to convert the order type |
| total_quantity | long | No | Order quantity (Hong Kong stocks, Shanghai-Hong Kong Stock Connect, warrants, and callable bull/bear contracts have minimum quantity restrictions) |
| total_quantity_scale | int | No | Order quantity offset, default is 0. For odd lot orders, total_quantity and total_quantity_scale combine to represent the actual order quantity, e.g., total_quantity=111 total_quantity_scale=2, then actual quantity=111*10^(-2)=1.11 |
| limit_price | double | No | New limit price for a standard order whose original type is LMT or STP_LMT. Required combinations depend on the account and original order type. Prime/Paper Iceberg modification does not support this field |
| aux_price | double | No | New stop price when the original order is STP or STP_LMT; trailing amount when it is TRAIL. Required combinations depend on the account and original order type |
| trailing_percent | double | No | For an original TRAIL order, provide aux_price or trailing_percent; when both are supplied, trailing_percent takes priority |
| cash_amount | double | No | Order amount modification is unsupported. Prime/Paper rejects a request containing this field; do not submit it as a modifiable field for Global accounts either |
| display_size | int | No | Display quantity for Prime/Paper Iceberg modification only |
| min_display_size | int | No | Minimum display quantity for Prime/Paper Iceberg modification only |
| check_intervals | int | No | Price check interval in seconds for Prime/Paper Iceberg modification only |
| price_type | string | No | Prime/Paper Iceberg modification currently does not support changing this field |
| start_time | long | No | This top-level field is not used for Iceberg modification. For Prime/Paper Iceberg orders, put start_time in algo_params as a Unix timestamp in milliseconds |
| end_time | long | No | This top-level field is not used for Iceberg modification. For Prime/Paper Iceberg orders, put end_time in algo_params as a Unix timestamp in milliseconds |
| algo_params | List<TagValue> | No | For Prime/Paper Iceberg effective-time changes, include start_time and/or end_time in this list |
| secret_key | string | No | Trader secret key, for institutional users only |
Prime/Paper Iceberg modification: You can modify
total_quantity,display_size,min_display_size,check_intervals, andstart_timeorend_timesupplied throughalgo_params. Changinglimit_priceorprice_typeis unsupported. Top-levelstart_timeandend_timeare not used for Iceberg modification. Global accounts are outside this support scope.
TradeParamBuilderhas no convenience methods fordisplay_size,min_display_size,check_intervals,price_type,start_time, orend_time.algo_paramsis available throughTradeParamBuilder.algoParams(...); Iceberg effective times must be nested there. The current builder has no corresponding display-field modification methods.To modify display-related fields, construct the
biz_contentJSON manually and submit it throughTigerHttpRequest.setBizContent(...); do not place these fields inalgo_params:JSONObject params = new JSONObject(); params.put("account", "DU000001"); params.put("id", 100000000000000001L); params.put("display_size", 100); params.put("min_display_size", 50); params.put("check_intervals", 30); TigerHttpRequest request = new TigerHttpRequest(MethodName.MODIFY_ORDER); request.setBizContent(params.toJSONString());
The response contains only the order ID in data and does not report the final replacement state. Query the order and check both status and replaceStatus. replaceStatus=REPLACED means the replacement was confirmed, while replaceStatus=FAILED means it failed. Continue querying other intermediate states and interpret them together with the order status.
Response
| Name | Type | Description |
|---|---|---|
| id | long | Unique order ID, can be used to query/modify/cancel orders |
Example
TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(
ClientConfig.DEFAULT_CONFIG);
TigerHttpRequest request = new TigerHttpRequest(MethodName.MODIFY_ORDER);
// Assume this ID belongs to an existing modifiable LMT or STP_LMT order.
String bizContent = TradeParamBuilder.instance()
.account("DU000001")
.id(100000000000000001L)
.totalQuantity(200L)
.limitPrice(60.0)
.buildJson();
request.setBizContent(bizContent);
TigerHttpResponse response = client.execute(request);
JSONObject data = JSON.parseObject(response.getData());
Long id = data.getLong("id");Example Response
{
"code": 0,
"message": null,
"timestamp": 1525938835697,
"data": {
"id":100000000000000001
}
}Rate Limit
The base rate limit is 120 requests/min.
Updated about 1 month ago
