Skip to main content

Batch Cancel Orders

batch_cancel_order

Input Parameters

ParameterTypeDescription
accountAccountAccount Object
orderResultBatchListBatch Cancel Order Content

Return Result

ParameterTypeDescription
is_successboolIs Success
dataListReturns Modification Info
messagestringReturns Error Message when isSuccess = False

Modification Info OrderResult Fields

Return type: Object

ParameterTypeDescription
function_typeintFunction Type: 0 New Order, 10 Exec New, 15 Mod Price, 20 Mod Qty, 30 Cancel, 90 Failed
datestringTrade Date
seq_nostringSequence Number
branch_nostringBranch Code
accountstringAccount
order_nostringOrder Number
asset_typeintAsset Type: 0 Stock
marketstringMarket: TAIEX (Listed), TAISDAQ (OTC), TAIEMG (Emerging)
market_typeMarketTypeMarket Type: COMMON (Round Lot), FIXING, INTRADAY_ODD, ODD (Post-market Odd), EMG, EMG_ODD
stock_nostringStock Symbol
buy_sellBSActionSide: BUY, SELL
pric_typePriceTypePrice Type: LIMIT, LIMIT_UP, LIMIT_DOWN, MARKET, REFERENCE
pricedoublePrice
quantityintOriginal Order Quantity
time_in_forceTimeInForceTime In Force: ROD, FOK, IOC
order_typeOrderTypeOrder Type: STOCK (Cash), MARGIN, SHORT, DAY_TRADE, SBL
is_pre_orderboolIs Pre-order
statusintOrder Status: 0 Pre-order, 4 Sending, 9 Timeout, 10 Success, 30 Cancelled, 40 Partial Fill/Cancel Remainder, 50 Full Fill, 90 Failed
after_price_typePriceTypeEffective Price Type
after_pricedoubleEffective Price
unitintUnit Size
after_qtyintEffective Quantity (Includes filled portion)
filled_qtyintFilled Quantity
filled_moneyintFilled Amount
before_qtyintQuantity Before Modification
before_pricedoublePrice Before Modification
user_defstringUser Defined Field
last_timestringLast Modified Time
detailslistOrder History (Available in order_result_detail or order_history)
error_messagestringError Message

Request Example


// Batch Cancel (Using batch detailResult content)
std::vector<OrderResult> cancel;
cancel.push_back(batch_list_res.data.value()[0]);
cancel.push_back(batch_list_res.data.value()[1]);


// Batch Cancel (Using different individual orders)
std::vector<OrderResult> cancel;
cancel.push_back(order_res.data.value()[10]);
cancel.push_back(order_res.data.value()[13]);



auto batch_cancel = sdk->stock->batch_cancel_order(target_account, cancel);
if (!batch_cancel.is_success) {
std::cout << "batch_cancel failed reason: "
<< (batch_cancel.message.has_value() ? batch_cancel.message.value() : "No message")
<< std::endl;
}
else {
if (batch_cancel.data.has_value()) {
std::cout << batch_cancel << std::endl;
}
else {
std::cout << "batch_cancel success but no data returned." << std::endl;
}
}

ResultExample

{
isSuccess = true,
message = ,
data =[
OrderResult { // Batch Cancel (Using batch detailResult content)
functionType = 30, // Function Type (int)
date = 2024/03/08, // Trade Date (string)
seqNo = 00000308998, // Sequence Number (string)
branchNo = 6460, // Branch Code (string)
account = 26, // Account (string)
orderNo = x0028, // Order Number (string)
assetType = 0, // Asset Type (int)
market = TAIEX, // Market (string)
marketType = Common, // Market Type (MarketType)
stockNo = 1101, // Stock Symbol (string)
buySell = Sell, // Side (BsAction)
priceType = Limit, // Original Price Type (PriceType)
price = 41.2, // Price (float)
quantity = 5000, // Original Quantity (int)
timeInForce = Rod, // Time In Force (TimeInforce)
orderType = Stock, // Order Type (string)
isPreOrder = False, // Is Pre-order (bool)
status = 30, // Order Status (int)
afterPriceType = Limit, // Effective Price Type (PriceType)
afterPrice = 41.2, // Effective Price (float)
unit = 1000, // Unit Size (int)
afterQty = 0, // Effective Quantity (int)
filledQty = 0, // Filled Quantity (int)
filledMoney = 0, // Filled Amount (int)
beforeQty = 5000, // Quantity Before Mod (int)
beforePrice = 41.2, // Price Before Mod (float)
userDef = 12345678, // User Defined Field (string)
lastTime = 12:53:57.536, // Last Modified Time (string)
details = , // Order History (list)
errorMessage = // Error Message (string)
},
OrderResult {
functionType = 30, // Function Type (int)
date = 2024/03/08, // Trade Date (string)
seqNo = 0000030899, // Sequence Number (string)
branchNo = 6460, // Branch Code (string)
account = 26, // Account (string)
orderNo = x0029, // Order Number (string)
assetType = 0, // Asset Type (int)
market = TAIEX, // Market (string)
marketType = Common, // Market Type (MarketType)
stockNo = 1101, // Stock Symbol (string)
buySell = Sell, // Side (BsAction)
priceType = Limit, // Original Price Type (PriceType)
price = 41.2, // Price (float)
quantity = 5000, // Original Quantity (int)
timeInForce = Rod, // Time In Force (TimeInforce)
orderType = Stock, // Order Type (string)
isPreOrder = False, // Is Pre-order (bool)
status = 30, // Order Status (int)
...
}
]
}