My note about AMM Impermanent Loss

Impermanent loss occurs when the value of assets held in an Automated Market Maker (AMM) liquidity pool diverges from the value those assets would have if they were simply held outside of the pool. This loss is called “impermanent” because it only becomes permanent if the liquidity provider withdraws their assets from the pool when there is a significant price divergence. If the prices return to their original state, the loss may diminish.

Let’s walk through a detailed example to illustrate impermanent loss.

Step 1: Initial Deposit

  • The LP deposits 1 ETH (worth $1000) and 1000 USDT into the pool.
  • The total value of the deposit is $2000.
  • The pool has 10 ETH and 10,000 USDT after the deposit, maintaining a ratio of 1:1000.

Step 2: Price Change

  • The price of ETH doubles from $1000 to $2000.
  • The pool must rebalance to maintain the constant product.

Step 3: Pool Rebalancing

  • New ratio: The pool still maintains the constant product formula $x⋅y=k$. With the new ETH price, the quantities of ETH and USDT adjust.
  • New pool composition: Let’s calculate the new balances in the pool. Suppose the pool now has 7.07 ETH (since ETH price doubled) and 14,142 USDT (because the total value of the pool remains constant at $20,000).

Step 4: Withdrawal

  • If the LP decides to withdraw their liquidity, they get back a proportional share of the pool.
  • Since the pool has rebalanced, the LP’s share (10% of the pool) now consists of 0.707 ETH and 1414.2 USDT.
  • The total value of the LP’s withdrawal is $0.707×2000+1414.2=1414+1414.2=2828.2$

Step 5: Compare with Holding

  • If the LP had simply held onto their original assets (1 ETH and 1000 USDT), their total value would be $1×2000+1000=3000$.
  • The impermanent loss is the difference between the value of holding the assets and the value of withdrawing from the pool: $3000−2828.2=171.8$.

To prove impermanent loss mathematically, we need to compare the value of assets held in an Automated Market Maker (AMM) liquidity pool with the value of simply holding the assets outside the pool, after a price change. Let’s go through the steps and use some algebra to demonstrate impermanent loss

Assume a liquidity provider (LP) deposits 2 assets A and B into a liquidity pool constant k with the initial amount x0,y0 accordingly, then:

x0×y0=k

The total value of the deposit is V0. Let’s say the initial price of asset A in terms of asset B is p0, then:

p0=y0x0

Suppose the price of asset A changes relative to B. Let the new price of A be p_1, then:

p1=y1x1

We have either case: p1>p0 indicates the price of A has increased; and \(p_1

If the LP had simply held the assets, their value would have changed with the price. The initial value:

V0=x0×p0+y0

New value after price change:

Vhold=x0×p1+y0

The value of the LP’s share in the pool after rebalancing:

Vpool=x1×p1+y1

Substituting x1 and y1 from the realanced amounts:

Vpool=kp1×p1+k×p1=k×p1+k×p1=2k×p1

Impermanent loss IL is the difference between the value if held and the value in the pool:

IL=VholdVpool

We know k=x0×y0, so: x0=kp0 and y0=k×p0

For simplicity, Let p0=1, then Vhold is calculated by:

Vhold=x0×p1+y0=kp0×p1+k×p0=k×p1+k

Substituting to calculate the IL:

IL=VholdVpool=(k×p1+k)2k×p1=k>0(p1+12p1(1p1)20)0

This implies that LPs are prone to capital losses due to market volatility.

Subscribe to SkyGLab

Scroll to Top