💣Case Studies - Liquidation

Examples and calculations

To help users better understand the cause and process of liquidation, we've prepared two sets of examples, one with a single position and the other one with multiple open positions. In both examples, we further list down all possible cases when liquidation is triggered.

General setting:

Alex deposits 1,000 USDC into Symmetry Trade and wants to open positions. The oracle price of BTC is $25,000 and the oracle price of ETH is $2,000 now.

Case 1: Single Open Position

Alex opens +0.2 BTCUSDC position at the execution price of $25,200, Keeperfeemin=$1Keeperfee_{min} = \$1, UserInputfee=$10UserInputfee = \$10, trading fee rate 0.1%. Minimum margin deposit $50.

Scene 1: BTC Oracle price drops from $25,000 to $24,000, Funding = $-20, .

Now,

Keeper fee is $10.

Alex PnL is 0.2×(24,00025,200×(1+0.1%))10=$255.040.2 \times (24,000-25,200 \times (1+0.1\%))-10 = \$-255.04.

Margin balance is 1000255.0420=$724.961000-255.04-20=\$724.96.

Available margin is 724.960.2×24,0002550=$482.96724.96-\frac {0.2 \times 24,000} {25} -50=\$ 482.96.

Buying power is (482.96+50)×25=$13,324(482.96+50)\times 25 = \$13,324.

Maintenance margin is 0.2×24,000×2%=$960.2 \times 24,000 \times 2\% = \$96.

Maintenance margin ratio is 724.9696=7.55>1\frac {724.96} {96}=7.55 > 1.

Scene 2: BTC Oracle price drops from $25,000 to $20,500, $Funding = $50, FinancialCosts=$0\sum FinancialCosts = \$0.

Now,

Alex PnL is 0.2×(20,50025,200×(1+0.1%))10=$955.040.2 \times (20,500-25,200\times (1+0.1\%)) -10= \$-955.04.

Margin balance is 1000955.04+50=$94.961000-955.04+50=\$94.96.

94.960.2×20,5002550<094.96-\frac {0.2 \times 20,500} {25}-50<0, therefore available margin is 0, trader could not withdraw any money.

Buying power is 0.

Maintenance margin is 0.2×20,500×2%=$820.2 \times 20,500 \times 2\% = \$82.

Maintenance margin ratio is 94.9682=1.16>1\frac {94.96} {82}=1.16 > 1.

Scene 3: BTC Oracle price drops from $25,000 to $20,500, Funding = $30, FinancialCosts=$0\sum FinancialCosts = \$0.

Now,

Alex PnL is 0.2×(20,50025,200×(1+0.1%))10=$955.040.2 \times (20,500-25,200\times (1+0.1\%)) -10= \$-955.04.

Margin balance is 1000955.04+30=$74.961000-955.04+30=\$74.96.

74.960.2×20,5002550<074.96-\frac {0.2 \times 20,500} {25}-50<0, therefore available margin is 0, trader could not withdraw any money.

Buying power is 0.

Maintenance margin is 0.2 \times 20,500 \times 2\% = \$82.

Maintenance margin ratio is 74.9682=0.91<1\frac {74.96} {82}=0.91 <1.

Out of the three possibilities listed above, Scene 3 would trigger the liquidation process. For the process, we have four different scenarios, categorized by the price at which all BTC/USDC positions are closed:

Then,

Liquidation keeper fee is 0.2×20,500×0.35%=$14.35<$10000.2 \times 20,500 \times 0.35\% = \$14.35<\$1000 .

Alex PnL is 0.2×(20,450×(10.1%)25,200×(1+0.1%))1014.35=$983.480.2 \times (20,450\times (1-0.1\%)-25,200\times (1+0.1\%))-10-14.35 = \$-983.48.

Margin balance is 1000983.48+30=$46.521000-983.48+30=\$46.52.

Penalty fee is 0.2×20,500×1%=$410.2 \times 20,500 \times 1\% =\$41.

User asset is 46.5241=$5.52.46.52 -41 = \$5.52. $5.52\$5.52 will be returned to user.

Case 2: Multiple Open Positions

Alex opens +0.2 BTC/USDC position at the execution price of $25,200 and opens -2 ETH/USDC position at the execution price of $1,990. For each trade, Keeperfeemin=$1Keeperfee_{min} = \$1, UserInputfee=$10UserInputfee = \$10. Trading fee rate 0.1\%. Minimum margin deposit $50.

Scene 1: BTC Oracle price drops from $25,000 to $24,000, and ETH Oracle price drops from $2,000 to $1,900, Funding=$50\sum Funding = \$-50, FinancialCosts=$0\sum FinancialCosts = \$0.

Now,

Alex PnL is 0.2×(24,00025,200×(1+0.1%))2×(1,9001,990×(10.1%))20=$89.020.2 \times (24,000-25,200\times (1+0.1\%)) - 2 \times(1,900-1,990\times (1-0.1\%))-20 = \$-89.02

Margin balance is 100089.0250=$860.981000-89.02-50=\$860.98.

Available margin is 860.980.2×24,000+2×1,9002550=$466.98860.98-\frac {0.2 \times 24,000+2 \times 1,900} {25}-50=\$ 466.98.

Buying power is (466.98+50)×25=$12,924.5(466.98+50)\times 25 = \$12,924.5.

Maintenance margin is (0.2×24,000+2×1,900)×2%=$172(0.2 \times 24,000 + 2 \times 1,900) \times 2\% = \$172.

Maintenance margin ratio is 860.98172=5.0>1\frac {860.98} {172}=5.0 > 1

Scene 2: BTC Oracle price drops from $25,000 to $24,000, and ETH Oracle price increases from $2,000 to $2,300, Funding=$70\sum Funding = \$70, FinancialCosts=$0\sum FinancialCosts = \$0.

Now,

Alex PnL is 0.2×(24,00025,200×(1+0.1%))2×(2,3001,990×(10.1%))20=$889.020.2 \times (24,000-25,200\times (1+0.1\%)) - 2 \times(2,300-1,990\times (1-0.1\%)) -20= \$-889.02

Margin balance is 1000889.02+70=$180.981000-889.02+70=\$180.98.

180.980.2×24,000+2×2,3002550<0180.98-\frac {0.2 \times 24,000+2 \times 2,300} {25}-50<0, therefore available margin is 0, trader could not withdraw any money.

Buying power is 0.

Maintenance margin is (0.2×24,000+2,300×2)×2%=$188(0.2 \times 24,000 + 2,300 \times 2) \times 2\% = \$188.

Maintenance margin ratio is 180.98188=0.96<1\frac {180.98} {188}=0.96 < 1.

Out of the two possibilities listed above, Scene 2 would trigger the liquidation process. For the process, we have two different scenarios, categorized by the price at which all BTC/USDC positions are closed (as BTC/USDC would be the first position to close, ETH/USDC follows):

Then,

Liquidation keeper fee is 0.2×24,000×0.35%=$16.8<$10000.2 \times 24,000 \times 0.35\% = \$16.8<\$1000.

Alex PnL is 0.2×(24,000×(10.1%)25,200×(1+0.1%))2×(2,3001,990×(10.1%))2016.8=$910.620.2 \times (24,000\times (1-0.1\%)-25,200\times (1+0.1\%)) - 2 \times(2,300-1,990\times (1-0.1\%)) -20 -16.8= \$-910.62

Penalty fee is 0.2×24,000×1%=$480.2 \times 24,000 \times 1\% =\$48.

Margin balance is 1000910.62+7048=$111.381000-910.62+70 -48 = \$111.38.

Maintenance margin is 2×2,300×2%=$922 \times 2,300 \times 2\% = \$92.

Maintenance margin ratio is now 111.3892=1.21>1\frac {111.38} {92}=1.21 > 1 .

No need to further liquidate the ETH/USDC positions now.

Last updated