Query Historical Orders
order_history
Input Parameters
| Parameter | Type | Description |
|---|---|---|
| account | Account | Account |
| startDate | string | Query start date |
| endDate | string (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
| Parameter | Type | Description |
|---|---|---|
| is_success | bool | Whether successful |
| data | List | Returned order history |
| message | string | Error message when is_success = False |
OrderResult Fields
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, FIXING, INTRADAY_ODD, ODD, EMG, EMG_ODD |
| stock_no | string | Stock code |
| buy_sell | BSAction | Buy/Sell: BUY Buy, SELL Sell |
| price_type | PriceType | Price type: LIMIT, LIMIT_UP, LIMIT_DOWN, MARKET, REFERENCE |
| price | double | Price |
| quantity | int | Original order quantity |
| time_in_force | TimeInForce | Time condition: ROD, FOK, IOC |
| order_type | OrderType | Order type: STOCK, MARGIN, SHORT, DAY_TRADE, SBL |
| 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 details |
| error_message | string | Error message |
Request Example
auto history_order_response = sdk->stock->order_history(target_account, "20250502", "20250502");
Response Example
{
isSuccess = true,
message = ,
data = [OrderResult{...}]
}