Skip to main content

Accounting


We can query profit and loss information through trade and Position inquiries.

info

The limit of queries is 5 times / sec. If it exceeds the limit, please wait a moment and try again.

Inventory

hybrid = sdk.futopt_accounting.query_hybrid_position(accounts.data[0])
print(hybrid)
Result {
is_success: True,
message: None,
data :[
HybridPosition {
date : "2024/04/08", # Transaction Date (str)
branch_no : "15901", # Branch Number (str)
account : "1234567", # Account (str)
is_spread : False, # Spread Order Flag (bool)
position_kind : 1, # Position Kind : `1` Future 、`2` Option (int)
symbol : "FITX", # Symbol (str)
expiry_date : "202404", # Expiry Date (string)
strike_price : None, # Strike Price (int or None)
call_put : None, # Call / Put : `Call` 、`Put` (CallPut)
buy_sell : Buy, # Buy/Sell Type : `Buy` 、`Sell` (BSAction)
price : 20325.3333, # Cost Price (float)
orig_lots : 3, # Original Lot (int)
tradable_lots : 3, # Available Lot (int)
order_type : New, # Order Type : `New` Open、`Close` Close、`FdayTrade` DayTrade (FutOptOrderType)
currency : "TWD", # Currency (str)
market_price : "20351", # Market Price (str)
initial_margin : 0.0, # Initial Margin (float)
maintenance_margin : 0.0, # Maintenance Margin (float)
clearing_margin : 0.0, # Clearing Margin (float)
initial_margin_all_single : 0.0, # Initial Margin (float)
opt_value : 0.0, # Option market value (float)
opt_long_value : 0.0, # Long Option market value (float)
opt_short_value : 0.0, # Short Option market value (float)
profit_or_loss : 0.0, # Profit or Loss (float)
premium : 0.0, # Premium (float)
spreads : None, # Spread Detail (List[SpreadPosition])
},
...
]
}

Equity information

You can inquire about Equity information to confirm the margin amount.

equity = sdk.futopt_accounting.query_margin_equity(accounts.data[0])
print(equity.data)
 Equity({
date: "2024/04/08", # Query Date (string)
branch_no: "15901", # Branch Number (string)
account: "1234567", # Account (string)
currency: "NTD", # Currency (string)
yesterday_balance: 22435152.4, # Yesterday Balance (float)
today_balance: 22434910.4, # Today's Balance (float)
initial_margin: 1114946.0, # Initial Margin (float)
maintenance_margin: 939214.0, # Maintenance Margin (float)
clearing_margin: 915760.0, # Clearing Margin (float)
today_equity: 22694910.4, # Today's Equity (float)
...
withhold: 126402.0, # Withhold (float)
available_margin: 21453562.4, # Available Margin (float)
risk_index: 0.0, # Risk Index (float)
disgorgement: 0.0, # Disgorgement (float)
opt_pnl: -248600.0, # Option Profit or Loss (float)
opt_value: -193100.0, # Option Market Value (float)
opt_long_value: 311900.0, # Long Option Market Value (float)
opt_short_value: 505000.0, # Short Option Market Value (float)
fut_realized_pnl: 0.0, # Future Realized Profit or Loss (float)
fut_unrealized_pnl: 60700.0, # Future Unrealized Profit or Loss (float)
yesterday_equity: 22634452.4, # Yesterday Equity (float)
buy_lot: 22, # Buying Lot (int)
sell_lot: 7 # Selling Lot (int)
})