Collateral and equity#
A paper account starts with 10,000 USD of collateral, and a reset returns it there. Everything else is derived from four running totals.
equity = starting collateral + realized − fees − funding + unrealized
available = starting collateral + realized − fees − funding − margin locked in positions
(and not committed to resting orders)Isolated margin#
margin = notional / leverageMargin is locked when a position opens and returned, with the result, when it closes. A loss on one position cannot reach another position’s margin. Adding to a position adds margin at the new leverage. There is no cross margin and no portfolio margin.
Maintenance margin and liquidation#
A position is liquidated when its equity falls to its maintenance margin. The maintenance rate comes from the market’s own maximum leverage:
mmr = 1 / (2 × maximum leverage of the market)
effective = margin − funding already paid on this position
long liq = (entry × size − effective) / (size × (1 − mmr))
short liq = (entry × size + effective) / (size × (1 + mmr))Worked example#
A long of 10 coins at an entry of 100 is 1,000 USD of notional. At 5x it posts 200 USD. The market allows 40x, so the maintenance rate is 1/80 = 1.25%.
liq = (100 × 10 − 200) / (10 × (1 − 0.0125))
= 800 / 9.875
≈ 81.01 (about 19% below the entry)
fee = 1,000 × 4.5 bps = 0.45 USD at entry (taker)Funding already paid moves the liquidation closer, because it reduces the effective margin.
What a liquidation does#
- The engine checks each position against its liquidation price, using the guarded mark and the one-minute extremes since the last check.
- If the price touched it, the position is closed at the liquidation price, or at the mark when the price gapped past it.
- The posted effective margin is lost. It is booked as a realized loss, and the liquidation counter on the account goes up.
- Resting reduce-only orders on that market are cancelled.
Why the stop comes first#
A new position needs a stop inside its liquidation price. The ticket check requires the stop distance plus one percentage point to stay under the estimated liquidation distance. If a stop and the liquidation price are both touched in the same minute, the one nearer to the entry fires.
Fees#
| Role | Rate | When |
|---|---|---|
| Taker | 4.5 bps of notional | Market, IOC, FOK, a limit that crosses the mark, stops, targets, closes |
| Maker | 1.5 bps of notional | A resting limit or post-only order that fills later |
Fees come out of collateral and count toward the daily loss stop. Rates are fixed constants in the paper engine. They are modeled on a typical venue schedule and are not read from your own account.
Funding#
Funding settles on each clock hour using the venue’s published hourly rate and the guarded mark. A positive rate means longs pay shorts, and a negative rate means the reverse. The rate is capped at 4% an hour.
payment = direction × rate × size × mark × hours
direction = +1 for a long, −1 for a short (positive = you pay)Payments reduce the position’s effective margin and the account’s collateral. Hours that passed while nobody was watching are settled on the next check, at the current rate. That is an approximation: real funding uses the rate of each past hour.
Insurance buffer#
Paper liquidations feed a simple shared ledger. When a position is liquidated, the equity left at the close, positive or negative, is added to the buffer. It is an accounting number that shows how liquidations would have netted out. It never changes your balance.