查詢歷史委託
OrderHistory
輸入參數
| 參數 | 類別 | 說明 |
|---|---|---|
| account | Account | 帳號 |
| startDate | string | 查詢開始日 |
| endDate | string (空值預設與開始日相同) | 查詢終止日 |
info
v2.1.1起可查詢長期歷史資料,每次查詢最大設定30日日期區間;v2.1.0之前版本可查詢最近兩日之歷史資料
Result 回傳
| 參數 | 類別 | 說明 |
|---|---|---|
| isSuccess | bool | 是否成功 |
| data | List | 回傳委託資訊 |
| message | string | 當isSuccess = False 回傳錯誤訊息 |
委託資訊 OrderResult 欄位
Return type : Object
| 參數 | 類別 | 說明 |
|---|---|---|
| functionType | int (Optioanl) | 功能別 : 0 新單 、 10 新單執行 、 15 改價 、 20 改量 、 30 刪單 、 90 失敗 |
| date | string | 交易日期 |
| seqNo | string | 委託單流水序號 |
| branchNo | string | 分公司代號 |
| account | string | 帳號 |
| orderNo | string | 委託書號 |
| assetType | int | 資產類別 : 0 證券 |
| market | string | 市場類型 : TAIEX 上市股票 、 TAISDAQ 上櫃股票 、 TAIEMG 興櫃股票 |
| marketType | MarketType | 盤別種類 : Common 整股 、 Fixing 定盤 、 IntradayOdd 盤中零股 、 Odd 盤後零股 、 Emg 興櫃 、 EmgOdd 興櫃零股 |
| stockNo | string | 股票代號 |
| buySell | BsAction | 買賣別 : Buy 買 、 Sell 賣 |
| priceType | PriceType | 原始委託價格別 : Limit 限價 、 LimitUp 漲停 、 LimitDown 跌停 、 Market 市價 、 Reference 參考價 |
| price | double | 價格 |
| quantity | int | 原始委託股數 |
| timeInForce | TimeInForce | 委託條件別 : Rod Rod 、 Fok Fok 、 Ioc Ioc |
| orderType | OrderType | 委託單類型 : Stock 現股 、 Margin 融資 、 Short 融券 、 DayTrade 現沖先賣 、 SBL借券 |
| isPreOrder | bool | 是否為預約單 |
| status | int | 委託單狀態,詳細列表請參考 STATUS |
| afterPriceType | PriceType | 有效委託價格別 : Limit 限價 、 LimitUp 漲停 、 LimitDown 跌停 、 Market 市價 、 Reference 參考價 |
| afterPrice | double | 有效委託價格 |
| unit | int | 單位數 |
| afterQty | int | 有效委託股數(包含已成交部分) |
| filledQty | int | 成交股數 |
| filledMoney | int | 成交價金 |
| beforeQty | int | 改單前有效量 |
| beforePrice | double | 改單前有效價 |
| lastTime | string | 最後異動時間 |
| errorMessage | string | 錯誤訊息 |
| details | list | 委託歷程 |
| >> functionType | int | 功能別 : 0 新單 、 10 新單執行 、 15 改價 、 20 改量 、 30 刪單 、 50 完全成交 、 90失敗 |
| >> modifiedTime | string | 修改時間 |
| >> beforeQty | int | 原始委託股數 |
| >> afterQty | int | 有效委託股數(包含已成交部分) |
| >> beforePrice | double | 原始委託價 |
| >> afterPrice | double | 有效委託價 |
| >> filledMoney | double | 成交價金 |
| >> status | int | 委託單狀態 |
| >> errMsg | string | 錯誤訊息 |
請求範例
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)
},
...
]
}