Sub topic 1
Margin and leverage: controlling more than you deposit
Prerequisites
This chapter assumes you understand buying, selling and holding crypto assets, know what long and short positions are, can work with percentages, and can read simple Python.
What margin and leverage mean
Margin is the collateral you deposit to open a leveraged position. Leverage is the multiple of that margin the position controls. With 1,000 USD of margin at 5x leverage, you control a position worth 5,000 USD.
Position size
Position size equals margin multiplied by leverage. The exchange lends you the difference, and you pay for that loan through fees and funding costs.
How leverage multiplies gains and losses
Profit and loss are calculated on the position, but your return is measured against your margin. A 5% price move on a 5x position changes your margin by 25%.
def equity_return(leverage, price_move):
"""Return on margin for a long position, ignoring fees and funding."""
return leverage * price_move
for lev in (1, 5, 10):
print(lev, equity_return(lev, 0.05), equity_return(lev, -0.05))
# 1 0.05 -0.05
# 5 0.25 -0.25
# 10 0.5 -0.5> Note on the output above: the values are returns on margin, not dollar amounts.
Perpetual futures: the main venue for crypto leverage
A perpetual futures contract is a derivative that tracks an asset's price without an expiry date. Traders use these contracts on exchanges to take leveraged long or short positions. Most leverage in crypto trading happens on these venues.
Initial margin, maintenance margin and the buffer between them
Initial margin is the minimum collateral needed to open a position. Maintenance margin is the minimum collateral needed to keep it open. The gap between the two is your buffer. If your equity falls below maintenance margin, the exchange liquidates the position.
Exercise
You deposit 500 USD of margin and open a 4x long. The price falls 10%. What is your return on margin, ignoring fees?
Show answer
Position return is 4 x -10% = -40%, so you lose 200 USD of your 500 USD margin.