Sub topic 5
Calculating a Liquidation Price
Assume you understand long and short positions, percentages, and basic Python. This chapter uses a simplified model for an isolated, linear perpetual futures position. Real exchanges also include fees, funding, risk tiers, and different maintenance schedules.
The liquidation condition
A liquidation price is the approximate market price at which an exchange closes a leveraged position because the trader's remaining equity no longer covers the required maintenance margin.
The key quantities are:
- Entry price: The price when the position opens.
- Leverage: Position value divided by the trader's initial margin.
- Initial margin: The trader's deposit supporting the position.
- Maintenance margin: The minimum equity required to keep the position open.
- Unrealized P&L: The current profit or loss that has not yet been settled.
For an isolated position, liquidation occurs when:
Initial margin + unrealized P&L = maintenance margin requirement
Let:
- E be the entry price.
- L be leverage.
- m be the maintenance margin rate.
- P be the liquidation price.
The initial margin per unit of position is E/L.
Long position
A long position loses value when price falls. Its approximate liquidation price is:
P = E × (1 − 1/L) ÷ (1 − m)
Short position
A short position loses value when price rises. Its approximate liquidation price is:
P = E × (1 + 1/L) ÷ (1 + m)
The maintenance rate makes liquidation happen slightly sooner than a simple “price moved by 1/L” estimate.
Worked example
Suppose a trader opens an isolated 10x long at 100, with a maintenance margin rate of 0.5%.
The initial margin fraction is 1/10, or 10%. Without maintenance margin, a 10% fall would consume the entire initial margin. Including maintenance margin:
P = 100 × (1 − 0.10) ÷ (1 − 0.005)
P ≈ 90.45
The position can therefore be liquidated when the relevant pricing measure reaches about 90.45.
For a 10x short at the same entry price:
P = 100 × (1 + 0.10) ÷ (1 + 0.005)
P ≈ 109.45
These are estimates, not guaranteed trigger prices.
def liquidation_price(entry, leverage, maintenance_rate, side):
"""Approximate liquidation price for an isolated linear position."""
initial = 1.0 / leverage
if side == "long":
return entry * (1 - initial) / (1 - maintenance_rate)
if side == "short":
return entry * (1 + initial) / (1 + maintenance_rate)
raise ValueError("side must be 'long' or 'short'")
print(round(liquidation_price(100.0, 10, 0.005, "long"), 2))
# 90.45
print(round(liquidation_price(100.0, 10, 0.005, "short"), 2))
# 109.45What changes the estimate?
| Factor | Effect on liquidation |
|---|---|
| Higher leverage | Moves liquidation closer to entry |
| Higher maintenance rate | Requires more remaining equity |
| Fees and funding | Consume equity and can trigger liquidation earlier |
| Larger risk tier | May increase the maintenance requirement |
| Additional isolated collateral | Moves liquidation farther away |
Visual model
Exercise
A trader opens a 5x isolated long at 200 with a 1% maintenance margin rate. What is the approximate liquidation price?
Show answer
Use 200 × (1 − 1/5) ÷ (1 − 0.01) = 161.62, approximately.