Skip to main content

Query Historical Orders

order_history

Input Parameters

ParameterTypeDescription
accountAccountAccount
startDatestringQuery start date
endDatestring (default same as startDate if empty)Query end date
info

From v2.1.1, long-term historical data can be queried, max 30-day range per query; before v2.1.0, only last 2 days history.

Result Response

ParameterTypeDescription
is_successboolWhether successful
dataListReturned order history
messagestringError message when is_success = False

OrderResult Fields

Return type: Object

ParameterTypeDescription
function_typeintFunction type: 0 New, 10 Execute, 15 Modify Price, 20 Modify Qty, 30 Cancel, 90 Failed
datestringTrade date
seq_nostringOrder sequence number
branch_nostringBranch code
accountstringAccount
order_nostringOrder number
asset_typeintAsset type: 0 Stock
marketstringMarket type: TAIEX Main Board, TAISDAQ OTC, TAIEMG Emerging
market_typeMarketTypeMarket category: COMMON, FIXING, INTRADAY_ODD, ODD, EMG, EMG_ODD
stock_nostringStock code
buy_sellBSActionBuy/Sell: BUY Buy, SELL Sell
price_typePriceTypePrice type: LIMIT, LIMIT_UP, LIMIT_DOWN, MARKET, REFERENCE
pricedoublePrice
quantityintOriginal order quantity
time_in_forceTimeInForceTime condition: ROD, FOK, IOC
order_typeOrderTypeOrder type: STOCK, MARGIN, SHORT, DAY_TRADE, SBL
is_pre_orderboolWhether pre-order
statusintOrder status: 0 Pre-order, 4 Sent, 9 Timeout, 10 Success, 30 Cancel Success, 40 Partial Fill Cancel, 50 Fully Filled, 90 Failed
after_price_typePriceTypeEffective price type after modification
after_pricedoubleEffective price after modification
unitintUnit count
after_qtyintEffective quantity after modification
filled_qtyintFilled quantity
filled_moneyintFilled amount
before_qtyintQuantity before modification
before_pricedoublePrice before modification
user_defstringCustom field
last_timestringLast update time
detailslistOrder history details
error_messagestringError message

Request Example

auto history_order_response = sdk->stock->order_history(target_account, "20250502", "20250502");

Response Example

{
isSuccess = true,
message = ,
data = [OrderResult{...}]
}