> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roxom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ADL Execution Process

> Learn how ADL sequentially closes profitable opposing positions at Mark Price to cover liquidation shortfalls.

**Process of Deleveraging:** When Auto-Deleveraging (ADL) activates, the system begins reducing positions of the highest-ranked traders on the *opposite side of the market*, meaning traders who are currently profitable relative to the liquidating position. Positions are reduced **sequentially**, one trader at a time, until the shortfall has been fully resolved.

## 1. When ADL triggers

ADL only activates under exceptional conditions:

* A position has been liquidated
* The system cannot close it at the bankruptcy price
* The insurance fund is insufficient to absorb the remaining loss

In these rare cases, the system must redistribute risk by closing profitable positions on the opposite side.

## 2. How traders are ranked

Every open position receives two metrics:

* **ADL Score**: based on the trader's *profitability* and *effective leverage*
* **ADL Rank (0-5)**: shown in the UI as 5 lights (0 = safest, 5 = most likely to be deleveraged)

A dedicated ranking job continuously:

1. Computes ADL scores per instrument
2. Sorts all positions by their score
3. Assigns ranks, from lowest-risk to highest-risk

The traders at the top of this ranking are the first candidates for ADL.

## 3. How the deleveraging process works

Once ADL begins, the system processes profitable opposite-side positions **in order of highest ADL score**.

### Step 1: Target identification

* The system selects positions in the **same instrument** and **opposite direction**
* Positions are ordered from highest ADL score to lowest
* The top-ranked trader becomes the first ADL target

### Step 2: Sequential reduction

Starting with the highest-ranked position:

* Roxom creates a special **AutoDeleverage (ADL) order**
* This order closes part or all of the trader's position
* Execution happens **instantly at the current Mark Price**
* There is **no slippage** and **no fees**
* The impacted position temporarily enters `Status::ADL`

### Step 3: Position-by-position processing

For each trader in the queue:

1. **First Trader:**\
   The system closes as much of their position as needed to cover part of the shortfall.
2. **If shortfall remains:**\
   Move to the next trader based on ADL ranking.
3. **Continue:**\
   The process repeats down the list, closing portions of profitable positions until the entire deficit is eliminated.
4. **Notifications:**\
   Each affected trader receives an ADL execution notification.

### Step 4: Completion

* Once the total shortfall has been fully absorbed, ADL stops immediately
* No further positions are touched
* All remaining positions return to normal status
