Sub topic 9
Margin and Leverage
Assume you understand cryptocurrency exchanges, spot trading, percentages, and basic Python. This chapter explains how a derivatives position uses collateral, how leverage changes exposure, and how isolated and cross margin differ.
Margin is collateral
Margin is the collateral that supports a leveraged position. You deposit margin in an account, then use it to control a position whose notional value is larger.
Notional value is the total market value of the position:
\[ \text{notional value} = \text{quantity} \times \text{price} \]
For example, buying 0.5 BTC at $60,000 creates a $30,000 position. If the exchange requires $3,000 of initial margin, the position uses 10:1 leverage:
\[ \text{leverage} = \frac{\text{notional value}}{\text{initial margin}} \]
Leverage does not increase the position's actual price movement. It increases the position size relative to the trader's own capital. A 1% move on a $30,000 position produces a $300 profit or loss, whether the trader supplied $30,000 or $3,000.
| Position value | Initial margin | Leverage |
|---|---|---|
| $30,000 | $3,000 | 10× |
Initial and maintenance margin
Initial margin is the amount needed to open a position. Maintenance margin is the minimum equity the exchange requires to keep it open.
Equity is the margin account's current value, including unrealized profit or loss:
\[ \text{equity} = \text{margin} + \text{unrealized PnL} \]
Unrealized profit or loss is the gain or loss on an open position before it is closed. If losses reduce equity below the maintenance requirement, the exchange can liquidate the position. Liquidation is the forced closing of a position. The later liquidation chapter covers its price calculation in detail.
Exchanges often use higher maintenance rates for larger positions. Therefore, the simple leverage shown in an interface may not describe the exact liquidation threshold.
Isolated and cross margin
Margin mode controls which collateral can absorb losses.
- Isolated margin assigns a specific amount of collateral to one position. If that position is liquidated, the intended loss is limited to its assigned margin, plus applicable fees and funding.
- Cross margin shares eligible account collateral across positions. A profitable position may help support a losing one, but a large loss can consume much more of the account.
A simple leverage calculation
The following function calculates initial margin. It ignores exchange-specific tiers, fees, and funding.
def initial_margin(quantity, entry_price, leverage):
notional = quantity * entry_price
return notional / leverage
quantity = 0.5
entry_price = 60_000
leverage = 10
print(initial_margin(quantity, entry_price, leverage))The output is 3000.0, because 0.5 BTC at $60,000 has a $30,000 notional value and requires $3,000 at 10× leverage.
A useful risk check is to calculate the loss from a possible adverse price move before opening the position:
\[ \text{linear loss} = \text{quantity} \times \text{price move} \]
At 10× leverage, a 5% adverse move on this position is a $1,500 loss. That consumes half of the $3,000 initial margin before fees, funding, and maintenance requirements are considered.
Exercise
A trader opens a $12,000 position with $2,000 of initial margin. What is the leverage, and what is the unrealized loss after a 4% adverse move?
Show answer
The leverage is 6×. A 4% move on $12,000 produces a $480 loss, before fees and funding.