Skip to main content

查詢歷史委託

OrderHistory

輸入參數

參數類別說明
accountAccount帳號
startDatestring查詢開始日
endDatestring (空值預設與開始日相同)查詢終止日
info

v2.1.1起可查詢長期歷史資料,每次查詢最大設定30日日期區間;v2.1.0之前版本可查詢最近兩日之歷史資料

Result 回傳

參數類別說明
isSuccessbool是否成功
dataList回傳委託資訊
messagestring當isSuccess = False 回傳錯誤訊息

委託資訊 OrderResult 欄位

Return type : Object

參數類別說明
functionTypeint (Optioanl)功能別 : 0 新單 、 10 新單執行 、 15 改價 、 20 改量 、 30 刪單 、 90 失敗
datestring交易日期
seqNostring委託單流水序號
branchNostring分公司代號
accountstring帳號
orderNostring委託書號
assetTypeint資產類別 : 0 證券
marketstring市場類型 : TAIEX 上市股票 、 TAISDAQ 上櫃股票 、 TAIEMG 興櫃股票
marketTypeMarketType盤別種類 : Common 整股 、 Fixing 定盤 、 IntradayOdd 盤中零股 、 Odd 盤後零股 、 Emg 興櫃 、 EmgOdd 興櫃零股
stockNostring股票代號
buySellBsAction買賣別 : Buy 買 、 Sell
priceTypePriceType原始委託價格別 : Limit 限價 、 LimitUp 漲停 、 LimitDown 跌停 、 Market 市價 、 Reference 參考價
pricedouble價格
quantityint原始委託股數
timeInForceTimeInForce委託條件別 : Rod Rod 、 Fok Fok 、 Ioc Ioc
orderTypeOrderType委託單類型 : Stock 現股 、 Margin 融資 、 Short 融券 、 DayTrade 現股當沖 、 SBL借券
isPreOrderbool是否為預約單
statusint委託單狀態 : 0 預約單 、 4 系統將委託送往後台 、 9 連線逾時 、10 委託成功 、 30未成交刪單成功 、 40部分成交,剩餘取消 、 50 完全成交 、 90 失敗
afterPriceTypePriceType有效委託價格別 : Limit 限價 、 LimitUp 漲停 、 LimitDown 跌停 、 Market 市價 、 Reference 參考價
afterPricedouble有效委託價格
unitint單位數
afterQtyint有效委託股數(包含已成交部分)
filledQtyint成交股數
filledMoneyint成交價金
beforeQtyint改單前有效量
beforePricedouble改單前有效價
lastTimestring最後異動時間
errorMessagestring錯誤訊息
detailslist委託歷程
>> functionTypeint功能別 : 0 新單 、 10 新單執行 、 15 改價 、 20 改量 、 30 刪單 、 50 完全成交 、 90失敗
>> modifiedTimestring修改時間
>> beforeQtyint原始委託股數
>> afterQtyint有效委託股數(包含已成交部分)
>> beforePricedouble原始委託價
>> afterPricedouble有效委託價
>> filledMoneydouble成交價金
>> statusint委託單狀態
>> errMsgstring錯誤訊息

請求範例

Console.WriteLine(sdk.Stock.OrderHistory(account,"20230921","20230922"));

回傳範例

{
isSuccess = True,
message = ,
data = [ OrderResult{
functionType = , // 功能別 (int)
date = 2023/10/12, // 交易日期 (string)
seqNo = 00000000001, // 委託單流水序號 (string)
branchNo = 6460, // 分公司代號 (string)
account = 26, // 帳號 (string)
orderNo = bA598, // 委託書號 (string)
assetType = 0, // 資產類別 (int)
market = TAIEX, // 市場類型 (string)
marketType = Common, // 盤別種類 (MarketType)
stockNo = 2888, // 股票代號 (string)
buySell = Buy, // 買賣別 (BsAction)
priceType = Limit, // 原始委託價格別 (PriceType)
price = 8.9, // 價格 (double)
quantity = 2000, // 原始委託股數 (int)
timeInForce = Rod, // 委託條件別 (TimeInForce)
orderType = Stock, // 委託單類型 (OrderType)
isPreOrder = False, // 是否為預約單 (bool)
status = 10, // 委託單狀態 (int)
afterPriceType = , // 有效委託價格別 (PriceType)
afterPrice = 9, // 有效委託價格 (double)
unit = 1000, // 單位數 (int)
afterQty = 1000, // 有效委託股數 (int)
filledQty = 0, // 成交股數 (int)
filledMoney = 0, // 成交價金 (int)
beforeQty = , // 改單前有效量 (int)
beforePrice = , // 改單前有效價 (double)
userDef = , // 自訂欄位 (string)
lastTime = 14:19:41.879, // 最後異動時間 (string)
details = [
OrderDetail{
functionType = 10,
modifiedTime = 14:19:41.879,
beforeQty = 0,
afterQty = 1000,
beforePrice = 9.0,
afterPrice = 9.0,
status = 10,
errorMsg =
}
]
errorMsg = // 錯誤訊息 (string)
},
...
]
}