# TLDR

We propose a convex optimization approach for determining the optimal liquidation order in cross-margined AMM-based exchanges, minimizing the negative impact on exchange solvency.

# Motivation

Liquidation is crucial in maintaining an exchange’s solvency. In cross-margined exchanges, determining the optimal combination of liquidation orders can be complex. Current permissionless liquidation mechanisms in a competitive setting may not be ideal for AMM-based protocols.

# Problem Formalization

We simplify the problem with these assumptions:
1. Liquidations in the context of a risk-indifferent AMM
2. Liquidations are atomic operations executing at uniform prices within a block
3. No liquidation penalties or fees

We define an optimal liquidation order as the minimizer of the total notional amount liquidated while satisfying the maintenance margin and the risk-indifference invariant. We represent the liquidation of a portfolio as a convex optimization problem:

\begin{align*} \min_\mathbf{w}. \quad &(\mathbf{p} \otimes |\mathbf{q}_i|)^T \mathbf{w} \\ \text{subject to} \quad &\mathbf{0} \preceq \mathbf{w} \preceq \mathbf{1} \\ & (r + \epsilon)(\mathbf{p}\otimes|\mathbf{q}_i|)^T(\mathbf{1} - \mathbf{w}) \leq c_i - \pi + \mathbf{q}_i^T(\mathbf{p} - \mathbf{p}_{i}) \\ &\pi = \rho(X(\mathbf{q}-\mathbf{w}\otimes \mathbf{q}_i))-\rho(X(\mathbf{q})) \end{align*}

See the full write-up here for more details on the notation.

In words, the problem solves for an optimal partial liquidation for each position such that the portfolio’s margin post-liquidation (RHS of the second constraint) is at least the maintenance margin determined by total notional size post-liquidation (LHS of the second constraint). Note that if the problem is infeasible, the portfolio will be fully liquidated.

# Simulations

We use entropic value-at-risk with a confidence level of 0.99 and assume the price vector follows a normal distribution. We use GO-GARCH to forecast the covariance matrix. See our simulation code here.

# Future Research

We can extend the framework to include liquidation penalties, although it may lead to more infeasible solutions and full liquidations.

# Questions

1. What alternative objectives could better reflect the needs for specific protocols?
2. Are there reward mechanisms that incentivize optimal liquidations in a decentralized setting (e.g. liquidation reward is maximized as the distance between the liquidation strategy and an optimal liquidation strategy is minimized)?
1 Like

Hi team. I have had a chance to read this research. But there is one thing I confuse is that liquidation is a process that only happens in lending and borrowing protocol when a borrower’s debt value lower than her collateral value.
At the beginning of the research, it states “Liquidation is crucial in maintaining an exchange’s solvency” which seems confusing. I hope you guys take a little time to clarify. Thanks

We are considering AMM for derivatives, in particular perpetual futures. Since we allow traders to trade with leverage, there are certain scenarios in which large price change can cause the trader to have bad debt (unrealized loss > collateral), leading to the loss for AMM since such debt is usually covered by insurance fund. To prevent this, we want to have some maintenance margin requirement where once the margin ratio goes below the threshold, liquidation of perp position is triggered.
Hope this clarifies!

1 Like