庫存查詢
inventories
輸入參數
| 參數 | 類別 | 說明 |
|---|---|---|
| account | Account | 帳號 |
Result 回傳
| 參數 | 類別 | 說明 |
|---|---|---|
| is_success | bool | 是否成功 |
| data | List | 回傳庫存資訊 |
| message | string | 當is_success = False 回傳錯誤訊息 |
庫存資訊 Inventory 欄位
Return type : Object
| 參數 | 類別 | 說明 |
|---|---|---|
| > date | string | 交易日期 |
| > account | string | 帳號 |
| > branch_no | string | 分公司代號 |
| > stock_no | string | 股票代號 |
| > order_type | OrderType | 委託單類型 : STOCK 現股 、 MARGIN 融資 、 SHORT 融券 、 DAY_TRADE 現股當沖、SBL借券 |
| > lastday_qty | int | 昨日庫存餘額 |
| > buy_qty | int | 今日委買股數 |
| > buy_filled_qty | int | 今日買進成交股數 |
| > buy_value | int | 買進價金 |
| > today_qty | int | 今日庫存餘額 |
| > tradable_qty | int | 可委託股數 |
| > sell_qty | int | 今日委賣股數 |
| > sell_filled_qty | int | 今日賣出成交股數 |
| > sell_value | int | 賣出價金 |
| > odd | list | Object |
| >> lastday_qty | int | 昨日庫存餘額 |
| >> buy_qty | int | 今日委買股數 |
| >> buy_filled_qty | int | 今日買進成交股數 |
| >> buy_value | int | 買進價金 |
| >> today_qty | int | 今日庫存餘額 |
| >> tradable_qty | int | 可委託股數 |
| >> sell_qty | int | 今日委賣股數 |
| >> sell_filled_qty | int | 今日賣出成交股數 |
| >> sell_value | int | 賣出價金 |
請求範例
auto inventories_response = sdk->accounting->inventories(target_account);
if (!inventories_response.is_success) {
std::cerr << "Inventories query failed: "
<< (inventories_response.message.has_value() ? inventories_response.message.value() : "No message")
<< std::endl;
}
// 搭配自定義 .cpp & hpp Output
else if (inventories_response.data.has_value()) {
const auto& inventories = inventories_response.data.value();
for (const auto& inventory : inventories) {
std::cout << inventory << std::endl;
}
}
else {
std::cout << "Inventories query succeeded but no data returned." << std::endl;
}
回傳範例
{
isSuccess = true,
message = ,
data = [
Inventory{
date = 2023/10/13, // 交易日期 (string)
account = 26, // 帳號 (string)
branchNo = 6460, // 分公司代號 (string)
stockNo = 1101, // 股票代號 (string)
orderType = STOCK, // 委託單類型 (OrderType)
lastdayQty = 2000, // 昨日庫存餘額 (int)
buyQty = 0, // 今日委買股數 (int)
buyFilledQty = 0, // 今日買進成交股數 (int)
buyValue = 0, // 買進價金 (int)
todayQty = 2000, // 今日庫存餘額 (int)
tradableQty = 2000, // 可委託股數 (int)
sellQty = 0, // 今日委賣股數 (int)
sellFilledQty = 0, // 今日賣出成交股數 (int)
sellValue = 0, // 賣出價金 (int)
odd = InventoryOdd { // 委託單狀態 (InventoryOdd 物件)
lastdayQty = 0, // 昨日庫存餘額 (int)
buyQty = 0, // 今日委買股數 (int)
buyFilledQty = 0, // 今日買進成交股數 (int)
buyValue = 0, // 買進價金 (int)
todayQty = 0, // 今日庫存餘額 (int)
tradableQty = 0, // 可委託股數 (int)
sellQty = 0, // 今日委賣股數 (int)
sellFilledQty = 0, // 今日賣出成交股數 (int)
sellValue = 0 // 賣出價金 (int)
}
},
...
]
}