Decentralized asset trading, or liquidity pooling in decentralized finance services, is inextricably connected with the risk of losing funds due to the inherent price volatility of cryptocurrencies. One of the most common reasons for the deterioration of profits and portfolios on decentralized trading platforms is the risk of impermanent loss.

Impermanent Loss Explained

Impermanent loss is the potential loss of value or profits sustained as a result of the price difference of an asset within the timeframe when it was provided to a liquidity pool and the moment it was withdrawn. The loss will depend on the size of the difference in price between the two moments. In essence, it is a form of depreciation of the asset resulting from its value loss between the time of deposit and the time of withdrawal from the platform.

The more volatile an asset’s price, the higher the chance that its value will deteriorate and the greater the resulting difference in price. Relatively stable assets like stablecoins are less exposed to impermanent loss, as well as wrapped versions of some tokens or coins, which are usually contained within a relatively small price range.

Impermanent loss is often compared to slippage, which is the potential loss sustained as a result of the difference in price between the moment an asset’s order for sale is placed and the moment it is executed. The phenomenon of slippage is common for decentralized exchanges, but is related to the difference in time it takes miners to hash transactions after they are placed in the queue.

Impermanent loss is applied to liquidity pools like Uniswap, but is often counteracted on such platforms by trading fees. High trading volumes on popular platforms with demanded asset pairs make it profitable to provide liquidity to fuel trading, thus overcoming the potential losses resulting from impermanent loss.

Impermanent Loss Example

In a simple example, we shall illustrate the way impermanent loss happens. Let us consider a case of Alice depositing 1 ETH and an equivalent value of 100 Toncoin in a liquidity pool, where the price of the deposited assets is equal for the trading pair to be of equivalent value. In this hypothetical example, the price of ETH stands at 100 Toncoin, and the price of 1 Toncoin is $2, meaning that Alice has deposited $200. The liquidity pool in question currently contains 10 ETH and 1,000 Toncoin, with total liquidity being 10,000 Toncoin.

During the course of trading, ETH suddenly spikes in price to 400 Toncoin, or fourfold. As a result, the arbitrage traders in the market will immediately act to balance out the ratio, removing ETH and injecting more Toncoin to reflect market prices. With the new ratio, there are currently 5 ETH and 2,000 Toncoin in the given liquidity pool.

Given that Alice held 10% of the pool, she decides to withdraw her assets, or 0.5 ETH and 200 Toncoin at $400 in total. It may seem at first glance that Alice’s USD deposit has doubled, but in reality, if she had held 1 ETH and 100 Toncoin, instead of withdrawing, the combined value of the given pair would have been $500. Essentially, Alice is at a loss of $100 as a result of impermanent loss arising from price changes during the time of deposit and withdrawal.

Calculating Impermanent Loss

The formula for calculating impermanent loss is quite simple and requires one to subtract the initial deposit exchange value from the ending balance exchange value.

Another way to calculate impermanent loss is to apply the impermanent loss curve function, which will provide a straightforward formula indicating the ratio of price change resulting in the impermanent loss in percentage terms.