The formulas behind the account summary — how collateral, equity, margin usage, and
the margin ratios are derived. For the fields as returned, see
Get Account Summary and the
Account Summary Stream. Everything
is denominated in USDT.
Key Definitions
Account Balance
accountBalance accumulates settled cash flows and does not move with the mark price. The
premium you pay or receive at entry has already flowed through it.
Realized PnL and volume do not move collateral — a closed trade’s cash has already moved
through premium and payoff, so they are reported for the record only.
Total Equity
totalEquity is accountBalance plus the signed mark value of every open position — that
is, the sum of each position’s notionalValue. A short’s notionalValue is negative, so it
subtracts.
totalEquity is not accountBalance + unrealizedPnl. unrealizedPnl is measured
against the entry price, but the entry premium has already moved through
accountBalance — adding that PnL back would count entry twice. Use totalEquity
as published; the margin ratios are computed against it.
Unrealized PnL
unrealizedPnl measures each open position against its average entry price and sums across
positions. It is reported on the account summary and on every position, but it is not the
term added to totalEquity.
Available & Withdrawable Balance
availableBalance is the collateral free for new orders — accountBalance less the margin
already locked by positions and resting orders.
withdrawableBalance is the balance you can withdraw — a more conservative figure than
availableBalance, since unrealized profits cannot be withdrawn.
Margin Ratios
The margin ratios divide the margin requirement by totalEquity. Each returns 1 when
equity is zero or negative.
See Margin & Fees for how per-position initial and
maintenance margin are sized.
Usage in API
These calculations back the Get Account Summary
response and the Account Summary Stream.
totalEquity depends on the mark price, so it moves between balance changes; the summary is a
snapshot at the moment it is emitted. See the stream page for how to keep it current.