October 06, 2022
Isolated margin is available for Permissionless Perps and allows traders to open siloed positions in each market. Each position can only lose up to its position margin, and if liquidated, other open positions and balances remain unaffected.
When trading with isolated margin, there are four key metrics: leverage, position margin, margin balance, and maintenance margin.
Leverage refers to how much buying power a trader wishes to use.
Example: A trader using “3x” leverage with $1,000 in collateral can buy up to $3,000 worth of permissionless perp contracts.
While leverage magnifies gains, it also magnifies losses and puts traders at risk of liquidation. Leverage can be changed using the leverage slider.
Position margin is the initial margin required to place an order and open a position.
When placing an order, the risk engine will check if the account has sufficient collateral available to cover the position margin.
When the order is accepted into the order book, this margin will be isolated and unavailable until the order is canceled.
Once the order matches, the isolated margin becomes position margin. Margin can be added/withdrawn to/from the position margin.
Margin balance corresponds to the real-time amount of margin used to support the open position and comprises position margin and unrealized PnL.
The maintenance margin is the minimum margin required to keep a position open. In other words, positions are liquidated (automatically reduced/closed) when a position’s margin balance falls below the maintenance margin. If a trader’s margin balance enters bankruptcy, the position may be auto-deleveraged if the insurance fund cannot support the loss.
The exact formulae for position margin, margin balance, and maintenance margin:
Position Margin = Entry Price * abs(Position Size) / Leverage
Margin Balance = Position Margin + Unrealized PnL
Maintenance Margin = Mark Price * abs(Position Size) * Maintenance Margin Rate – Maintenance Amount
Maximum Withdrawable Margin = max(0, min(Position Margin – Maintenance Margin, Margin Balance – abs(Position Size) * Mark Price / Leverage)
Margin Ratio = Maintenance Margin / Margin Balance
Long Liquidation Price = (Position Margin + Maintenance Amount – Entry Price * Position Size) / (Position Size * Maintenance Margin Rate – Position Size)
Short Liquidation Price = (Position Margin + Maintenance Amount + Entry Price * abs(Position Size)) / (abs(Position Size) * Maintenance Margin Rate + abs(Position Size))
Position limits are initially sized based on the starting TVL in the core AMM, however they may be changed either by governance or during risk limit reviews.
Example limits for a Permissionless Perp with a 50,000 USDC TVL core AMM:
Leverage (x) | Position Limit ($) | Maintenance Margin Rate | Maintenance Amount ($) |
3 | 500 | 15% | 0 |
2 | 1,000 | 25% | 50 |
1 | 2,500 | 50% | 250 |
Core AMM | – | 15% | 0 |
Alice places an order to buy 0.1 ETH at $1,000 using 3x leverage:
Isolated margin = 1000 * abs(0.1) / 3 = 33.333
Half of Alice’s order is matched:
Position margin = 1000 * abs(0.05) / 3 = 16.667
Margin balance = 16.66667
Liquidation price = (16.667 + 0 – 1000*0.05) / (0.05 * 0.15 – 0.05) = 784.3
Ethereum’s price increases to 1,100:
Position margin = 16.667
Margin balance = 16.667 + 0.05 * 100 = 21.667
Maintenance margin = 1100 * abs(0.05) * 0.15 – 0 = 8.25
Maximum withdrawable margin = max(0, min(16.667 – 8.25, 21.667 – abs(0.05) * 1100 / 3)) = 3.333
Liquidation price = (16.667 + 0 – 1000*0.05) / (0.05 * 0.15 – 0.05) = 784.3