Sub topic 4
Initial margin, maintenance margin and the buffer between them
This chapter assumes you know what a long and a short position are, can work with percentages, and can read short Python functions. It builds on the idea that leverage lets you control a position larger than your deposit. Here we look at the two margin thresholds that decide whether a leveraged position survives.
Two thresholds, two jobs
An exchange asks for margin at two different moments, and the two amounts answer different questions.
- Initial margin is the collateral you must put up to open a position. It answers: "Can you afford to start this trade?"
- Maintenance margin is the minimum equity you must keep while the position is open. It answers: "Can you still absorb losses?"
Both are usually quoted as a fraction of the position's notional value. The notional value is the size of the position at the current price: the number of units times the price.
Initial margin follows directly from leverage:
initial margin rate = 1 / leverageAt 10x leverage the initial margin rate is 10%. To open a 10,000 USDT position you deposit 1,000 USDT. At 20x it is 5%, and at 100x it is 1%.
Maintenance margin is set by the exchange. It is lower than the initial margin, often between 0.4% and a few percent for major coins. Smaller or more volatile assets, and larger positions, usually carry higher rates.
The buffer between them
The gap between the two rates is the room your position has to lose money before it is closed by force.
buffer = initial margin rate - maintenance margin rateWith 10x leverage and a 0.5% maintenance rate, the buffer is 10% - 0.5% = 9.5% of the position's notional value. If the price moves against you by about that fraction, your equity falls to the maintenance level.
The buffer shrinks quickly as leverage rises:
| Leverage | Initial margin rate | Maintenance rate | Buffer (share of notional) |
|---|---|---|---|
| 2x | 50.0% | 0.5% | 49.5% |
| 5x | 20.0% | 0.5% | 19.5% |
| 10x | 10.0% | 0.5% | 9.5% |
| 25x | 4.0% | 0.5% | 3.5% |
| 100x | 1.0% | 0.5% | 0.5% |
At 100x, a 0.5% adverse move uses up the whole buffer. Ordinary intraday noise in crypto is larger than that, so such a position is almost certain to be stopped out by routine price movement, even if your longer-term view is right.
Equity, not just deposit
The comparison that matters is between your equity and the maintenance requirement. Equity for one isolated position is:
equity = margin deposited + unrealized profit and lossUnrealized profit and loss (PnL) is the gain or loss on the open position if it were closed at the current mark price. A position is at risk of liquidation when:
equity <= maintenance margin rate * current notional valueNotice that the right side moves with the price. For a long position, a falling price lowers your equity and also lowers the maintenance requirement a little, because the notional value shrinks. For a short position, a rising price lowers equity and raises the requirement. This is why the short-side liquidation formula in the previous chapter's approach divides by (1 + maintenance_rate) while the long side divides by (1 - maintenance_rate).
A worked example
Suppose you open a 10x long on 100 units' worth of an asset priced at 100. Assume a 0.5% maintenance rate and ignore fees and funding.
- Notional value: 100 units x 100 = 10,000
- Initial margin: 10,000 / 10 = 1,000
- Maintenance margin at entry: 0.5% x 10,000 = 50
Now the price drops to 92.
- New notional value: 100 x 92 = 9,200
- Unrealized PnL: 100 x (92 - 100) = -800
- Equity: 1,000 - 800 = 200
- Maintenance requirement: 0.5% x 9,200 = 46
Equity of 200 is above 46, so the position survives. At a price of 90.45 the numbers meet: equity is 1,000 - 955 = 45, and the requirement is 0.5% x 9,045 = 45.2. That is where liquidation starts.
The code below turns this into a check you can run for any price.
def margin_status(entry, price, size, leverage, maintenance_rate):
"""Equity and maintenance requirement for an isolated long position.
Ignores fees and funding.
"""
notional_at_entry = size * entry
margin = notional_at_entry / leverage
unrealized_pnl = size * (price - entry)
equity = margin + unrealized_pnl
maintenance = maintenance_rate * size * price
return {
"margin": margin,
"equity": equity,
"maintenance": maintenance,
"cushion": equity - maintenance,
"liquidatable": equity <= maintenance,
}
for price in (100, 95, 92, 90.5, 90.4):
status = margin_status(entry=100, price=price, size=100,
leverage=10, maintenance_rate=0.005)
print(price, round(status["equity"], 2), round(status["maintenance"], 2),
round(status["cushion"], 2), status["liquidatable"])The cushion value is the practical number to watch. It tells you how much more equity you can lose before the exchange acts. Running the loop shows it shrinking toward zero, and liquidatable flips to True only at 90.4, just past the 90.45 threshold.
Why maintenance margin exists
The exchange cannot wait until your equity reaches zero. Closing a position takes time and happens at a price that may be worse than the last quote. If equity were allowed to fall to zero before closing, any slippage during the close would turn into a loss for the exchange, and then for other users.
The maintenance margin is a safety margin that pays for the closing process. When liquidation starts at 0.5% of notional, that remaining equity covers the closing trade's slippage and the liquidation fee. Later chapters cover what happens when it does not.
Common errors
Treating initial margin as the amount you can lose. The initial margin is only the starting point. Your loss is limited by the equity you have posted, which is the initial margin in isolated mode, but your usable buffer is smaller. You lose the right to keep the position once equity reaches the maintenance level, which is before you have lost everything. At 10x, you are closed out after losing about 9.5% of notional, which is 95% of your initial margin, not 100%.
Forgetting that maintenance rates can rise with size. Many venues use tiered rates. A larger notional value falls into a higher tier with a higher maintenance rate, so the buffer is thinner than the headline figure for a single small position. The simple formulas in this tutorial use one flat rate. Check the exchange's own tier table before relying on a result.
Ignoring fees and funding. Opening fees, closing fees and funding payments all reduce equity. They move the real liquidation price closer to the entry than the formula suggests. A position that looks safe by 0.2% may already be inside the danger zone once a funding payment is charged.
Confusing margin ratio displays. Exchanges show a "margin ratio" or "risk level" in different ways. On some it rises toward 100% as danger approaches. On others it falls toward a threshold. Read the definition on your venue before you interpret the number.
Adding margin and expecting the leverage setting to matter. In isolated mode, adding margin to an open position raises equity and moves the liquidation price away from the entry. The leverage figure shown then describes the effective ratio of notional value to equity, not the original setting. What protects you is the equity buffer, not the label.
Using the buffer in practice
Three habits follow from the buffer idea.
- Convert leverage into a buffer before you open a trade. Compute 1 / leverage minus the maintenance rate. Compare it with the price swings the asset normally makes in a day or a week. If a typical swing is larger than the buffer, the position is likely to be liquidated by noise.
- Watch the cushion, not the leverage label. The cushion in currency terms tells you how much equity you can still lose. It changes with price, fees and funding, while the leverage label does not.
- Keep a margin reserve. If you can add collateral to a position, a reserve outside the position gives you the option to widen the buffer in an emergency. That only works if you hold it in advance and act before the threshold is reached.
Exercise
You open a 20x isolated long on 50 units of an asset at a price of 200. The maintenance rate is 0.5%. Ignore fees and funding. (a) What are the initial margin and the buffer as a share of notional value? (b) At what price does equity equal the maintenance requirement?
Show answer
(a) Notional value is 50 x 200 = 10,000. Initial margin is 10,000 / 20 = 500, which is 5% of notional. The buffer is 5% - 0.5% = 4.5% of notional, or 450. (b) Equity = 500 + 50 x (P - 200). The requirement = 0.005 x 50 x P = 0.25 P. Setting 500 + 50P - 10,000 = 0.25P gives 49.75P = 9,500, so P is about 190.95. This matches the formula entry x (1 - 1/20) / (1 - 0.005) = 200 x 0.95 / 0.995, which is about 190.95.
Exercise
Two traders hold the same asset. Trader A uses 5x leverage and Trader B uses 50x, both with a 0.5% maintenance rate. Roughly what adverse price move does each need to reach the maintenance threshold, and why does the difference matter when the asset often moves 3% in an hour?
Show answer
Trader A's buffer is 20% - 0.5% = 19.5% of notional, so a move of roughly 19% to 20% against the position triggers liquidation (slightly less for a long, once the shrinking notional is accounted for). Trader B's buffer is 2% - 0.5% = 1.5%. A 3% hourly move exceeds Trader B's buffer, so B is likely to be liquidated by ordinary volatility, while A is not.