Skip to main content

PlaceOrder

place_order

Request Parameter

ParameterTypeMeaning
accountAccountAccount
order_objectOrderObjectOrder Object
unblockbool (optional) (default = False)unblock

Result Response

ParameterTypeMeaning
is_successboolInterface result
dataOrderResultOrderResult is returned
messagestringis_success = False error description is returned

OrderResult Parameter

Return type : Object

ParameterTypeMeaning
function_typeintFunction Type : 0 New Order 、 10 New Order Executed 、 15 Change Price 、 20 Change Quantity 、 30 Cancel 、 90 Failed
datestringTransaction Date
seq_nostringOrder Serial Number
branch_nostringBranch Number
accountstringAccount
order_nostringOrder Number
asset_typeintAsset Type : 0 Stock
marketstringMarket Type : TAIEX Listed 、 TAISDAQ OTC 、 TAIEMG EMG
market_typeMarketTypeTrading Session Type : CommonFixingIntradayOddOddEmgEmgOdd
stock_nostringSymbol
buy_sellBSActionBuy/Sell Type : BuySell
price_typePriceTypeOriginal Order Price Type : LimitLimitUpLimitDownMarketReference
pricefloatOrder Price
quantityintOriginal Order Quantity
time_in_forceTimeInForceTime In Force : ROD FOKIOC
order_typeOrderTypeOrder Type : StockMarginShortDayTradeSBL
is_pre_orderboolReservation Order Flag
statusintOrder Status : 0 Reservation 、 4 Sending to the system backend 、 9 Timeout 、 10 Active order 、 30 Canceled 、 40 Partially filled, others canceled 、 50 Fully filled 、 90 Failed
after_price_typePriceTypeValid Order Price Type : LimitLimitUpLimitDownMarketReference
after_pricefloatValid Order Price
unitintTrading Unit
after_qtyintValid Order Quantity (filled quantity included)
filled_qtyintFilled Quantity
filled_moneyintFilled Value
before_qtyintBefore the Quantity Modification
before_pricefloatBefore the Price Modification
user_defstringCustom Fields
last_timestringLast Modification Time
detailslistOrder Process (Return value when query order_result_detail or order_history )
error_messagestringError Message

Request Example

order = Order(
buy_sell = BSAction.Buy,
symbol = "2881",
price = "66",
quantity = 1000,
market_type = MarketType.Common,
price_type = PriceType.Limit,
time_in_force = TimeInForce.ROD,
order_type = OrderType.Stock,
user_def = "From_Py" # optional field
)


sdk.stock.place_order(account, order)

Response Example

Result {
is_success: True,
message: None,
data :
OrderResult{
function_type: 0, # Function Type (int)
date: "2023/10/12", # Trading Date (string)
seq_no: "00000000007", # Order serial number (string)
branch_no: "6460", # Branch number (string)
account: "26", # Account (string)
order_no: "bA676", # Order number (string)
asset_type: 0, # Asset type (int)
market: "TAIEX", # Market Category (string)
market_type: Common, # Trading session type (MarketType)
stock_no: "2881", # Symbol (string)
buy_sell: Buy, # Buy / Sell Type (BSAction)
price_type: Limit, # Order price type (int)
price: 66, # Order Price (float)
quantity: 1000, # Order quantity (int)
time_in_force: 0, # Time in force (int)
order_type: Stock, # Order Type (OrderType)
is_pre_order: false, # Reservation flag (bool)
status: 10, # Order Status (int)
after_price_type: Limit, # Valid order price type (PriceType)
after_price: 66, # Valid order price (float)
unit: 1000, # Share Unit (int)
after_qty: 2000, # Valid order quantity (int)
filled_qty: 0, # Filled quantity (int)
filled_money: 0, # Filled Value (int)
before_qty: 0, # Before the quantity modification (int)
before_price: 8.9, # Before the price modification (float)
user_def: "From_Py", # Custom fields (string)
last_time: "14:05:12.085", # Last modification time (string)
details: None, # Order Process (list)
error_message: None # Error Message (string)
}
}