Overview
Thesimulator.getAccount endpoint retrieves the current snapshot of a simulated trading account, including cash balances, open positions, margin usage, and profit/loss calculations.
Request
Parameters
string
The simulator account identifier. Defaults to
"default" if not provided.Use different account IDs to maintain separate simulated portfolios with independent balances and positions.Response
object
Complete account snapshot containing balances, positions, and P&L.
number
Total cash in the account (includes borrowed balance if negative).
number
Cash available for new positions after accounting for margin requirements.
number
Amount of borrowed funds (used when trading with leverage or shorting).
number
Total account value:
cashBalance + totalUnrealizedPnl.number
Total margin locked in open positions.
string
Quote currency for all monetary values (e.g.,
"USD").number
Cumulative realized profit/loss from closed positions.
number
Current unrealized profit/loss from all open positions.
array
Array of open positions.
string
Trading pair symbol (e.g.,
"BTC-USD").enum<string>
Position direction:
"LONG" or "SHORT".number
Position size in base currency.
number
Average entry price for the position (weighted by quantity).
number
Realized P&L from partial closes of this position.
number
Current unrealized P&L based on mark price.
number
Current market price used for P&L calculations.
number
Margin locked for this position.
number
Position notional value:
quantity * markPrice.number | null
Leverage multiplier used when opening the position (if applicable).
Code Example
Account State Structure
The account snapshot represents the complete state at the time of the request:Balance Components
- Cash Balance: Starting capital + realized P&L ± borrowed funds
- Available Cash: Cash not locked as margin (available for new trades)
- Borrowed Balance: Negative balance from leverage or short selling
- Equity: True account value including unrealized P&L
- Margin Balance: Locked funds backing open positions
Position Tracking
Each position maintains:- Average entry price (weighted by partial fills)
- Separate realized/unrealized P&L (partial closes tracked)
- Current mark price (real-time market data)
- Margin requirement (varies by leverage)
- Optional exit plan (stop loss, take profit targets)
Real-Time Updates
Account state reflects:- All executed orders (market and limit fills)
- Current market prices for unrealized P&L
- Margin requirements based on position sizes
- Borrowed balance changes from leverage use

