11 MARKETSUSDG10 S GRIDNEXT FILL 00:10
//06_ Docs

LIQUIDATION AND THE BUST BUFFER

//01_ THE BUST PRICE

Every position has a bust price, fixed at open from its entry price and leverage. It is shown in the app next to the position and drawn as a red line on the chart.

BUST PRICE
d     = 1 / leverage - 0.0005        (0.0005 = 5 bps, the bust buffer)

long:  bust = entry x (1 - d)        rounded up
short: bust = entry x (1 + d)        rounded down

Without the buffer, the bust price would sit exactly where the loss equals the margin: a move of 1 / leverage against you. The buffer moves it 5 bps closer to the entry. Both roundings also go towards the entry, by at most one unit of the 8-decimal price.

//02_ EXAMPLES

An entry of $100,000.00:

LEVERAGEMOVE TO BUSTLONG BUSTSHORT BUST
2x49.95%$50,050.00$149,950.00
10x9.95%$90,050.00$109,950.00
50x1.95%$98,050.00$101,950.00
100x0.95%$99,050.00$100,950.00

An equity entry of $180.00 (equities go up to 50x):

LEVERAGEMOVE TO BUSTLONG BUSTSHORT BUST
2x49.95%$90.09$269.91
10x9.95%$162.09$197.91
50x1.95%$176.49$183.51

//03_ THE BUFFER

At the bust price a position still has equity equal to 5 bps of its size: $0.50 on a $1,000 position. A liquidation forfeits it with the rest of the margin. The buffer makes the liquidation line a little stricter than the point where the margin is exactly used up, and that small difference goes to the house.

The buffer is a constant of the contract. The owner cannot change it, and it applies the same way to every market and every leverage.

//04_ A HARD BUST

Crossing the bust price loses the whole margin, even if a voluntary close an instant earlier would have returned something. A BTC long with $100 margin at 10x from $100,000.00:

EXITOUTCOMERETURNED
$90,060.00losing close, loss $99.40$0.60
$90,050.00liquidation (at the bust price)$0.00
$90,000.00liquidation$0.00

A close request whose fill price turns out to be at or beyond the bust price settles as a liquidation. Asking to close does not protect a position until the close has filled.

//05_ WHO LIQUIDATES

Anyone. liquidate(positionId, proof) is permissionless. The contract accepts the proof if it is a valid RedStone price for the market (see the oracle) and:

  • its timestamp is at or after the fill time of the position's open;
  • its timestamp is at most 60 s old when the transaction executes;
  • its price is at or beyond the position's bust price.

Any signed price from the last 60 s that crossed the bust price is enough, even if the price has come back since. The keeper checks every open position against the latest prices every 10 s and liquidates in batches with liquidateMany, which skips a position that cannot be liquidated instead of failing the batch.

The liquidator receives nothing. There is no bounty, because the keeper belongs to the protocol and does not need one; anyone else who liquidates does it at their own gas cost. If the position had a pending close, the close is dropped.

//06_ WHAT A LIQUIDATION DOES

  • The whole margin is lost.
  • If no one is waiting in the queue line, a 2% fee on the margin is distributed and the rest goes to the house's cash. If the queue is open, there is no fee and the margin pays queued winners first.
  • You receive paper on the full margin, fee or not: 10,000 paper for a $100 margin while the house is under $25,000 of net equity.
  • The position's size is released from the market's open interest.

//07_ NIGHTS, WEEKENDS AND GAPS

Bitcoin and Ether trade continuously and can be liquidated at any hour. Equity positions stay open over nights and weekends; they are liquidated when a fresh signed price crosses the bust price, which for an equity means when the oracle publishes a price that has moved that far. If a stock opens far beyond your bust price, you are liquidated at that price, and you still lose the margin and nothing more: a position is isolated, so its loss can never exceed its own margin.

Credits: hands from Michelangelo, The Creation of Adam (detail), public domain, via Wikimedia Commons. Marks of the markets and integrations belong to their owners (sources, credits).