Skip to main content

Create Batch Order

batch_place_order

Input Parameters

ParameterTypeDescription
accountAccountAccount Object
OrderObjectOrderObject (list of object)Order Content

Return Result

ParameterTypeDescription
is_successboolIs Success
messagestringReturns Error Message when isSuccess = False
dataListReturns Order Information

Order Information 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

Order order = Order{
BsAction::BUY,
"1101",
std::nullopt,
1,
MarketType::INTRADAY_ODD,
PriceType::LIMIT_DOWN,
TimeInForce::ROD,
OrderType::STOCK,
"c++"
};

Order order2 = Order{
BsAction::BUY,
"1101",
std::nullopt,
1,
MarketType::INTRADAY_ODD,
PriceType::LIMIT_DOWN,
TimeInForce::ROD,
OrderType::STOCK,
"c++"
};

std::vector<Order> orders;
orders.push_back(order);
orders.push_back(order2);


auto vec_order_result = sdk->stock->batch_place_order(target_account, orders);
if (!vec_order_result.is_success) {
std::cout << "get order result failed reason: "
<< (vec_order_result.message.has_value() ? vec_order_result.message.value() : "No message")
<< std::endl;
}
else {
if (vec_order_result.data.has_value()) {
std::cout << vec_order_result << std::endl;
}
else {
std::cout << "Order result success but no data returned." << std::endl;
}
}

ReturnExample

{
isSuccess = true,
message = ,
data = [ OrderResult{
functionType = 0, // Function Type (int)
date = 2023/09/22, // Trade Date (string)
seqNo = 00000221431, // Sequence Number (string)
branchNo = 6460, // Branch Code (string)
account = 26, // Account (string)
orderNo = , // Order Number (string)
market = TAIEX, // Market (string)
marketType = Common, // Market Type (MarketType)
stock_no = 2888, // Stock Symbol (string)
buy_sell = Buy, // Side (BsAction)
priceType = Limit, // Original Price Type (PriceType)
price = 8.9, // Price (double)
quantity = 2000, // Original Quantity (int)
timeInForce = Rod, // Time In Force (TimeInforce)
orderType = Stock, // Order Type (OrderType)
isPreOrder = true, // Is Pre-order (bool)
status = 0, // Order Status (int)
afterPriceType = Limit, // Effective Price Type (PriceType)
afterPrice = 8.9, // Effective Price (double)
unit = 1000, // Unit Size (int)
afterQty = 2000, // Effective Quantity (int)
filledQty = 0, // Filled Quantity (int)
filledMoney = 0, // Filled Amount (int)
beforeQty = 0, // Quantity Before Mod (int)
beforePrice = 9.1, // Price Before Mod (double)
userDef = null, // User Defined Field (string)
lastTime = null, // Last Modified Time (string)
details = , // Order History (list)
errorMessage = // Error Message (string)
},
OrderResult{
functionType = 0, // Function Type (int)
date = 2023/09/22, // Trade Date (string)
seqNo = 00000221432, // Sequence Number (string)
branchNo = 6460, // Branch Code (string)
account = 26, // Account (string)
orderNo = , // Order Number (string)
market = TAIEX, // Market (string)
marketType = Common, // Market Type (MarketType)
stock_no = 2888, // Stock Symbol (string)
buy_sell = Buy, // Side (BsAction)
priceType = Limit, // Original Price Type (PriceType)
price = 8.9, // Price (double)
quantity = 2000, // Original Quantity (int)
timeInForce = Rod, // Time In Force (TimeInforce)
orderType = Stock, // Order Type (OrderType)
isPreOrder = true, // Is Pre-order (bool)
status = 0, // Order Status (int)
afterPriceType = Limit, // Effective Price Type (PriceType)
afterPrice = 8.9, // Effective Price (double)
unit = 1000, // Unit Size (int)
afterQty = 2000, // Effective Quantity (int)
filledQty = 0, // Filled Quantity (int)
filledMoney = 0, // Filled Amount (int)
beforeQty = 0, // Quantity Before Mod (int)
beforePrice = 9.1, // Price Before Mod (double)
userDef = , // User Defined Field (string)
lastTime =, // Last Modified Time (string)
details = , // Order History (list)
errorMessage = // Error Message (string)
}
]
}