Cancel Order
cancel_order
Input Parameters
| Parameter | Type | Description |
|---|---|---|
| account | Account | Account |
| orderResult | OrderResult | Order object to cancel |
| unblock | bool (optional) (default = false) | Non-blocking |
Result Response
| Parameter | Type | Description |
|---|---|---|
| is_success | bool | Whether successful |
| data | OrderResult | Returned canceled order info |
| message | string | Error message when is_success = False |
OrderResult Fields
Return type: Object
| Parameter | Type | Description |
|---|---|---|
| function_type | int | Function type: 0 New, 10 Execute new, 15 Modify price, 20 Modify quantity, 30 Cancel, 90 Failed |
| date | string | Trade date |
| seq_no | string | Order sequence number |
| branch_no | string | Branch code |
| account | string | Account |
| order_no | string | Order number |
| asset_type | int | Asset type: 0 Securities |
| market | string | Market: TAIEX listed, TAISDAQ OTC, TAIEMG emerging |
| market_type | MarketType | Market type: COMMON, FIXING, INTRADAY_ODD, ODD, EMG, EMG_ODD |
| stock_no | string | Stock code |
| buy_sell | BSAction | Buy/sell: BUY, SELL |
| pric_type | PriceType | Effective price type: LIMIT, LIMIT_UP, LIMIT_DOWN, MARKET, REFERENCE |
| price | double | Price |
| quantity | int | Original order quantity |
| time_in_force | TimeInForce | Time in force: ROD, FOK, IOC |
| order_type | OrderType | Order type: STOCK, MARGIN, SHORT, DAY_TRADE, SBL |
| is_pre_order | bool | Whether this is a pre-order |
| status | int | Order status |
| after_price_type | PriceType | Effective price type |
| after_price | double | Effective price |
| unit | int | Unit count |
| after_qty | int | Effective quantity, including filled quantity |
| filled_qty | int | Filled quantity |
| filled_money | int | Filled amount |
| before_qty | int | Effective quantity before modification |
| before_price | double | Effective price before modification |
| user_def | string | Custom field |
| last_time | string | Last update time |
| details | list | Order history; available when querying order_result_detail or order_history |
| error_message | string | Error message |
Request Example
auto target_order = order_results_response.data.value()[0];
auto cancel_response = sdk->stock->cancel_order(target_account, target_order, std::nullopt);
Response Example
{
isSuccess = true,
message = ,
data = OrderResult{functionType = 30, status = 30, afterQty = 0, ...}
}