Skip to main content

查詢歷史成交

FilledHistory

輸入參數

參數類別說明
accountAccount帳號
startDatestring查詢開始日
endDatestring (空值預設與開始日相同)查詢終止日
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(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)
},
...
]
}