Overview
Monitor your trading account balances, open positions, and profit/loss using the Indexer Client. This guide covers all balance and position-related queries.Account Balances
Query total equity, free collateral, and margin usage
Open Positions
Track position size, entry price, and unrealized PnL
Querying Account Balances
Get Parent Subaccount
The parent subaccount contains all child subaccounts and their balances:string
Total account value including unrealized PnL
string
Available collateral for opening new positions
string
Currently used margin for open positions
Understanding Balance Metrics
Total Equity
Total Equity
Formula:
Equity = Free Collateral + Margin Usage + Unrealized PnLTotal value of your account including all open positions at current market prices.Free Collateral
Free Collateral
Definition: Available collateral that can be used to open new positions.
Margin Usage
Margin Usage
Definition: Collateral currently allocated to open positions.
Querying Open Positions
Get All Positions
Position Fields
string
Market identifier (e.g., “ETH-USD”)
string
Position side:
"LONG" or "SHORT"string
Position size in base currency
string
Maximum position size reached
string
Average entry price for the position
string
Exit price (for closed positions)
string
Realized profit/loss from closed portion
string
Current unrealized profit/loss at market price
string
Net funding payments received/paid
string
Sum of all opening trades
string
Sum of all closing trades
Calculating PnL
Unrealized PnL
Calculate unrealized PnL for a position:Total PnL
Calculate total PnL including realized and unrealized:Monitoring Account Health
Margin Ratio
Calculate your margin ratio to monitor liquidation risk:Liquidation Price
Estimate liquidation price for a position:Source Account Balances
Query wallet balances outside of subaccounts:Source balances are in the main wallet and not available for trading until
deposited to a subaccount.
Portfolio Analytics
Portfolio Summary
Create a comprehensive portfolio summary:Position Breakdown by Market
Real-time Balance Monitoring
Polling Strategy
Best Practices
Regular Balance Checks
Regular Balance Checks
Check balances before placing large orders:
Monitor Liquidation Risk
Monitor Liquidation Risk
Set up alerts for low margin ratios:
Track PnL Over Time
Track PnL Over Time
Store balance snapshots for performance tracking:
Next Steps
Transfers
Deposit, withdraw, and transfer funds
Market Data
Query markets and orderbooks
IndexerClient Reference
Complete Indexer API documentation
Types Reference
Detailed type definitions