All Collections
Trading
Auto-Deleveraging (ADL)
Auto-Deleveraging (ADL)

Exploring ADL: A Deep Dive into Risk Management on OPNX

Peter avatar
Written by Peter
Updated over a week ago

Cryptocurrency derivatives offer high amounts of leverage and are known to experience substantial price swings. They can also suffer from low levels of liquidity during periods of market stress. As a consequence, there could be instances when liquidations are not processed quickly enough to avert bankruptcy or potential debt to the exchange. In response to such situations, we have a solution in place: Auto-Deleveraging (ADL).

ADL is a risk management mechanism designed to automatically close positions on behalf of bankrupt traders. This is achieved by pairing them with their counterparties, i.e., traders holding the opposite position. Utilized as a last line of defense, ADL serves to protect the entire trading ecosystem from potential losses stemming from derivatives trading.

Identifying an ADL Event

In the event your account is selected for ADL, it will first be locked for a few seconds, preventing you from placing orders or transferring funds. Subsequently, your active orders will be cancelled. Your account will then be unlocked once the ADL process has been completed. To identify ADL trades, look for the trade type “Auto-deleveraging” in your trade history. Alternatively, these can also be located via the API by checking for the source “108”.

ADL is impartially enforced for all traders on the platform, on both the liquidation side and the counterparty side.

ADL Triggers

ADL is initiated when the Liquidation Engine cannot close a trader’s position by trading in the order book. This occurs when a trader’s account meets either of these two conditions:

  1. Maintenance Margin / Collateral Balance > 12.5

  2. Collateral Balance <= 0

When either of these conditions is met, the Liquidation Engine will trigger the ADL process to close the trader’s positions.

ADL Queue Ranking

The initial step of the ADL process involves selecting counterparties to facilitate the liquidation. This is done by ranking "outright" positions based on the following formula and arranging them from highest to lowest.

For PnL Percentage >= 0:

Ranking = PnL Percentage * Margin Ratio

For PnL Percentage < 0:

Ranking = PnL Percentage / Margin Ratio

Where:

  • PnL Percentage = (Mark Value - Avg Entry Value) / Collateral Balance

  • Margin Ratio = Maintenance Margin / Collateral Balance

  • Mark Value = Position Size * Mark Price

  • Avg. Entry Value = Position Size * Average Entry Price

  • Collateral Balance = max(1, collateral balance)

To decrease the likelihood of being an ADL counterparty, you can reduce your maintenance margin or deposit more collateral.

Queue Ranking Example

Consider that Alice is LONG 15 BTC/USD Perp. Below is an example table for ranking SHORT BTC/USD perp positions.

User

Position Size

Avg Entry Price

MarkPrice

PnL (%)

Collateral

Maintenance Margin

Ranking

Bob

-10.00

20,000

18,500

75.00%

20,000

9,250.00

0.3469

Charlie

-20.00

22,000

18,500

77.78%

90,000

18,500.00

0.1598

Dan

-0.25

20,000

18,500

1.01%

37,050

231.25

0.000063

Given the above table of positions and their rankings, Alice’s long 15 BTC position would be closed against Bob and Charlie’s short position. Bob’s entire -10 BTC position would be closed, and Charlie’s position would be reduced by the remaining 5 BTC to -15 BTC.

If there are insufficient outright positions available to close a bankrupt trader, then hedged positions (short BTC perp + holding BTC) are ranked based on their age in descending order, meaning the account with the oldest position is selected first.

ADL Price Calculation

Once the counterparties have been selected the next step is to calculate a fair bankruptcy price for all of a trader’s open positions.

The calculation is performed via the following algorithm for all positions in the trader’s portfolio:

  • Simulated Margin = mark value / active leverage tier

  • Margin Fraction = simulated margin / sum(simulated margin)

  • Margin Weighted Loss = collateral * margin fraction

  • ADL Price = mark price - margin weighted loss / quantity

Price Calculation Example

Consider that Alice’s account has reached -$150 in collateral balance and she holds the following positions:

  • LONG 15 BTC-perp

  • SHORT 200 ETH-perp

Knowing that the BTC Mark Price is $18,500 and the ETH Mark Price is 2,000, the ADL price for both positions can be calculated as follows:

Simulated margin for ETH = (200 * 2000) / 20 = 20,000

Simulated margin for BTC = (15 * 18500) / 10 = 27,750

ETH margin faction = 20,000 / (20,000 + 27,750) = 0.4188

BTC margin fraction = 27,750 / (20,000 + 27,750) = 0.5812

ETH MWL = -150 * 0.4188 = -62.82

BTC MWL = -150 * 0.5812 = -87.18

ETH ADL price = 2,000 + 62.82/ -200 = 1,999.7 (round down by 1 tick because liquidating a short)

BTC ADL Price = 18,500 + 87.18/ 15 = 18,506 (round up by 1 tick because liquidating a long)

In this scenario, with Alice's account reaching a collateral balance of -$150, the calculated ADL prices for liquidation are 1,999.7 for the ETH-perp short position and 18,506 for the BTC-perp long position. These prices reflect a fair bankruptcy price based on Alice's specific portfolio composition.

In summary, Auto-Deleveraging (ADL) is a crucial part of risk management on the OPNX platform. Understanding its mechanics, including triggers, ranking, and price calculation, enables traders to better manage their strategies. Through ADL, OPNX maintains a stable trading environment, protecting individual accounts and the overall ecosystem during volatile market conditions.

Did this answer your question?