Risk invariants
Phoenix margin is built around three practical invariants:- long and short open interest must balance
- unrealized profits must be matched by liabilities elsewhere in the system
- those liabilities must remain collateralized
Effective collateral
Effective collateral is the collateral value Phoenix uses for risk checks. It is similar to account equity, but Phoenix can discount positive unrealized PnL before treating it as usable collateral.- deposited collateral is the USDC collateral balance on the trader account
- positive unrealized PnL can be discounted by the market’s
uPnL risk factor - negative unrealized PnL counts in full
- unsettled funding is included because it changes account risk before final settlement
uPnL risk factor values.
Mark price and PnL
Position value is based on mark price, not the last trade price.Position margin
For each market, Phoenix calculates margin from the absolute position size and the market’s leverage tier.Limit-order margin
Risk-increasing resting limit orders can require margin before they fill. Phoenix evaluates resting bids and resting asks separately for each market:- reduce-only orders do not add margin
- orders that only reduce or close the current position do not add margin
- limit-order margin uses the market’s mark price and size, not the order’s limit price
limit_order_risk_factoris market- and tier-specific- limit-order margin is part of initial margin and can move an account toward the cancellation threshold before the order fills
Example portfolio
Assume a cross account has12,000 USDC deposited collateral and the following open positions:
| Market | Position | Entry | Mark | Unrealized PnL |
|---|---|---|---|---|
| BTC | Long 0.10 BTC | 60,000 | 62,000 | +200 USDC |
| SOL | Short 100 SOL | 150 | 140 | +1,000 USDC |
100% collateral credit for trading risk checks. Assume unsettled funding is -50 USDC.
phoenix/market-parameters-fallback.json. Values below include the quote-lot rounding used by the Rise margin calculator.
| Market | Position notional | Max leverage | Position margin |
|---|---|---|---|
| BTC | 0.10 * 62,000 = 6,200 | 20x | 310.000000 |
| SOL | 100 * 140 = 14,000 | 15x | 933.333334 |
| Market | Resting orders | Effect if filled |
|---|---|---|
| ETH | Bid 2 ETH, ask 1 ETH | No current ETH position, so either side opens exposure |
| SOL | Bid 50 SOL, ask 25 SOL | The bid reduces the short; the ask increases the short |
3,000 and SOL mark price is 140. In the fallback parameters, ETH uses 20x first-tier max leverage, SOL uses 15x, and both markets use a 100% first-tier limit_order_risk_factor.
For ETH:
| Threshold | Calculation | Result |
|---|---|---|
| Cancel margin | BTC 310.000000 * 70% + SOL 1,166.666667 * 75% + ETH 300.000000 * 70% | 1,302.000000 |
| Maintenance margin | total_initial_margin * 50% | 888.333333 |
| Backstop requirement | total_initial_margin * 20% | 355.333333 |
| High-risk margin | total_initial_margin * 10% | 177.666666 |
Maintenance margin and other thresholds
Phoenix derives lower risk thresholds from initial margin using market-specific risk factors. These thresholds are the escalation ladder the protocol uses as an account becomes more dangerous to the system.- below cancel margin: risk-increasing limit orders can be cancelled
- below maintenance margin: market liquidation can begin
- below backstop requirement: distressed positions can be transferred to a backstop account
- below high-risk margin: ADL can become available
Liquidation estimates
Liquidation price is an estimate, not a fixed promise. For a single position, Phoenix solves for the mark price where effective collateral would fall to the relevant maintenance requirement:qis signed position sizePis the estimated liquidation priceLis the active leverage tierother_upnlis the contribution from other markets in the same cross accountother_maintenance_marginis the maintenance margin from other markets in the same cross account