Calculating Liquidation

This page describes how liquidation trade parameters are calculated by a liquidator

The Challenge

When an account appears in margin call state, a liquidation trade could be initiated by a liquidator. Such trade has several important restrictions, so the liquidator needs to calculate peroper trade parameters in order to make the protocol not to reject the trade.

No Write-off Case

In this section a normal, i.e. no write-off, liquidation is considered.

Let's assume that the j-thj\text{-th} account is in margin call state, its position in the i1-thi_1\text{-th} asset is long, and its position in the i2-thi_2\text{-th} asset is short:

μj<0vi1,j>0vi2,j<0\begin{array}{rcl} \mu_j & < & 0 \\ v_{i_1,j} & > & 0 \\ v_{i_2, j} & < & 0 \end{array}

During the liquidation trade, the liquidator sells the xi1x_{i_1} amount of the i!-thi_!\text{-th} asset for the xi2x_{i_2}amount of the i2-thi_2\text{-th} asset.

Here a no write-off case is considered:

pi1xi1νj+(1ϕb)pi2xi2νj\frac{p_{i_1}x_{i_1}}{\nu^+_j} \leqslant \frac{(1 - \phi_b)p_{i_2}x_{i_2}}{\nu^-_j}

The trade price pp is:

p=xi2(1ϕs)xi1pi1pi2p = \frac{x_{i_2}}{(1 - \phi_s)x_{i_1}} \approx \frac{p_{i_1}}{p_{i_2}}

The approximation sign is here, because the asset prices pi1p_{i_1}and pi2p_{i_2} are obtained from price oracles and may be slightly differ from the actual market prices. Thus:

xi2(1ϕs)pi1xi1pi2x_{i_2} \approx \frac{(1 - \phi_s)p_{i_1}x_{i_1}}{p_{i_2}}

The liquidation trade is restricted by the following constraints:

vi1,j=vi1,jxi10vi2,j=vi2,j+(1ϕb)xi20μj=μjpi1xi11+mi1+(1+mi2)(1ϕb)pi2xi20\begin{array}{rcccl} v'_{i_1,j} & = & v_{i_1,j} - x_{i_1} & \geqslant & 0 \\[1em] v'_{i_2,j} & = & v_{i_2,j} + (1 - \phi_b)x_{i_2} & \leqslant & 0 \\[1em] \mu'_j & = & \mu_j - \frac{p_{i_1} x_{i_1}}{1 + m_{i_1}} + (1 + m_{i_2})(1 - \phi_b)p_{i_2} x_{i_2} & \leqslant & 0 \end{array}

By substituting the approximated expression for xi2x_{i_2}we have:

vi1,jxi10vi2,j+(1ϕb)(1ϕs)pi1xi1pi20μjpi1xi11+mi1+(1+mi2)(1ϕb)pi2(1ϕs)pi1xi1pi20\begin{array}{rcl} v_{i_1,j} - x_{i_1} & \geqslant & 0 \\[1em] v_{i_2,j} + (1 - \phi_b)\frac{(1 - \phi_s)p_{i_1}x_{i_1}}{p_{i_2}} & \lesssim & 0 \\[1em] \mu_j - \frac{p_{i_1} x_{i_1}}{1 + m_{i_1}} + (1 + m_{i_2})(1 - \phi_b)p_{i_2} \frac{(1 - \phi_s)p_{i_1}x_{i_1}}{p_{i_2}} & \lesssim & 0 \end{array}

and then:

xi1vi1,jxi1pi2vi2,j(1ϕs)(1ϕb)pi1xi1(1+mi1)μjpi1(1(1+mi1)(1+mi2)(1ϕs)(1ϕb))\begin{array}{rcl} x_{i_1} & \leqslant & v_{i_1,j} \\[1em] x_{i_1} & \lesssim & \frac{-p_{i_2}v_{i_2,j}}{(1 - \phi_s)(1 - \phi_b)p_{i_1}} \\[1em] x_{i_1} & \lesssim & \frac{(1 + m_{i_1})\mu_j}{p_{i_1}\left( 1 - (1 + m_{i_1})(1 + m_{i_2})(1 - \phi_s)(1 - \phi_b) \right)} \end{array}

In order to satisfy these requirements, the liquidator chooses the xi1x_{i_1}value like this:

xi1=min(vi1,j,(1ε)pi2vi2,j(1ϕs)(1ϕb)pi1,(1δ)(1+mi1)μjpi1(1(1+mi1)(1+mi2)(1ϕs)(1ϕb)))x_{i_1} = \min \left( v_{i_1,j}, \frac{-(1 - \varepsilon)p_{i_2}v_{i_2,j}}{(1 - \phi_s)(1 - \phi_b)p_{i_1}}, \frac{(1 - \delta)(1 + m_{i_1})\mu_j}{p_{i_1} \left( 1 - (1 + m_{i_1})(1 + m_{i_2}) (1 - \phi_s)(1 - \phi_b) \right)} \right)

Here ε\varepsilon and δ\deltaare small positive numbers, empirically chosen to address imperfection of the asset prices obtained from price oracles.

Write-off Case

In this case a write-off case is considered:

pi1xi1νj+>(1ϕb)pi2xi2νj\frac{p_{i_1}x_{i_1}}{\nu^+_j} > \frac{(1 - \phi_b)p_{i_2}x_{i_2}}{\nu^-_j}

In such case the constraits are:

vi1,j=vi1,jxi10vi2,j=vi2,j+pi1xi1νjpi2νj+0μj=μjpi1xi11+mi1+(1+mi2)pi1xi1νjνj+0\begin{array}{rcccl} v'_{i_1,j} & = & v_{i_1,j} - x_{i_1} & \geqslant & 0 \\[1em] v'_{i_2,j} & = & v_{i_2,j} + \frac{p_{i_1}x_{i_1}\nu^-_j}{p_{i_2}\nu^+_{j}} & \leqslant & 0 \\[1em] \mu'_j & = & \mu_j - \frac{p_{i_1} x_{i_1}}{1 + m_{i_1}} + (1 + m_{i_2}) \frac{p_{i_1}x_{i_1}\nu^-_j}{\nu^+_{j}} & \leqslant & 0 \end{array}

And then:

xi1vi1,jxi1pi2vi2,jνj+pi1νjxi1(1+mi1)μjνj+pi1(νj+(1+mi1)(1+mi2)νj)\begin{array}{rcl} x_{i_1} & \leqslant & v_{i_1,j} \\[1em] x_{i_1} & \leqslant & \frac{-p_{i_2}v_{i_2,j}\nu^+_{j}}{p_{i_1}\nu^-_j} \\[1em] x_{i_1} & \leqslant & \frac{(1 + m_{i_1})\mu_j\nu^+_{j}}{p_{i_1} \left( \nu^+_{j} - (1 + m_{i_1})(1 + m_{i_2}) \nu^-_j \right)} \end{array}

So the liquidator choses the xi1x_{i_1}amout like this:

xi1=min(vi1,j,pi2vi2,jνj+pi1νj,(1+mi1)μjνj+pi1(νj+(1+mi1)(1+mi2)νj))x_{i_1} = \min \left( v_{i_1,j}, \frac{-p_{i_2}v_{i_2,j}\nu^+_{j}}{p_{i_1}\nu^-_j}, \frac{(1 + m_{i_1})\mu_j\nu^+_{j}}{p_{i_1} \left( \nu^+_{j} - (1 + m_{i_1})(1 + m_{i_2}) \nu^-_j \right)} \right)

Last updated