Bluefin
  • Bluefin Exchange
    • Introduction
    • Roadmap
    • Getting Started
      • Onboarding
      • Depositing & Set Up
      • Tutorials
      • Perpetual Swaps
    • Trading
      • Order Types
        • TP/SL Orders
      • Orderbook Design
      • Isolated Margining
      • PnL Calculation
      • Oracle and Index Price
      • Risk Engine
        • Liquidation Process
        • Insurance Fund
        • ADL
      • Funding
      • Trading Fees
      • Gas Fees
      • Contract Specs
    • Perps API Docs
    • Pre-Launch Markets
  • Bluefin Spot CLMM
    • Introduction
    • Getting Started
    • Protocol Features
      • Swap
        • Limit Orders
      • Liquidity Pools
    • BluefinX
    • Tutorials
      • Exploring the Pools
      • Adding Liquidity (Creating a Position)
      • Managing a Position and Claiming Fees/Rewards
      • Auto-Rebalancing
      • Swapping
      • Placing Limit Orders
      • Switching from Spot to Perps Account
    • Spot API Docs
    • FAQs
  • Lending on Bluefin
    • Introduction
    • Protocol Features
    • Tutorials
      • Supply and Borrow Assets
  • Bluefin Airdrop
    • Bluefin Airdrop Explained
    • Bluefin Foundation Statement
    • Claiming and Rewards Post-TGE
    • FAQs
  • Users
    • Rewards
      • Trading Rewards
      • Bluefin Vaults
      • Leagues
      • Sui Wallet on Mobile Giveaway
      • Sui Wallet Campaign
        • List of Winners
      • Walrus Campaigns
        • Walrus LP & Trading Competition
        • Walrus Trade & Earn Campaign
  • Other
    • BLUE Token
    • On-Ramping directly to Bluefin
    • Security
      • Code Audits
      • Spot Audits
    • Governance
      • Bluefin DAO
    • Bluefin Vanguard Ambassador Program
    • Terms of Use and Privacy Policy
      • Vulnerability Disclosure Policy
      • Wash Trading
      • Address Screening
      • Risk Information
    • FAQs
      • USD vs USDC
Powered by GitBook
On this page
  1. Bluefin Exchange
  2. Trading
  3. Risk Engine

ADL

PreviousInsurance FundNextFunding

Last updated 1 year ago

Auto-deleveraging (ADL) is the last line of defense employed by the risk engine to protect the solvency of markets. It kicks in when a position cannot be closed above the bankruptcy price and the insurance fund is insufficient to cover the capital shortfall. On Bluefin, a permissioned ADL worker automatically deleverages bankrupt positions against top-of-queue positions from the opposite side. The ADL queue prioritizes closing the most profitable and high-leverage traders to reduce counterparty risk.

ADL Queue

The objective of the ADL queue is to pick out accounts with the highest PnL percentage and leverage. For each market, iii be the individual position for which the ADL Score is calculated.

PNL Scorei={Pindex/oracle−PposPposif Long, −(Pindex/oracle−Ppos)Pposif Short.\text{PNL Score}_i = \begin{cases} \frac{ P_{index/oracle}-P_{pos} }{P_{pos}} \quad &\text{if Long}, \\\ \frac{-( P_{index/oracle}-P_{pos}) }{P_{pos}} \quad &\text{if Short}.\end{cases}PNL Scorei​={Ppos​Pindex/oracle​−Ppos​​ Ppos​−(Pindex/oracle​−Ppos​)​​if Long,if Short.​

PNL Scorei=max⁡(0,PNL Scorei)\text{PNL Score}_i = \max (0, \text{PNL Score}_i)PNL Scorei​=max(0,PNL Scorei​)

Leverage Scorei=1/max(MMR,MR)\text{Leverage Score}_i = 1/\text{max}(\text{MMR},\text{MR})Leverage Scorei​=1/max(MMR,MR)

ADL Scorei=PNL Scorei×Leverage Scorei\text{ADL Score}_i = \text{PNL Score}_i \times \text{Leverage Score}_iADL Scorei​=PNL Scorei​×Leverage Scorei​

ADL Quantile=rank(user.ADL Scorei)/Total User Count\text{ADL Quantile} = rank(user.\text{ADL Score}_i)/\text{Total User Count}ADL Quantile=rank(user.ADL Scorei​)/Total User Count