Get Historical Order
order_history
Request Parameter
Parameter | Type | Meaning |
---|---|---|
accounts | Account | Account |
start_date | string | Query start date |
end_date | string ( optional ) ( None or empty will equals start_date ) | Query end date |
info
Since v2.1.1, this supports longer term historical data inquiry. The day range is limited maximum 30 days per request. For older SDK versions (until v2.1.0), it supports historical data for the past two days.
Result Response
Parameter | Type | Meaning |
---|---|---|
is_success | bool | Interface result |
data | List | OrderResult list is returned |
message | string | is_success = False error description is returned |
OrderResult Parameter
Return type : Object
Parameter | Type | Meaning |
---|---|---|
function_type | int (optional) | Function Type : 0 New Order 、 10 New Order Executed 、 15 Change Price 、 20 Change Quantity 、 30 Cancel 、 90 Failed |
date | string | Transaction Date |
seq_no | string | Order Serial Number |
branch_no | string | Branch Number |
account | string | Account |
order_no | string | Order Number |
asset_type | int | Asset Type : 0 Stock |
market | string | Market Type : TAIEX Listed 、 TAISDAQ OTC 、 TAIEMG EMG |
market_type | MarketType | Trading Session Type : Common 、 Fixing 、 IntradayOdd 、 Odd 、 Emg 、 EmgOdd |
stock_no | string | Symbol |
buy_sell | BSAction | Buy/Sell Type : Buy 、 Sell |
price_type | PriceType | Original Order Price Type : Limit 、 LimitUp 、 LimitDown 、 Market 、 Reference |
price | float | Order Price |
quantity | int | Original Order Quantity |
time_in_force | TimeInForce | Time In Force : ROD FOK 、 IOC |
order_type | OrderType | Order Type : Stock 、 Margin 、 Short 、 DayTrade 、 SBL |
is_pre_order | bool | Reservation Order Flag |
status | int | Order 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_type | PriceType | Valid Order Price Type : Limit 、 LimitUp 、 LimitDown 、 Market 、 Reference |
after_price | float | Valid Order Price |
unit | int | Trading Unit |
after_qty | int | Valid Order Quantity (filled quantity included) |
filled_qty | int | Filled Quantity |
filled_money | int | Filled Value |
before_qty | int | Before the Quantity Modification |
before_price | float | Before the Price Modification |
user_def | string | Custom Fields |
last_time | string | Last Modification Time |
error_message | string | Error Message |
details | list | Order Process |
>> function_type | int | Function Type : 0 New Order 、 10 New Order Executed 、 15 Change Price 、 20 Change Quantity 、 30 Cancel 、 50 Fully Filled 、 90 Failed |
>> modified_time | string | Order Modified Time |
>> before_qty | int | Original Order Quantity |
>> after_qty | int | Valid Order Quantity (filled quantity included) |
>> before_price | float | Original Order Price |
>> after_price | float | Valid Order Price |
>> filled_money | float | Filled Value |
>> status | int | Order Status |
>> err_msg | string | Error Message |
Request Example
sdk.stock.order_history(account,"20230921","20230922")
回傳範例
Result {
is_success: True,
message: None,
data : [
OrderResult{
function_type: None, # Function Type (int)
date: "2023/09/21", # Trading Date (date)
seq_no: "00000221427", # Order Serial Number (string)
branch_no: "6460", # Branch Number (string)
account: "26", # Account (string)
order_no: "bA489", # Order Number (string)
asset_type: 0, # Asset Type (int)
market: "TAIEX", # Market Category (string)
market_type: Common, # Trading Session Type (MarketType)
stock_no: "2888", # Symbol (string)
buy_sell: Buy, # Buy / Sell Type (BSAction)
price_type: Limit, # Original Order Price Type (PriceType)
price: 9.1, # Price (float)
quantity: 1000, # Original Order Quantity (int)
time_in_force: ROD, # Time in Force (TimeInForce)
order_type: Stock, # Order Type (OrderType)
is_pre_order: False, # Reservation Order (bool)
status: 10, # Order Status (int)
after_price_type: , # Valid Order Price Type (PriceType)
after_price: 9.1, # Valid Order Price (float)
unit: 1000, # Share Unit (int)
after_qty: 1000, # Valid Order Quantity (int)
filled_qty: 0, # Filled Quantity (int)
filled_money: 0, # Filled Value (int)
before_qty: , # Before the Quantity Modification (int)
before_price: , # Before the Price Modification (float)
user_def: , # Custom Fields (string)
last_time: "09:00:32.477", # Last Modification Time (string)
details:[
OrderDetail{
function_type: 10, # Function Type (int)
modified_time: "09:00:32.477", # Order Modified Time (string)
before_qty: 0, # Original Order Quantity (int)
after_qty: 1000, # Valid Order Quantity (int)
before_price: 9.1, # Original Order Price (float)
after_price: 9.1 # Valid Order Price (float)
}
]
error_message: None # Error Message (string)
},
... #More Result Reponse
]
}