查詢歷史成交
FilledHistory
輸入參數
| 參數 | 類別 | 說明 |
|---|---|---|
| account | Account | 帳號 |
| startDate | string | 查詢開始日 |
| endDate | string (空值預設與開始日相同) | 查詢終止日 |
info
v2.1.1起可查詢長期歷史資料,每次查詢最大設定30日日期區間;v2.1.0之前版本可查詢最近兩日之歷史資料
Result 回傳
| 參數 | 類別 | 說明 |
|---|---|---|
| is_success | bool | 是否成功 |
| data | List | 回傳成交資訊 |
| message | string | 當is_success = False 回傳錯誤訊息 |
成交資訊 FilledData 欄位
Return type : Object
| 參數 | 類別 | 說明 |
|---|---|---|
| date | date | 成交日期 |
| branch_no | string | 分公司代號 |
| account | string | 帳號 |
| seq_no | string | 委託單流水序號 (只有主動回報才回傳此欄位) |
| order_no | string | 委託書號 |
| stock_no | string | 股票代號 |
| buy_sell | BSAction | 買賣別 : BUY 買 、 SELL 賣 |
| filled_no | string | 成交流水號 |
| filled_avg_price | double | 成交均價 |
| filled_qty | int | 成交股數 |
| filled_price | double | 成交單價 |
| order_type | OrderType | 委託單類型 : STOCK 現股 、 MARGIN 融資 、 SHORT 融券 、 DAY_TRADE 現股當沖 、 SBL借券 |
| filled_time | string | 成交時間 |
| user_def | string | 自訂欄位 (只有主動回報才回傳此欄位) |
請求範例
auto history_filled_response = sdk->stock->filled_history(target_account, "20250401", "20250501");
if (!history_filled_response.is_success) {
std::cerr << "Filled data query failed: " << (history_filled_response.message ? *history_filled_response.message : "No message") << std::endl;
return 1;
}
// 搭配自定義 .cpp & hpp Output
if (history_filled_response.data.has_value()) {
const auto& filled_list = history_filled_response.data.value();
for (const auto& filled : filled_list) {
std::cout << filled << "\n\n";
}
}
else {
std::cout << "No filled data returned." << std::endl;
}
回傳範例
{
isSuccess = True,
message = ,
data = [
FilledData{
date = 2025/04/29, // 成交日期 (string)
branchNo = 6460, // 分公司代號 (string)
account = 26, // 帳號 (string)
seqNo = , // 委託流水序號 (string)
orderNo = bA422, // 委託書號 (string)
stockNo = 1101, // 股票代號 (string)
buySell = SELL, // 買賣別 (BSAction)
filledNo = 00000000001, // 成交流水號 (string)
filledAvgPrice = 35.2, // 成交均價 (double)
filledQty = 1000, // 成交股數 (int)
filledPrice = 35.2, // 成交單價 (double)
orderType = STOCK, // 委託單類型 (OrderType)
filledTime = 10:31:00.931 // 成交時間 (string)
userDef = , // 用戶自定義 (string)
},
...
]
}