Cryptocurrencies and liquidity pools

Cryptocurrencies are not like the standard financial products you are used to. Ever since the creation of Bitcoin, they have attracted new investors who have created new and original trading exchanges and protocols (e.g.: Coinhouse, Uniswap).


But some standard rules of financial markets also apply to digital assets. One of them is that a market of any kind can only work if it ensures the liquidity of its assets.


What is market liquidity?


An asset is said to be liquid when there are enough assets available on the market to absorb investor activity. In this case, sellers and buyers can easily agree on a price which evolves depending on supply and demand. We say that there is a liquidity crisis when no transaction occurs because of a lack of buyers or sellers. They do not agree on a price for the assets and the entire market is blocked.


When an asset is not liquid enough, investors can be reluctant to hold it in their portfolio because there is a risk that they will not be able to close out their position when they want to. One of the roles of exchanges is to ensure this liquidity.


How do exchanges ensure liquidity?

BTC/USDT from Binance 08/06/2021
BTC/USDT 08/06/2021


The best-known method for managing liquidity is through an order book. In an order book, buyers and sellers can enter their buy and sell orders (they are called makers because they make liquidity) and investors (takers) can execute them.

There are order books on crypto exchanges such as Binance or Coinbase. These are also called them centralized exchanges or CeXes.


Figure: order book BTC/USDT from Binance 08/06/2021


But in the crypto ecosystem, a new kind of exchange has recently gained traction: decentralized exchanges, or DeXes. Liquidity pools are examples of DeXes.



Liquidity Pools


Without getting into operational details, a liquidity pool contains crypto assets that are available for trading.


In such a pool, users called liquidity providers (LPs) deposit pairs of assets, for example Ether (ETH) and Bitcoin (BTC). Other investors are then able to trade ETH vs BTC, e.g., buying some ETH by depositing BTC, or vice versa.


In exchange for tying up their assets, LPs are rewarded depending on the number of transactions that are made. The larger the pool, the more investors trade on it, thus the more LPs are rewarded.


Illustration of an ETH/BTC liquidity pool (source : Kesitys)

NB : In this example, the pool is composed of 2 assets, but pools can contain more assets.


Currently, the best known and largest liquidity pools are available on Uniswap. Uniswap manages more than 8000 pools for a total value locked of more than $6.5 billion (source : https://defipulse.com/uniswap).


How does a liquidity pool work exactly?


Let's take a standard example: the DAI/ETH pool.


The pool operates on a 50/50 ratio, which means that when an LP deposits assets, they must deposit the same value of DAI as ETH (at the current market price).


For example, assume the ETH/DAI price is 2400. A new LP can inject 1 ETH and 2400 DAI (or 2 ETH and 4800 DAI etc.).


To adjust the pool exchange price and keep it consistent with other markets prices, Uniswap uses a constant automatic market making formula. The rule is: in the pool, the product of the asset quantities must remain constant.



For example, assume the pool contains 100 ETH and 240 000 DAI (i.e., the current price ETH/DAI in the pool is 240 000 / 100 = 2400). The pool constant is K = 100 * 240 000 = 24 000 000.


But if an investor wants to buy 20 ETH from the pool, he will not pay 2400 on average because the price will shift with the transaction.

The actual price is given by the “K is a constant” rule. The quantity of DAI to be paid is the solution of:

(100 - 200) * (240 000 + X) = K = 24 000 000

Hence, X = 60 000.


To buy 20 ETH, the investor will therefore deposit 60 000 DAI, i.e. he will pay a price of 3000 on average. After the transaction, the ETH/DAI price in the pool is 300 000/80 = 3750. Thanks to arbitragists this price reflects the actual price on the market.




As evidenced by the figure on the right liquidity pools behave like traditional exchanges. A larger pool entails more liquidity, which reduces the impact of transactions on assets prices.




  • The blue line shows the impact of a transaction in a pool with 100 ETH (i.e. K = 24 000 000)

  • The green line shows the impact of a transaction in a pool with 500 ETH (i.e. K = 600 000 000)


Introduction to the “impermanent loss”


If you hear about liquidity pools, you will necessarily hear about impermanent loss. Impermanent loss represents the opportunity cost of participating in a liquidity pool versus a simple asset holding strategy.


Let’s work out an example (skipping some details for the sake of clarity). An LP wants to invest in a pool when the price of 1 ETH is 2400 DAI.


  1. He borrows from a friend (i.e. at a zero interest rate) 2400 DAI and 1 ETH. He deposits these assets directly into the pool. After his deposit, the pool contains 100 ETH and 240,000 DAI, so he owns 1% of the pool and he receives 1% of the rewards every time a transaction is made.

  2. A couple of transactions are carried out and the price of 1 ETH rises to 3750 DAI in the pool. The previous example shows that there are necessarily 80 ETH and 300,000 DAI in the pool.

  3. The LP withdraws his assets and gets back 1% of the pool, i.e. 0.8 ETH and 3000 DAI.

  4. He has to pay back 1 ETH and 2400 DAI to his friend, so he will buy 0.2 ETH at the market price, that is 0.2* 3750 = 750 DAI. After this transaction, he has 1 ETH and 2250 DAI left and does not have enough DAI to pay back his lender. The LP can only hope to have enough reward to buy back the missing DAIs.


NB: These "losses" occur as soon as the price of the asset changes, in either direction.


In the next article, we will see what strategies an LP can implement to minimize this loss.



Download this article:

Kesitys_LiquidityPools
.pdf
Download PDF • 1.32MB