Perpetual Futures
Liquidation Liquidation Condition
Once this condition is triggered, the position is ready to be liquidated.
For liquidation formulas, max_lev refers to liquidation leverage, not the opening leverage cap.
Term Value Liquidation leverage 500xMaintenance / liquidation margin 20 bpsLiquidation close fee 0.0012 * Size
Liquidation ⟺ { collateral_size + PNL long − borrow_fee − close_fee ≤ size max_lev , perp long , collateral_size + PNL short − borrow_fee − close_fee ≤ size max_lev , perp short . \text{Liquidation} \iff
\begin{cases}
\text{collateral\_size}+\text{PNL}_{\text{long}}-\text{borrow\_fee}-\text{close\_fee}\;\le\;\dfrac{\text{size}}{\text{max\_lev}}, & \text{perp long},\\
\text{collateral\_size}+\text{PNL}_{\text{short}}-\text{borrow\_fee}-\text{close\_fee}\;\le\;\dfrac{\text{size}}{\text{max\_lev}}, & \text{perp short}.
\end{cases} Liquidation ⟺ ⎩ ⎨ ⎧ collateral_size + PNL long − borrow_fee − close_fee ≤ max_lev size , collateral_size + PNL short − borrow_fee − close_fee ≤ max_lev size , perp long , perp short .
Where:
P N L = { size S 0 ( S 1 − S 0 ) , perp long , size S 0 ( S 0 − S 1 ) , perp short . \mathrm{PNL}=
\begin{cases}
\dfrac{\text{size}}{S_0}\left(S_1-S_0\right), & \text{perp long},\\
\dfrac{\text{size}}{S_0}\left(S_0-S_1\right), & \text{perp short}.
\end{cases} PNL = ⎩ ⎨ ⎧ S 0 size ( S 1 − S 0 ) , S 0 size ( S 0 − S 1 ) , perp long , perp short .
Borrow fees accrue through the relevant custody's cumulative borrow-rate index. They are realized lazily whenever the position is updated, closed, liquidated, has collateral changed, or has TP/SL managed or executed.
Δ borrow_fee = { entry_notional ⋅ ( I TOKEN-current − I position snapshot ) 365 days ⋅ 10,000 , perp long , entry_notional ⋅ ( I USDC-current − I position snapshot ) 365 days ⋅ 10,000 , perp short . \Delta\text{borrow\_fee}=
\begin{cases}
\dfrac{\text{entry\_notional}\cdot\left(I_{\text{TOKEN-current}}-I_{\text{position snapshot}}\right)}
{365\text{ days}\cdot10{,}000}, & \text{perp long},\\
\dfrac{\text{entry\_notional}\cdot\left(I_{\text{USDC-current}}-I_{\text{position snapshot}}\right)}
{365\text{ days}\cdot10{,}000}, & \text{perp short}.
\end{cases} Δ borrow_fee = ⎩ ⎨ ⎧ 365 days ⋅ 10 , 000 entry_notional ⋅ ( I TOKEN-current − I position snapshot ) , 365 days ⋅ 10 , 000 entry_notional ⋅ ( I USDC-current − I position snapshot ) , perp long , perp short .
I is the custody cumulative borrow-rate index. A long perp uses the underlying custody index. A short perp uses the USDC custody index. The position stores its last index snapshot, and every accrual charges only the delta since that snapshot.
Liquidation Price
P liq = { price − ( collateral_size − close_fee − borrow_fee − size max_lev ) price size , perp long , price + ( collateral_size − close_fee − borrow_fee − size max_lev ) price size , perp short . P_{\text{liq}}=
\begin{cases}
\text{price}-\dfrac{\left(\text{collateral\_size}-\text{close\_fee}-\text{borrow\_fee}-\dfrac{\text{size}}{\text{max\_lev}}\right)\;\text{price}}{\text{size}}, & \text{perp long},\\
\text{price}+\dfrac{\left(\text{collateral\_size}-\text{close\_fee}-\text{borrow\_fee}-\dfrac{\text{size}}{\text{max\_lev}}\right)\;\text{price}}{\text{size}}, & \text{perp short}.
\end{cases} P liq = ⎩ ⎨ ⎧ price − size ( collateral_size − close_fee − borrow_fee − max_lev size ) price , price + size ( collateral_size − close_fee − borrow_fee − max_lev size ) price , perp long , perp short .
In this case price is the oracle price of the token.