未實現損益查詢
unrealized_gains_and_loses
輸入參數
| 參數 | 類別 | 說明 |
|---|---|---|
| account | Account | 帳號 |
Result 回傳
| 參數 | 類別 | 說明 |
|---|---|---|
| is_success | bool | 是否成功 |
| data | List | 回傳未實現資訊 |
| message | string | 當is_success = False 回傳錯誤訊息 |
未實現 UnrealizedData 欄位
Return type : Object
| 參數 | 類別 | 說明 |
|---|---|---|
| date | string | 庫存建立日 |
| branch_no | string | 分公司代號 |
| stock_no | string | 股票代號 |
| buy_sell | BSAction | 買賣別 : BUY 買 、 SELL 賣 |
| order_type | OrderType | 委託單類型 : STOCK 現股 、 MARGIN 融資 、 SHORT 融券 、 DAY_TRADE 現股當沖、SBL借券 |
| cost_price | double | 成本價 |
| tradable_qty | int | 可交易餘額 |
| today_qty | int | 今日餘額 |
| unrealized_profit | int | 未實現獲利 |
| unrealized_loss | int | 未實現虧損 |
請求範例
auto unrealized_response = sdk->accounting->unrealized_gains_and_loses(target_account);
// 搭配自定義 .cpp & hpp Output
if (unrealized_response.is_success && unrealized_response.data.has_value()) {
for (const auto& u : *unrealized_response.data) {
std::cout << u << std::endl;
}
}
回傳範例
{
isSuccess = True,
message = ,
data = [
UnrealizedData{
date = 2021/08/09, // 庫存建立日 (string)
account = 26, // 帳號 (int)
branchNo = 6460, // 分公司代號 (string)
stockNo = 2303, // 股票代號 (string)
buySell = BUY, // 買賣別 (BSAction)
orderType = SHORT, // 委託單類型 (OrderType)
costPrice = 50.0, // 成本價格 (double)
tradableQty = 1000, // 可交易餘額 (int)
todayQty = 1000, // 今日餘額 (int)
unrealizedProfit = 45200, // 未實現獲利 (int)
unrealizedLoss = 0 // 未實現虧損 (int)
}
]
}