For liquidation and stability purposes, the mark price used for calculating margin fractions and liquidation thresholds will be the index price of the underlying for perpetual futures. This is to protect traders against large liquidation cascades or liquidity shortages.

Partial Liquidation Process

The partial liquidation process will only liquidate the trader until they are back above the margin requirements. This is different from full liquidations, where trader's entire position and collateral is liquidated against the book, which is both unfavourable for traders, and can lead to market instability.
Anyone can run a liquidator bot and earn liquidation rewards.
Here are example implementations of liquidator bots: - Rust: - TypeScript:โ€‹

If liquidatee OMF < CMFโ€‹

  • Open orders will be cancelled per market until there are no more orders to cancel, or when the MF is no longer below the CMF

If liquidatee MF < MMFโ€‹

  • Liquidatee's perp positions or spot positions will be liquidated based on notional size, until the liquidatee's MF is back above the MMF
  • Perp position liquidations will reduce the trader's position, and charge a liquidation fee
  • Spot position liquidations will reduce a borrower's debt, by liquidating a positive supply collateral (chosen by the liquidator). The liquidatee also incurs a liquidation fee.
  • Liquidation fee is taken from the change in quote such that
    ฮดQuote=ฮดBaseร—priceร—(1ยฑliqFee)\delta Quote = \delta Base \times price \times (1 \pm liqFee)
    liqFee=liqFeemarketliqFee = liqFee_{market}
    for perp positions and
    liqFee=1+liqFeeborrowed1โˆ’liqFeetakenโˆ’1liqFee = \frac{1+liqFee_{borrowed}}{1-liqFee_{taken}} - 1
    for spot


If liquidatee's total account value is negative, and all orders are cancelled, all positions closed, and no collateral above dust threshold, then liquidatee is in bankruptcy.
  • The net negative debt will be transferred from liquidatee to liquidator
  • The value of the negative debt in USD, plus liquidation fee, will then be transferred from the insurance fund to the liquidator to compensate
  • If the insurance fund is depleted, the loss will be socialized among all USDC depositors from their supply APY