[ad_1]
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:
Considerations
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:
Note 02:
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
[ad_2]
Source link