Skip to Content
TradingLiquidations

Liquidations

A liquidation happens when a perp position moves against you until your equity falls below the maintenance margin. Maintenance margin is half the initial margin at the market’s maximum leverage: 10% of the position’s value on a market with 5x maximum leverage, and 5% on one with 10x (see Margining).

How a liquidation runs: open above maintenance margin, then the order book, then the backstop, then auto-deleveraging, as equity falls

Motivation

Liquidations ensure that every position is backed, so that no trader’s profit depends on another trader’s unpaid loss.

Loaf’s liquidation design has two objectives. The first is to preserve as much of the liquidated trader’s margin as possible, so most liquidations go to the order book, where the position closes at the best available price rather than at the bankruptcy price. The second is that the market, not an internal desk, takes the other side, with Loaf’s own capital as the backstop before any trader’s. Each step is visible on the book, in the public intake journal and in the published backstop figures TBC.

Overview

Loaf checks each pool of margin against its maintenance margin whenever the mark price, funding or settings of one of its markets move. When a pool’s equity falls below maintenance margin, Loaf liquidates it in up to four steps:

  1. Cancel the pool’s orders. Its resting orders, stops and take-profits are cancelled.
  2. Close positions on the order book. Positions close one at a time, largest maintenance margin first, with orders that fill straight away at or past the position’s bankruptcy price, until the pool is back above maintenance margin. A large position closes a fifth at a time, and each market limits how fast liquidations reach its book.
  3. Backstop. If the pool’s equity falls below two thirds of maintenance margin before the book has closed the position, Loaf’s backstop account takes it over at its bankruptcy price (see The backstop).
  4. Auto-deleveraging. If the backstop cannot take the position and the pool’s equity is below zero, auto-deleveraging closes it against profitable positions on the other side.

The bankruptcy price is the price at which a position’s losses equal its margin. Any margin left after a liquidation on the book stays with you, less the liquidation fee.

  • Cross margin. Your cross positions share one pool, so a loss on one can liquidate the others. They close largest first until the pool is healthy again.
  • Isolated margin. Each isolated position has its own pool, so only that position is liquidated. Your cross pool and other positions are untouched.

In a backstop takeover, the position is taken at its bankruptcy price, so the margin behind it is gone. To keep your margin, set a stop loss or close the position before the mark price reaches your liquidation price.

Liquidations use the mark price: a median of the oracle price plus a capped premium, the perp’s own book and outside markets, kept within the market’s own band around the oracle price. That makes a liquidation harder to trigger than a single price on the book would. While a market is halted its liquidations wait, and while its oracle price is stale nothing in it is liquidated (see Halts and price bands).

Why liquidations go to the order book

On many venues a liquidated position is taken over by the exchange at its bankruptcy price, and any remaining margin goes to an insurance fund controlled by the venue. On Loaf, most liquidations are sent to the order book. Any trader can fill the liquidation, the position closes at the best available price, and any margin the fill leaves stays with the liquidated trader.

Liquidation flow is available to the market rather than retained by the exchange, and the process is visible on the book and in the public intake journal. The design prioritises keeping as much capital as possible with the trader being liquidated.

The liquidation fee

Each liquidation fill on the book pays a fee of 1% of its value, capped at how far the fill beat the bankruptcy price. The fee goes to the backstop that stands behind every market, so it funds the losses the backstop absorbs for the market rather than general exchange revenue. Because of the cap, the fee is never more than the margin the fill leaves, so it cannot push you below zero. A liquidation can never cost you more than the position itself.

For example, a long of 1,000 units with a bankruptcy price of 8.00 USD closes on the book at 8.85 USD. The fill is worth US$8,850, so the fee is US$88.50, well within the US$850 the fill beat the bankruptcy price by. Of the US$850 of margin left, US$761.50 stays with you.

The backstop

The backstop is a dedicated Loaf account, run by Loaf’s market-making desk, that stands behind every market TBC. It takes over a position at its bankruptcy price once the position’s pool falls below two thirds of maintenance margin, or when its market expires.

The backstop exists so that a position nobody on the book will take still closes cleanly, and so the losing side’s shortfall is not passed to the winning side. It is funded with Loaf’s capital and the liquidation fees it earns, so Loaf carries the risk of its markets before any trader does. Every position it takes over, and its profit and loss from them, is published TBC.

  • It takes positions only while its own equity stays at least twice its own maintenance margin.
  • Its losses in each price window are capped at 10% of its equity at the start of the window.
  • If a close leaves a pool owing money, the backstop covers that debt when it can.
  • Its income is the liquidation fees, plus the gap between each bankruptcy price and the market.

If the backstop cannot take a position and the pool’s equity is below zero, auto-deleveraging closes it against profitable positions on the other side. If the pool’s equity is still above zero, the position goes back to the order book.

Your liquidation price

When you set up an order, Waterline shows an estimated liquidation price. The final one can differ, because the depth of the book changes. Once the position is open, its liquidation price reflects your entry price, but it can still move with funding payments and, in cross margin, with the profit or loss on your other positions.

In cross margin, the liquidation price does not depend on the leverage you choose: lower leverage simply uses more of your balance. In isolated margin it does, because the margin set aside for the position depends on the leverage.

The liquidation price of a position is:

liquidation price = price - side × margin available ÷ size ÷ (1 - maintenance rate × side)
side1 for a long, -1 for a short
priceThe entry price of a new position
margin availableThe margin behind the position, minus the maintenance margin it needs at that price. In isolated margin, the position’s own margin. In cross margin, your cross account’s equity, less the maintenance margin of your other cross positions TBC
maintenance rate1 ÷ (2 × the market’s maximum leverage): 10% at 5x, 5% at 10x

For a new isolated position this simplifies to:

  • Long: liquidation price = (entry price - margin ÷ size) ÷ (1 - maintenance rate)
  • Short: liquidation price = (entry price + margin ÷ size) ÷ (1 + maintenance rate)

Worked example

This example is illustrative and leaves out fees, funding and slippage. You open a long of 1,000 units at 10.00 USD on a physical market with 5x maximum leverage. The position value is US$10,000, the maintenance rate is 10%, and at 5x the initial margin is US$2,000.

In isolated margin, the US$2,000 is all that backs the position:

Mark pricePosition valueEquityMaintenance marginResult
10.00 USDUS$10,000US$2,000US$1,000Open
9.00 USDUS$9,000US$1,000US$900Open
8.80 USDUS$8,800US$800US$880Below maintenance margin, so liquidated
8.00 USDUS$8,000US$0US$800Equity is zero: the bankruptcy price

Margin available is US$2,000 less US$1,000 of maintenance margin, so the liquidation price is 10.00 - 1,000 ÷ 1,000 ÷ (1 - 0.10), about 8.89 USD, a fall of about 11%. A 20% fall, to 8.00 USD, would take all US$2,000 of margin.

In cross margin, with US$4,000 in your account and no other positions, the whole balance backs the same long. Margin available is US$3,000, so its liquidation price is 10.00 - 3,000 ÷ 1,000 ÷ (1 - 0.10), about 6.67 USD, a fall of about 33%.

IsolatedCross
Margin behind the positionUS$2,000US$4,000, your whole account
Liquidation priceAbout 8.89 USDAbout 6.67 USD
Fall that triggers liquidationAbout 11%About 33%
Most you can loseUS$2,000US$4,000

Warning. At 5x leverage, a 20% move against you can take all of your margin. In cross margin, a loss can draw on your whole account.

Last updated on