Home Crypto Impermanent Loss: Step by Step Demonstration (Math)

Impermanent Loss: Step by Step Demonstration (Math)

0
Impermanent Loss: Step by Step Demonstration (Math)

[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

LEAVE A REPLY

Please enter your comment!
Please enter your name here