Hyperliquid Liquidation

An explanation of liquidation process in HyperLiquid.

Overview

  • A liqiuidation event occurs when a trader's position move against them to the point where the account equity falls below the maintenance margin.
  • The maintenance margin is half of the initial margin at max leverage, which varies from 3-40x.
  • In other words, the maintenance margin is between 1.25% (for 40x max leverage assets) and 16.7% (for 3x max leverage assets) depending on the asset.

  • Lets take an example to understand the margin requirements.
  • Initial Margin -> The percentage of the position's total value you must provide as collateral to open a leveraged trade.
    • At max leverage, it is calculated as 1leverage\frac{1}{\text{leverage}}.
    • For example,
      • 3x leverage -> Initial Margin = 13=33.33%\frac{1}{3} = 33.33\%
      • 40x leverage -> Initial Margin = 140=2.5%\frac{1}{40} = 2.5\%
  • Maintenance Margin -> The minimum equity (collateral value) you must maintain to keep the position open. For example,
    • 3x leverage -> Initial Margin2=33.33%2=16.67%\frac{\text{Initial Margin}}{2} = \frac{33.33\%}{2} = 16.67\%
    • 40x leverage -> Initial Margin2=2.5%2=1.25%\frac{\text{Initial Margin}}{2} = \frac{2.5\%}{2} = 1.25\%
  • Liquidation event occurs when your account equity (collateral minus losses) drops below the maintenance margin. The position is closed to prevent further losses exceeding your collateral.

  • Below is a table summarizing some examples of liquidation events.
Parameter Value Description
Asset Bitcoin (BTC) The cryptocurrency being traded.
Initial BTC Price $50,000 The price of BTC when the position is opened.
Position Size $10,000 (0.2 BTC) The total value of the position you control with leverage.
Max Leverage 10x The maximum leverage allowed for this trade.
Initial Margin 10% ($1,000) The percentage of position size you must provide as collateral (1/leverage).
Maintenance Margin 5% ($500) The minimum equity required to keep the position open (half of initial margin).
Collateral Deposited $1,000 The amount you deposit to open the position.
Borrowed Amount $9,000 The amount borrowed from the platform to achieve the $10,000 position.
Liquidation Price $47,500 The BTC price where equity equals the maintenance margin.
Equity at $47,500 $500 Collateral minus loss at liquidation price (position value = $9,500).
Equity at $47,400 $480 Equity drops below maintenance margin, triggering liquidation.
Loss at $47,400 $520 Unrealized loss when BTC price drops to $47,400 (position value = $9,480).
  • Asset (Bitcoin):

    • The example uses BTC as the traded asset, a common choice on decentralized exchanges (DEXs) offering leveraged trading.
  • Initial BTC Price ($50,000):

    • This is the starting price when you open the position. All calculations are based on this reference point.
  • Position Size ($10,000, 0.2 BTC):

    • You control $10,000 worth of BTC (0.2 BTC at $50,000 per BTC) using leverage, far exceeding your $1,000 collateral.
  • Max Leverage (10x):

    • With 10x leverage, you can control a position 10 times your collateral. Here, $1,000 controls $10,000.
  • Initial Margin (10%, $1,000):

    • Calculated as 1 / leverage = 1 / 10 = 10%. You need 1,000ofyourownmoneytoopena1,000 of your own money to open a 10,000 position.
  • Maintenance Margin (5%, $500):

    • Half of the initial margin (per your definition), or 5% of the position size. Your equity must stay above $500 to avoid liquidation.
  • Collateral Deposited ($1,000):

    • Your upfront investment. It’s equal to the initial margin here, assuming you’re using max leverage without extra buffer.
  • Borrowed Amount ($9,000):

    • The difference between the position size and your collateral (10,00010,000 - 1,000). This is what you owe the platform or liquidity pool.
  • Liquidation Price ($47,500):

    • The BTC price where your equity hits the maintenance margin. A 5% drop ($2,500) from $50,000 reduces the position value to $9,500, with a $500 loss, leaving equity at $500.
  • Equity at $47,500 ($500):

    • Equity = Collateral - Loss = $1,000 - $500. This is the tipping point; any further drop triggers liquidation.
  • Equity at $47,400 ($480):

    • At $47,400, position value = $9,480, loss = $520, equity = $1,000 - $520 = $480. Since $480 < $500, liquidation occurs.
  • Loss at $47,400 ($520):

    • The unrealized loss when BTC drops to $47,400. It’s the difference between the original position value ($10,000) and the new value ($9,480).
  • You start with $1,000 to control $10,000 (10x leverage).

  • If BTC drops 5% to $47,500, your equity barely meets the maintenance margin ($500).

  • A slightly larger drop to $47,400 (5.2%) pushes equity below $500, and the DEX’s smart contract liquidates your position, selling your 0.2 BTC to repay the $9,000 loan, leaving you with $480 (minus fees).


  • When the account equity drops below 2/3 of the maintenance margin without successful liquidation through the book, a backstop liquidation happens through the liquidator vault.
  • When a cross position is backstop liquidated, the trader's cross positions and cross margin are all transferred to the liquidator.
  • The user's cross margin and positions are untouched.
  • During backstoop liquidation, the maintenance margin is not returned to the user.
  • This is because the liquidator vault requires a buffer to make sure backstop liquidations are profitable on average.
  • In order to avoid losing maintenance margin, traders can place stop loss orders or exit the positions before the mark price reaches the liquidation price.
  • Liquidations use the mark price, which combines external CEX prices with Hyperliquid's book state.
  • This makes liquidations more robust than using a single instantaneous price.
  • During times of high volatility, or on highly leveraged positions, mark price may be significantly different from the book price.
  • It is recommended to use the exact forumula for precise monitoring of liquidations.

Motivation

  • As described above, the majority of liquidations on Hyperliquid are sent directly to the ordere book.
  • This allows all users to compete for the liquidation flow, and allows liquidated user to keep any remaining margin.
  • Unlike CEXs there is no clearance fee on liquidations.
  • The resulting system is transparent and prioritizes retiainig as much capital as possible for liquidated user.

Partial Liquidations

  • For liquidatable positions larger than 100K USDC, only 20% of the position will be sent as market liquidation order to the book.
  • After a block where any position of a user is partially liquidated, there is a cooldown period of 30 seconds.
  • During this cooldown period, all market liquidation orders for user will be for the entire position.

Liquidator Vault

  • Backstop liquidations on Hyperliquid are democratized through the liquidator vault, which is a component strategy of HLP.
  • Positions that are below 2/3 of the maintenance margin can be taken over by the liquidator vault.
  • On average, backstop liquidations are profitable for the liquidator.
  • On most venues this profit goes to the exchange operator or privileged market makers who internalize the flow.
  • On Hyperliquid, the pnl stream from liquidations go entirely to the community through HLP.

Computing Liquidation Price

  • When entering a trade, an estimated liquidation price is shown.
  • This estimation may be inaccurate compared to the position's estimated liquidation price due to changing liquidatiy on the book.

  • Once a position is opened, a liquidation price is shown.
  • This price has the certainty of the entry price, but still may not be the actual liquidation price due to funding payments or changes in unrealized pnl in other positions.
  • The actual liquidation price is independent on the leverage set for cross margin positions.
  • A cross margin position at lower leverage simply uses more collateral.
  • The actual liquidation price is independent of the leverage set for cross margin positions.
  • A cross margin position at lower leverage simply uses more collateral.