pexels-roger-brown-5126268

Liquidity Pools and Impermanent Loss

Elias Mendel
Sep 22, 2021 8:57:15 PM

With the growing interest and number of users in the decentralized finance (DeFi) space, the means of enabling seamless exchange of large amounts of crypto assets are an absolute necessity. And while there are popular centralized crypto exchanges (CEX) such as Binance, Coinbase, or Huobi Global with millions of users, entirely decentralized exchanges (DEX) like Uniswap, PancakeSwap or Raydium are handling billions of dollars in volume daily without any intermediary required. While an integral part of this ecosystem is liquidity pools, these come with some downsides as well. This article will shed some light on these topics.- Author: Elias Mendel

How do liquidity pools work? 

First of all, it is important to understand the necessity of liquidity pools. Both crypto and regular centralized exchanges (e.g. Nasdaq, or Shanghai Stock Exchange) operate utilizing the order book model. Essentially, it is an overview of all buy and sell orders for any security, token or financial instrument that a matching engine then uses to match orders that can be fulfilled. A key role are the market makers, who provide crucial liquidity to the market by providing the investors with purchase and sale solutions.

However, since the concept of a powerful intermediary somewhat defies the idea of full decentralization, DEXes use a different model - liquidity pools and automated market makers (AMMs). AMM platforms like Uniswap rely on pools of tokens to provide liquidity rather than the traditional concept of buyers and sellers, using sophisticated math to enable automated and permissionless trading. 

Figure 1: Simplified version of a Liquidity Pool

In their basic form, liquidity pools are created when a liquidity provider (LP) - anyone that is able to supply certain tokens and lock them away in a smart contract - supplies a pair of tokens with an equal value to a “pool”, providing a new market for that particular pair of tokens. In return, they receive so-called LP tokens depending on their stake in the pool. Furthermore, they get a proportional cut of the fees collected on the DEX whenever a transaction is conducted using their pool, as shown in Figure 1. The more LPs there are and the higher the value of the tokens provided, the more liquid the exchange and the smaller the slippage becomes.

Major issue with liquidity pools

Whenever the price of the tokens in the pool fluctuates and differs from the price at another exchange, arbitrageurs will step in and make a profit by offsetting this market inefficiency at the expense of the LPs. In some instances, this can lead to LPs actually incurring losses despite their fee collection. When the tokens' prices fluctuate equally and the exchange ratio between them remains unaltered, this effect does not occur, and the only thing that has changed is the tokens' value denominated in a base currency like USD. 

To render this mechanism more tangible, let us view an example. Suppose we have a pool consisting of ETH and USDT.

In its essence, a DEX like Uniswap is making use of the following formula: 

1) ETH_liquidity_pool * USDT_liquidity_pool = constant_product

The constant product is a simple mathematical formula introduced by Ethereum-founder Vitalik Buterin and essentially means there is a constant balance of tokens determining the price of the assets in the liquidity pool - thus, as the name suggests, the constant product always remains unchanged even if the prices of the tokens alter. 

For example (assuming ETH is priced $3.000): 

10 ETH * 30,000 USDT = 300,000 = constant_product  

Also:

2) ETH_price = USDT_liquidity_pool / ETH_liquidity_pool 

So as long nothing changes, we still have  $3.000 = 30,000  / 10

Combining 1) and 2) leads to: 

ETH_liquidity_pool = (constant_product / ETH_price)

USDT_liquidity_pool = (constant_product * ETH_price) 

If ETH would now appreciate in value by 25%, this has an impact on the liquidity pool and each participant. 

ETH_liquidity_pool = 8.944

USDT_liquidity_pool = 33.541

Comparing this amount of token with the situation prior to the spike in the ETH price the loss of assets each LP has incurred in comparison to just holding them becomes obvious. 

As we can clearly see, by just holding their assets the LPs in total would be 

$71,041 - $67,081 = $3,960 better off. 

The $3,960 is the impermanent loss. Impermanent because as soon as ETH drops back to $3,000, the loss will dissolve. However, if the LP decides to withdraw their funds the previously temporary loss would indeed become permanent. 

Figure 2 is a helpful graphic describing the potential losses of LPs in dependence of the price change, e.g. a loss of 20% (vertical axis) if the ETH price changes by 300% (horizontal axis).

   

   Figure 2: Potential losses of LPs in dependence of the price change

The number upon which resides whether LPs will make money is the sum of trading fees collected. The fees vary from exchange to exchange and from token pair to token pair, but in the main, you can expect them to be in the range of 0.25% - 0.5%, unless they are more risky and less liquid pairs.  As long as the fees exceed the impermanent loss LPs can still be profitable despite price divergences. 

Alternatives tackling impermanent losses

There actually have emerged multiple approaches to deal with this issue, cleverly attempting to circumvent the occurrence of impermanent losses. 

Bancor V2

Bancor V2 has introduced what is referred to as “Dynamic Automated Market Maker” (DAMM), which is supposed to handle the threat of impermanent loss resulting from the fixed token value ratio in regular liquidity pools. 

DAMM make use of price oracles like Chainlink which constantly fetch the prices of the respective token from exterior sources, e.g. major exchanges. Once the initial ratio is changed through rising or dropping prices of the token, a simple rebalancing of the pool token takes place, meaning there is no need for a fixed token ratio at all times. 

Let me demonstrate this automatic adjustment by using the previous example (ETH +25%).

Balancer

This DEX offers a further solution to the aforementioned problem. Balancer utilizes pools in which the token balance could have any range, like  70/30, 85/15 or even 97/3 instead of the default 50/50 weighted model.   

That way, LPs can specifically select the degree of exposure to a token and price fluctuations they desire. The higher a token is weighted, the smaller the implications of a price change. 

It comes in handy that Balancer, just like Bancor, supports single-asset liquidity provision. Another feature is that the pool can actually be composed of several tokens and is not limited to just two. The details of this are out of scope for this article, but if you wish to dive deeper I recommend checking out this post

Curve

Curve mainly focuses on providing liquidity for pairs of stable coins and tokenized stable coins deposit positions (e.g. cDAI, aUSDC) or for similar tokens with different flavors, like ETH and sETH. Thus, there is generally a lot less volatility between the tokens. This price stability leads to a major part of LPs preferring stable coin pools over more volatile ones.

Liquidity Mining 

Lastly, incentivizing LPs by rewarding them for merely providing funds to a DeFi protocol can in some instances suffice to compensate for losses caused by the necessity of equal values of the tokens in the pool and the consequential arbitrage. The users of the application will usually receive the platform's native token in addition to the fees they earn.

Synthetix, for example, was one of the first movers in liquidity mining when they rewarded Uniswap users who provided liquidity to the sETH/ETH pool with SNX token.

Final thoughts

Liquidity pools are integral components of DEXes and hence the entire DeFi space. However, due to their relative novelty, it is worth considering some aspects before locking up your tokens in one. A hassle that keeps leaving uninformed investors clueless are impermanent losses: A change of token supply in a liquidity pool due to price divergences and AMM mechanisms resulting in an opportunity cost (in comparison to just holding the tokens). 

We have presented some ways of dealing with this, such as using protocols poised to solve that particular issue, collecting additional rewards or only contributing to pools with little volatility. 

Since this matter has prevented many institutional and more risk-averse investors from staking their assets, therefore being in the way of crypto mainstream adoption, we expect new solutions to keep arising.

Remarks

About Sharpe Explorer: At Sharpe Explorer, we help our customers leverage the crypto and DeFi revolution to access predictable returns, optimize their portfolio and gain a competitive advantage. Our mission is to provide the best and most trusted user experience for investors in the market. We are going to be the one-stop shop for the focused and comprehensive assessment of any DeFi asset. Sharpe Explorer is going to open the door to the world of DeFi and will give you direct access to wallets and DeFi protocols.

Interested? Then, contact us via info@sharpeeplorer.io, or visit our website. For more content, follow us on LinkedIn, Medium, or Twitter

Do you know someone who might be interested? Then share it on social networks or forward it to your colleagues. Thank you.

Author

Elias Mendel studies International Business and Economics at the University of Applied Sciences Schmalkalden. Currently, he works on several projects dealing with DLT, digital assets, and blockchain. You can contact him via email.

References

1) https://en.wikipedia.org/wiki/Order_book

2) https://www.investopedia.com/terms/m/marketmaker.asp

3)https://www.gemini.com/cryptopedia/amm-what-are-automated-market-makers

4) https://finematics.com/liquidity-pools-explained/

5)https://pintail.medium.com/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2

6)https://www.gemini.com/cryptopedia/amm-what-are-automated-market-makers

7) https://miro.medium.com/max/2400/0*_3S1Yx3udbQh1yja

8) https://finematics.com/bancor-v2-explained/

9) https://finematics.com/impermanent-loss-explained/

10)https://medium.com/balancer-simulations/understanding-balancer-pools-c2b877dcc082

11) https://finematics.com/impermanent-loss-explained/

12) https://finematics.com/yield-farming-explained/