> For the complete documentation index, see [llms.txt](https://kayen-finance.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kayen-finance.gitbook.io/docs/protocol-mechanics/kayenfi-v2/impermanent-loss.md).

# Impermanent Loss

At its core, impermanent loss is the difference in potential earnings between holding tokens in an AMM and simply holding them in your wallet.

Impermanent loss occurs when the price of tokens inside a pool deviates from when they were initially deposited:

* If the prices return to their initial state, the loss is impermanent since the value returns to its original state.
* If the prices remain diverged, the loss becomes permanent.

While such losses can be offset by trading fees earned from liquidity provision, a clear understanding of impermanent loss dynamics is crucial.

*When a token price rises or falls after you deposit it in a liquidity pool, this is known as crypto liquidity pools' impermanent loss (IL).*

Yield farming, in which you lend your tokens to gain rewards, is directly related to impermanent loss. However, it is not the same as staking. Staking typically involves locking tokens to help validate transactions and earn rewards, while yield farming entails lending your tokens to a liquidity pool or providing liquidity.

Depending on the protocol, the rewards vary. While yield farming can be more profitable than simply holding, providing liquidity carries risks, including liquidation, control, and price risks.

The number of liquidity providers and the tokens in the liquidity pool define the risk level of impermanent loss.

Tokens are usually paired with another token, often a stablecoin such as Tether (USDT) and an Ethereum-based token like Ether (ETH).

Pools with assets like stablecoins within a narrow price range are less vulnerable to impermanent loss. As a result, liquidity providers face lower risk of impermanent loss when a stablecoin is paired with another asset in this scenario.

Liquidity providers on DEXs like KayenFi V2 continue to provide liquidity because trading fees may compensate for temporary loss.

For example, pools on Uniswap (which can be highly susceptible to impermanent loss) can still be profitable due to trading fees (0.3%).

{% hint style="info" %}

### In short

Impermanent Loss (IL) occurs when the value of your assets in a liquidity pool changes compared to when you deposited them. It's called "impermanent" because the loss can be reversed if asset prices return to their initial state when deposited.
{% endhint %}

### Understanding IL through a hypothetical scenario

Imagine you're a liquidity provider joining a 50/50 ETH/USDT pool. You deposit 10 ETH and 10,000 USDT, given that 1 ETH = 1,000 USDT.

The pool's total value before your deposit is 100,000 USDT (equivalent to 50 ETH + 50,000 USDT). After your deposit, you own 20% of the pool.

Your Share (%) = (Your Deposit in USDT / Total Pool Value in USDT) \* 100

In this case:

Your Share (%) = (20,000 USDT / 100,000 USDT) \* 100 = 20%

### Receiving liquidity pool tokens

Upon depositing your assets, you receive tokens representing your share of the pool. You can redeem these tokens for your share of the pool's assets at any time.

### The risk of IL

Your risk of IL stems from your share being a percentage of the pool rather than a fixed number of tokens. If the value of the deposited assets changes significantly, you could be exposed to IL.

The greater the price shift, the higher the potential IL.

### Calculating impermanent loss

Let's say the price of ETH doubles to 2,000 USDT after your deposit. The pool balances the asset values using the constant product formula:

ETH Liquidity \* USDT Liquidity = Constant

For our example:

50 ETH \* 50,000 USDT = 2,500,000 (Constant)

If the price of ETH is now 2,000 USDT, the pool adjusts while keeping the same constant, resulting in new pool balances where ETH liquidity decreases and USDT liquidity increases.

### The effect on withdrawal

If you withdraw at this new price, you would get:

* 7 ETH (20% of 35 ETH)
* 14,142 USDT (20% of 70,710 USDT)

The total value of your withdrawal would be 28,142 USDT. However, if you hadn't deposited into the pool, your assets could have been worth 30,000 USDT (10 ETH at the new price of 2,000 USDT plus the original 10,000 USDT). The difference represents the impermanent loss in this scenario.

### How to avoid (or reduce) impermanent loss

* Consider historical price movement and volatility of the assets before providing liquidity. Impermanent loss occurs when there is a significant price difference between the assets in the liquidity pool.
* Use correlation analysis to determine the relationship between the assets you're providing liquidity for:
  * If the assets are highly correlated, it may reduce the risk of impermanent loss.
  * If the assets have a low correlation, it may increase the risk of impermanent loss.
* Liquidity pool size and trading volume can affect the risk of impermanent loss. Generally, larger liquidity pools and higher trading volumes can reduce the risk of impermanent loss.
* Monitor your liquidity pools regularly and adjust your strategy as necessary. This may involve rebalancing your liquidity, adjusting your price ranges, or withdrawing liquidity altogether.
