Calculation method
How MoonMath calculates cascade simulator
Liquidation Cascade Simulator — What does forced selling do to the next forced sale?
The formula
A position is closed at P_entry × (1 − 1/L + m) when long and P_entry × (1 + 1/L − m) when short, for leverage L and maintenance margin rate m. The shock first consumes every resting level better than the price it claims to reach. Each pass then closes every bucket the current price has crossed, walks their combined size through the levels it meets, and takes the price of the deepest level reached. It repeats until a pass closes nobody new, nothing is left open, or the book runs out.
What it reads
- An order book: price and size for each resting bid and ask level
- Position buckets: side, entry price, size and leverage
- The maintenance margin rate the venue applies
- The shock that starts it, as a percentage
What it assumes
- The book and the positions are the visitor's scenario; nothing is observed and nothing is fetched
- Reaching a price consumes every level better than it, so the shock pays for its own move before anything is liquidated
- Nothing refills: no resting order arrives because price moved, which is exactly what happens on a real venue
- A bucket is closed in full at the price that crossed its liquidation price, before its own order moves price further
- Fees and funding are not in the liquidation price
What this does not establish
- It is not a claim that any real market holds these positions or this book — both were typed in
- The distribution of open interest across leverage is not observable on any venue, so it is a stated assumption and every number resting on it is one too
- Insurance funds and auto-deleveraging are not modelled, and both absorb part of a real cascade, so a real move would be smaller
- A cascade that ended because the book ran out reports the deepest level given, not a price a market reached
Run it
State an order book, a set of leveraged positions and a shock, and watch what the forced selling does to the next forced sale. Every figure is one you typed: no venue is queried, no real position is read, and the result says which of three conditions ended the cascade rather than only where price landed.
Open the Cascade Simulator calculatorHow the market itself works
This page describes MoonMath's arithmetic. The mechanics section describes the market: how an order book forms a price, why order-book depth is not the same thing as pool liquidity, and what a public book does and does not let you observe.
Read the market mechanics