total_collateral_value / sum(abs(position_notional_i))
total_balance + upnl + pending_short_USDC
collateral + upnl - total_initial_margin_with_orders - pending_short_USDC
USDC Balance + (non USDC assets) * mid_price + unsettled pnl
total_balance - total_initial_margin_with_orders - positive_upnl
Ex. 1 user’s total_balance
= 100 USDC, unsettled PnL = -40 USDC, => total_collateral is then 60 USDC. User has a position which takes up 20 USDC maintenance margin, then free_collateral
or withdrawable_balance
= 60 - 20 = 40 USDC
Ex. 2 user’s total_balance
= 100 USDC, unsettled PnL = 40 USDC, => total_collateral is then 100 USDC. User has a position which takes up 20 USDC maintenance margin, then free_collateral
= 100 - 20 = 80 USDC and withdrawable_balance
= 80 - 40 = 40 USDC
position_qty * (mark_price - avg_open)
Liquidation Price
position_notional_i = abs(mark_price_i * position_qty_i)
Fut Notional or Total Notional = sum (abs (position_notional_i))