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.
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 FormalizationWe simplify the problem with these assumptions:
- Liquidations in the context of a risk-indifferent AMM
- Liquidations are atomic operations executing at uniform prices within a block
- 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:
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.
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.
We can extend the framework to include liquidation penalties, although it may lead to more infeasible solutions and full liquidations.
- What alternative objectives could better reflect the needs for specific protocols?
- 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)?