Impermanent loss is a popular concept when it comes to Automated Market Makers (AMMs) like Uniswap. A liquidity provider puts an initial amount into two tokens and makes them available for traders to trade with each other. Impermanent loss is the loss incurred when market prices change, increasing the number of lower relative value tokens It is defined as the percentage difference between the value of the new token composition versus the value if the initial composition (hold) was maintained.
There are great articles that explain the concept well and provide examples, but they all show a formula for Impermanent Loss (IL) without offering a derivation:
Let’s see how to get it step by step:
Automated Market Maker protocols like Uniswap and SushiSwap are based on a very simple equation:
Where, 𝑥 is the number of tokens for asset 𝑋, 𝑦 is the number of tokens for asset 𝑌 and 𝐾 is the constant product of the pool.
The value of the initial position is:
An equal value of both tokens is supplied to the pool, therefore:
From (1) we know that 𝑥=𝐾/𝑦 , likewise 𝑦=𝐾/𝑥 ,
Substitute it in (3):
We solve for 𝑥 and 𝑦 in terms of 𝐾,𝑝𝑥 ,𝑝𝑦.
While holding does not change the quantities, 𝑥 and 𝑦 remain the same.
Therefore, the value would be:
We calculate it as a percentage:
Generalizing for more than two tokens:
Complete information about this article and the mathematical calculations here (includes spreadsheet simulation).
New to trading? Try crypto trading bots or copy trading on best crypto exchanges
#Impermanent #Loss #Step #Step #Demonstration #Math #Edwin #Fernández #Grau #BLID #Coinmonks #Dec