Get Tangem

Impermanent loss in farming and how to avoid it


If you’re interested in generating a passive income with crypto, then you probably know something about farming and providing liquidity. Today, many DeFi platforms such as Uniswap, SushiSwap, and PancakeSwap allow anyone who wants to become a liquidity provider (LP) to place their crypto assets in liquidity pools and earn commissions for trading operations carried out on the platform, and in some cases receive rewards from the project.

It’s easy to make money this way, but you’ll need to be aware of the risks of placing crypto in liquidity pools, namely the phenomenon of impermanent loss.

How automated market maker (AMM) liquidity pools work, who LPs are, and what impermanent loss means

In order for users of a given DeFi protocol based on an automated market maker (AMM) to be able to sell or buy coins and tokens at any time that is convenient for them, a liquidity pool – a form of cryptocurrency storage that allows you to quickly exchange one currency for another – is required.

An AMM is a software algorithm that controls the liquidity and pricing of cryptocurrencies on decentralized platforms such as DEXs.

Let's say you want to sell 1 ETH, which is worth, for the sake of argument, 2,000 USDT. To avoid having to wait for a counterparty who needs 1 ETH and has 2,000 USDT to purchase it from you, you need a liquidity pool that can take 1 ETH from you and give you 2,000 USDT in return. There are lots of people who want to exchange ETH for USDT, so there is a high demand for this liquidity, which is what LPs – also known as market makers – provide.

Market makers contribute a cryptocurrency pair (in our case ETH/USDT) to the liquidity pool, usually at a ratio of 50:50. The decentralized exchange and traders receive liquidity and can exchange ETH for USDT and vice versa at any time, while liquidity providers are rewarded in the form of commission fees in proportion to their share of investments in the pool.

All of this looks fairly simple and mutually beneficial for the participants. There is, however, one caveat pertaining to the risk of impermanent loss for market makers. This risk is associated with the volatility of one cryptocurrency in relation to the other.

Impermanent loss is a temporary loss associated with the volatility of the trading pairs that LPs place in AMM-based liquidity pools. This indicator is expressed in dollars and shows how much the liquidity provider has lost in terms of the funds actually withdrawn, as compared with the value of the assets if they had simply been stored in a crypto wallet.

The automatic market maker balances the ratio of crypto assets in the pool at the level of 50:50, thereby setting their value.

The following formula is used by AMMs as the pricing mechanism:

X * Y = K

where X and Y are a pair of assets in the pool, and K is a constant that must be the same both before and after the transaction.

The main reason for the occurrence of impermanent loss is the discrepancy between the value of the coins in the pool and their real market price.

How impermanent loss happens

Let’s imagine a scenario where you are a liquidity provider who has put 1 ETH and 2,000 USDT in a pool. For convenience, let’s say that 1 ETH is worth 2,000 USDT, so your investment is valued at $4,000.

Now let's say that your investment in the liquidity pool is worth 10% of all the funds placed in it. This would mean that K = 10 ETH * 20,000 USDT = 200,000.

The constant K must remain the same after all of the transactions in the pool have been executed. Even if the price of 1 ETH rises to 8,000 USDT, the AMM will still treat it as being worth 2,000 USDT.

As long as the total value of the pair of coins you have placed in the pool is the same, nothing happens and everything remains stable. If the cost of 1 ETH starts to grow, arbitrage traders appear. They buy ETH from the pool at the below-market-value price until the value of the coin is equal to the external market price.

In our example (we’ll omit fees for convenience), in order for the ETH price in the pool to match its market price, the pool ratio should be 5 ETH to 40,000 USDT (this would maintain the value of K at 200,000).

If you withdrew your crypto assets from the pool at this point, you would actually receive 0.5 ETH and 4,000 USDT. In dollar terms, you’ll get $8,000 in your wallet. This appears satisfactory. You’ve invested $4,000 in the pool and received $8,000. Now, let's calculate how much money you would have if you didn't become a liquidity provider, but simply held your crypto assets (1 ETH and 2,000 USDT). Based on the exchange rate at the time of withdrawing your funds from the pool, they would be worth $10,000 (1 ETH = $8,000 + 2,000 USDT). This $2,000 difference is the impermanent loss.

How to avoid impermanent loss

The first thing you need to understand is that volatility is the deciding factor impacting the size of the impermanent loss. The more the value of an asset changes, the greater the loss. Therefore, one way to reduce the risk of its occurrence is to work with crypto assets with a lower volatility.

Placing assets in pools that have recently opened can provide a certain level of protection. This way, you’ll get a larger share of the pool and, accordingly, a higher reward in the form of commissions for providing liquidity, which can partially or completely cover the impermanent loss.

You can also look to invest in pools with high commissions and APY (annual percentage yield), which can also help to reduce impermanent loss.

It goes without saying that you should also track the prices of coins and tokens that you have invested in liquidity pools, enabling you to withdraw your crypto assets in good time.