01Chapter 1: Margin and leverage: controlling more than you depositLeverage lets a trader hold a position larger than the money they deposit. This chapter covers the basic vocabulary and arithmetic: margin, position size, leverage, and the borrowed part of a trade. Later chapters build on these terms to explain profit and loss, liquidation prices, and cascades.7 min read
02Chapter 2: How leverage multiplies gains and lossesThis chapter covers one rule: return on your own margin equals leverage times the price move. It assumes you know what a long and a short position are, can work with percentages, and can read short Python functions. Margin means the deposit you put up to open a position. Leverage means the ratio of 6 min read
03Chapter 3: Perpetual futures: the main venue for crypto leverageThis chapter assumes you know what a long and a short position are, can work with percentages, and can read short Python functions. It also assumes you have seen the idea of margin from the previous chapters: a deposit that backs a position larger than the deposit.7 min read
04Chapter 4: Initial margin, maintenance margin and the buffer between themThis 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 posi6 min read
05Chapter 5: Calculating a liquidation priceThis chapter assumes you know what margin and leverage are, how long and short positions work, and how maintenance margin differs from initial margin. You should also be able to read short Python functions. By the end you will be able to derive a liquidation price from first principles, check it wit6 min read
06Chapter 6: Isolated versus cross marginThis chapter assumes you know what initial margin, maintenance margin and a liquidation price are, and that you can read short Python functions. Here you will see how the choice of margin mode changes which collateral backs a position, where the liquidation price lands, and how far a loss can spread6 min read
07Chapter 7: Mark price versus last price and why liquidations use itThis chapter assumes you know what a perpetual futures contract is, how a liquidation price is calculated, and how to read short Python functions. You should also know that an exchange compares your equity to a maintenance requirement. The previous chapters used "the price" as if there were only one6 min read
08Chapter 8: Funding rates and the cost of holding a leveraged positionThis chapter assumes you already know what a perpetual futures contract is, how margin and leverage work, and how to read short Python functions. It covers the recurring payment between longs and shorts that keeps a perpetual's price near the spot price, how to compute it, and how it affects the cos7 min read
09Chapter 9: What happens at liquidation: forced closing, fees and the insurance fundThis chapter follows a position from the moment the exchange flags it until the account is closed. It covers who takes the other side of the forced trade, what fees apply, and how the insurance fund absorbs losses. It assumes you know what margin, maintenance margin, mark price and liquidation price6 min read
10Chapter 10: Auto-deleveraging when the insurance fund is not enoughThis chapter assumes you know what a perpetual futures position is, how maintenance margin and liquidation price work, and what the insurance fund does when a position is force-closed. Basic Python is enough for the code.6 min read
11Chapter 11: Open interest and crowded positioning as a warning signThis chapter assumes you know how perpetual futures, margin, liquidation prices and funding rates work, as covered in the earlier chapters. It also assumes you can read short Python programs. The goal is to learn what open interest measures, how to combine it with funding and price data, and where t6 min read
12Chapter 12: Liquidation cascades: forced orders that move the price furtherThis chapter assumes you know how margin, maintenance margin, mark price and liquidation price work from the earlier chapters. It also assumes you can read short Python functions. Here we combine those pieces into a feedback loop. Liquidations are not only a result of price moves. Their forced order6 min read
13Chapter 13: Liquidations in DeFi lending: health factor and liquidation bonusThis chapter assumes you know how margin, maintenance margin and liquidation price work on a perpetual futures exchange, and that you can read short Python functions. It compares that model with liquidation on a DeFi lending protocol, where no exchange operator closes your position. Open code and in8 min read
14Chapter 14: Practical ways to limit leverage riskThis chapter assumes you have read the earlier chapters. You should know how margin, maintenance margin and liquidation price work, how mark price triggers liquidations, and how funding and open interest describe crowded positioning. You should also be able to read short Python functions.6 min read