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
- Python
- Node.js
- C#
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])
},
...
]
}
const hybrid = sdk.futoptAccounting.queryHybridPosition(accounts.data[0])
console.log(hybrid)
{
isSuccess: true,
data:[
{
date: "2024/04/08", // Transaction Date (str)
branchNo: "15901", // Branch Number (str)
account: "1234567", // Account (str)
isSpread: false, // Spread Order Flag (bool)
positionKind: 1, // Position Kind : `1` Future 、`2` Option (number)
symbol: "FITX", // Symbol (str)
expiryDate: 202404, // Expiry Date (number)
buySell: "Buy", // Buy/Sell Type : `Buy` 、`Sell` (BSAction)
price: 20325.3333, // Cost Price (number)
origLots: 3, // Original Lot (number)
tradableLots: 3, // Available Lot (number)
orderType: "New", // Order Type : `New` Open、`Close` Close、`FdayTrade` DayTrade (FutOptOrderType)
currency: "TWD", // Currency (str)
marketPrice: "20351", // Market Price (str)
initialMargin: 0.0, // Initial Margin (number)
maintenanceMargin: 0.0, // Maintenance Margin (number)
clearingMargin: 0.0, // Clearing Margin (number)
initialMarginAllSingle: 0.0, // Initial Margin (number)
optValue: 0.0, // Option market value (number)
optLongValue: 0.0, // Long Option market value (number)
optShortValue: 0.0, // Short Option market value (number)
profitOrLoss: 0.0, // Profit or Loss (number)
premium: 0.0, // Premium (number)
},
...
]
}
var hybrid = sdk.FutOptAccounting.QueryHybridPosition(accounts.data[0]);
foreach (var detail in hybrid.data)
{
Console.WriteLine(detail);
}
{
isSuccess = True,
message = ,
data = [
HybridPosition{
date = 2024/04/08, // Transaction Date (string)
branchNo = 15901, // Branch Number (string)
account = 1234567, // Account (string)
isSpread = false, // Spread Order Flag (bool)
positionKind = 2, // Position Kind : `1` Future 、`2` Option (int)
symbol = FITX, // Symbol (string)
expiryDate = 202404, // Expiry Date (string)
strikePrice = , // Strike Price (double or null)
callPut = , // Call / Put : `Call` 、`Put` (CallPut)
buySell = Buy, // Buy/Sell Type : `Buy` 、`Sell` (BsAction)
price = 20325.3333, // Cost Price (double)
origLots = 3, // Original Lot (int)
tradableLots = 3, // Available Lot (int)
orderType = New, // Order Type : `New` Open、`Close` Close、`FdayTrade` DayTrade (FutOptOrderType)
currency = TWD, // Currency (string)
marketPrice = 20351, // Market Price (string)
initialMargin = 0.0, // Initial Margin (double)
maintenanceMargin = 0.0, // Maintenance Margin (double)
clearingMargin = 0.0, // Clearing Margin (double)
initialMarginAllSingle = 0.0, // Initial Margin (double)
optValue = 0.0, // Option market value (double)
optLongValue = 0.0, // Long Option market value (double)
optShortValue = 0.0, // Short Option market value (double)
profitOrLoss = 0.0, // Profit or Loss (double)
premium = 0.0, // Premium (double)
spreads = , // Spread Detail (List[SpreadPosition])
},
]
}
Equity information
You can inquire about Equity information to confirm the margin amount.
- Python
- Node.js
- C#
equity = sdk.futopt_accounting.query_margin_equity(accounts.data[0])
print(equity.data)
const equity = sdk.futoptAccounting.queryMarginEquity(accounts.data[0])
console.log(equity.data)
var equity = sdk.FutOptAccounting.QueryMarginEquity(accounts.data[0]);
Console.WriteLine(equity.data);
- Python
- Node.js
- C#
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)
})
{
isSuccess: true,
data:[
{
date: '2024/04/08', // Query Date (string)
branchNo: '15901', // Branch Number (string)
account: '1234567', // Account (string)
currency: 'NTD', // Currency : `NTD` TWD equivalents 、`TWD` New Taiwan Dollars、`USD` US Dollars、`CNY` ChiNa Yuan 、`JPY` Japanese Yen (string)
yesterdayBalance: 22435152.4, // Yesterday Balance (number)
todayBalance: 22434910.4, // Today's Balance (number)
initialMargin: 1114946.0, // Initial Margin (number)
maintenanceMargin: 939214.0, // Maintenace Margin (number)
clearingMargin: 915760.0, // Clearing Margin (number)
todayEquity: 22694910.4, // Today's Equity (number)
...
withhold: 126402.0, // Withhold (number)
availableMargin: 21453562.4, // Available Margin (number)
riskIndex: 0.0, // Risk Index (number)
disgorgement: 0.0, // Disgorgement (number)
optPnl: -248600.0, // Option Profit or loss (number)
optValue: -193100.0, // Option Market Value (number)
optLongValue: 311900.0, // Long Option Market Value (number)
optShortValue: 505000.0, // Short Option Market Value (number)
futRealizedPnl: 0.0, // Future Realized Profit or Loss (number)
futUnrealizedPnl: 60700.0, // Future Unrealized Profit or Loss (number)
yesterdayEquity: 22634452.4, // Yesterday Equity (number)
buyLot: 22, // Buying Lot (number)
sellLot: 7 // Selling Lot (number)
}
]
}
{
isSuccess = True,
data = [
{
date = 2024/04/08, // Query Date (string)
branchNo = 15901, // Branch number (string)
account = 1234567, // Account (string)
currency = NTD, // Currency : `NTD` TWD equivalents 、`TWD` New Taiwan Dollars、`USD` US Dollars、`CNY` ChiNa Yuan 、`JPY` Japanese Yen (string)
yesterdayBalance = 22435152.4, // Yesterday Balance (double)
todayBalance = 22434910.4, // Today's Balance (double)
initialMargin = 1114946.0, // Initial Margin (double)
maintenanceMargin = 939214.0, // Maintenace Margin (double)
clearingMargin = 915760.0, // Clearing Margin (double)
todayEquity = 22694910.4, // Today's Equity (double)
...
withhold = 126402.0, // Withhold (double)
availableMargin = 21453562.4, // Available Margin (double)
riskIndex = 0.0, // Risk Index (double)
disgorgement = 0.0, // Disgorgement (double)
optPnl = -248600.0, // Option Profit or loss (double)
optValue = -193100.0, // Option Market Value (double)
optLongValue = 311900.0, // Long Option Market Value (double)
optShortValue = 505000.0, // Short Option Market Value (double)
futRealizedPnl = 0.0, // Future Realized Profit or Loss (double)
futUnrealizedPnl = 60700.0, // Future Unrealized Profit or Loss (double)
yesterdayEquity = 22634452.4, // Yesterday Equity (double)
buyLot = 22, // Buying Lot (int)
sellLot = 7 // Selling Lot (int)
}
]
}