Create Order
place_order
Input Parameters
| Parameter | Type | Description |
|---|---|---|
| account | Account | Account |
| orderObject | OrderObject | Order content |
| unblock | bool (optional) (default = false) | Whether non-blocking |
Result Response
| Parameter | Type | Description |
|---|---|---|
| is_success | bool | Whether successful |
| data | OrderResult | Returned order result |
| message | string | Error message when is_success = False |
Order Information Fields (OrderResult)
Return type: Object
| Parameter | Type | Description |
|---|---|---|
| function_type | int | Function type: 0 New, 10 Execute, 15 Modify Price, 20 Modify Qty, 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 Stock |
| market | string | Market type: TAIEX Main Board, TAISDAQ OTC, TAIEMG Emerging |
| market_type | [MarketType] | Market category: COMMON Regular, FIXING Closing, INTRADAY_ODD Odd-lot Intraday, ODD Odd-lot After, EMG Emerging, EMG_ODD Emerging Odd-lot |
| stock_no | string | Stock code |
| buy_sell | [BSAction] | Buy/Sell: BUY Buy, SELL Sell |
| price_type | [PriceType] | Price type: LIMIT Limit, LIMIT_UP Upper Limit, LIMIT_DOWN Lower Limit, MARKET Market, REFERENCE Reference |
| price | double | Price |
| quantity | int | Original order quantity |
| time_in_force | [TimeInForce] | Time condition: ROD, FOK, IOC |
| order_type | [OrderType] | Order type: STOCK Cash, MARGIN Margin, SHORT Short, DAY_TRADE Day Trade, SBL Securities Lending |
| is_pre_order | bool | Whether pre-order |
| status | int | Order status: 0 Pre-order, 4 Sent, 9 Timeout, 10 Success, 30 Cancel Success, 40 Partial Fill Cancel, 50 Fully Filled, 90 Failed |
| after_price_type | [PriceType] | Effective price type after modification |
| after_price | double | Effective price after modification |
| unit | int | Unit count |
| after_qty | int | Effective quantity after modification |
| filled_qty | int | Filled quantity |
| filled_money | int | Filled amount |
| before_qty | int | Quantity before modification |
| before_price | double | Price before modification |
| user_def | string | Custom field |
| last_time | string | Last update time |
| details | list | Order history |
| error_message | string | Error message |
Request Example
Order order = Order{
BsAction::BUY,
"2888",
"9.0",
1,
MarketType::INTRADAY_ODD,
PriceType::LIMIT,
TimeInForce::ROD,
OrderType::STOCK,
"c++"
};
auto order_result = sdk->stock->place_order(target_account, order, false);
Response Example
{
isSuccess = true,
message = ,
data = OrderResult{
functionType = 0,
date = 2023/10/13,
seqNo = 00000000007,
branchNo = 6460,
account = 26,
orderNo = bA619,
assetType = 0,
market = TAIEX,
marketType = COMMON,
stockNo = 2888,
buySell = BUY,
priceType = LIMIT,
price = 9.1,
quantity = 3000,
timeInForce = ROD,
orderType = STOCK,
isPreOrder = false,
status = 10,
afterPriceType = LIMIT,
afterPrice = 9.1,
unit = 1000,
afterQty = 3000,
filledQty = 0,
filledMoney = 0,
beforeQty = 0,
beforePrice = 9.1,
userDef = ,
lastTime = 12:10:12.546,
details = ,
errorMsg =
}
}