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, i be the individual position for which the ADL Score is calculated.
PNL Scorei={PposPindex/oracle−Ppos Ppos−(Pindex/oracle−Ppos)if Long,if Short.
PNL Scorei=max(0,PNL Scorei)
Leverage Scorei=1/max(MMR,MR)
ADL Scorei=PNL Scorei×Leverage Scorei
ADL Quantile=rank(user.ADL Scorei)/Total User Count