Skip to main content

查詢歷史成交

FilledHistory

輸入參數​

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

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

Result 回傳​

參數類別說明
is_successbool是否成功
dataList回傳成交資訊
messagestring當 is_success = False 回傳錯誤訊息

成交資訊 FilledData 欄位​

Return type : Object

參數類別說明
datedate成交日期
branch_nostring分公司代號
accountstring帳號
seq_nostring委託單流水序號 (只有主動回報才回傳此欄位)
order_nostring委託書號
stock_nostring股票代號
buy_sellBSAction買賣別 : BUY 買 、 SELL 賣
filled_nostring成交流水號
filled_avg_pricedouble成交均價
filled_qtyint成交股數
filled_pricedouble成交單價
order_typeOrderType委託單類型 : STOCK 現股 、 MARGIN 融資 、 SHORT 融券 、 DAY_TRADE 現股當沖 、 SBL 借券
filled_timestring成交時間
user_defstring自訂欄位 (只有主動回報才回傳此欄位)

請求範例​


auto history_filled_response = sdk->stock->filled_history(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;
}

回傳範例​

{
is_success = True,
message = ,
data = [
FilledData{
date = 2025/04/29, // 成交日期 (string)
branch_no = 6460, // 分公司代號 (string)
account = 26, // 帳號 (string)
seq_no = , // 委託流水序號 (string)
order_no = bA422, // 委託書號 (string)
stock_no = 1101, // 股票代號 (string)
buy_sell = SELL, // 買賣別 (BSAction)
filled_no = 00000000001, // 成交流水號 (string)
filled_avg_price = 35.2, // 成交均價 (double)
filled_qty = 1000, // 成交股數 (int)
filled_price = 35.2, // 成交單價 (double)
order_type = STOCK, // 委託單類型 (OrderType)
filled_time = 10:31:00.931 // 成交時間 (string)
user_def = , // 用戶自定義 (string)
},
...
]
}