# What is impermanent loss and how to calculate it？

Common FAQ    |      2022-09-02

What is AMM？

In cryptocurrency, the AMM model was first practiced by Bancor and later successfully applied by Uniswap. AMM is the abbreviation of Automated market maker. Compared with the traditional centralized exchanges, AMM is equivalent to a decentralized market maker model where everyone can become a liquidity provider. They can obtain fees as income but also face "impermanent loss" risk. Similar to Uniswap, the core rule of OKX Swap is that the product of the pool balance of two assets is a fixed value: X*Y=K.

What is impermanent loss?

Impermanent loss occurs when an automated market maker's (AMMs) algorithmically driven token rebalancing formula creates a divergence between the price of an asset within a liquidity pool and the price of that asset outside of the liquidity pool.

How does impermanent loss occur?

Let's take OKT-USDT and our customer A as an example. She adds 10 OKT and 500 USDT to the liquidity pool when the price is 50 USDT. At this time, A's total assets are worth 1,000 USDT. If we assume that the total liquidity in the pool is 100 OKT 5,000 USDT, then A's assets account for 10% of the entire liquidity pool.
According to the Constant product market maker model, if the price of OKT rises to 200 USDT, the amount of assets in the total liquidity pool will become 50 OKT and 10,000 USDT. If A withdraws liquidity, she will withdraw 5 OKT and 1,000 USDT according to the previous ratio of 10%. At this time, A's assets are worth 2,000 USDT (excluding fees).
But if A holds her assets without providing liquidity, her assets should be worth 10*200 + 500 = 2,500 USDT. The difference between providing liquidity and simply holding is 500 USDT, which is called impermanent loss. The magnitude of impermanent loss is only related to the ratio (P1/P0) of the asset pair price (P0) when liquidity is provided and the asset pair price (P1) when liquidity is withdrawn.
After providing liquidity, users will receive a part of the transaction fee as a reward. They can profit when these rewards are enough to offset the impermanent losses caused by price fluctuations.
 Change after adding liquidity Impermanent loss(Difference between providing liquidity and simply holding) -90% 42.50% -60% 9.65% -30% 1.57% -10% 0.14% 0% 0% 10% 0.11% 30% 0.85% 60% 2.70% 100% 5.72%

A step-by-step guide to purchasing and selling crypto on OKX,