ZacharyZachary
17 November 2021
Nov 2021
34 min

Liquidity Pools

One of the most important innovations in decentralized finance (DeFi) is the liquidity pool. It eradicates the need for market makers, bootstraps liquidity for markets that may otherwise be illiquid, and introduces a novel way to generate yield on your assets. 

Liquidity pools are an alternative to the traditional order book structure of trading. Exchanges like Binance, Coinbase, New York Stock Exchange, and the Nasdaq all utilize order books as their liquidity management method. Before we break down liquidity pools, let’s outline an order book.

Order Books

An order book is the tried and true liquidity management method that has been globally implemented across exchanges for decades. They refer to the electronic lists of previously placed buy orders (bids) and sell orders (offers) of an asset at different price levels. 

The buyers are trying to pay the least amount possible while the sellers are trying to sell for the highest amount possible. What exists in between the buyers and sellers is what’s called the spread

When you buy a share of Apple, you have to place a limit order or a market order. The limit order will be placed into the orderbook until it is cancelled or filled at the listed price. A market order will jump the spread and pay / sell for the ‘best’ offer / bid that is available. 

In the US, the best bid and best offer refers to the NBBO standard enforced by the SEC which requires brokers to guarantee that market buys are at the lowest possible price and market sells are at the highest possible price. 

What’s wrong with an order book?

Bookmap’s visualization of an active order book

The infrastructure behind traditional / centralized finance (TradFi or CeFi) requires an exorbitant amount of intermediaries. To facilitate a single trade, you will need at least a dozen different entities to be directly or indirectly involved. These include centralized exchanges (CEXes), market makers, prime brokers or high net worth individuals who fund the market makers, custodians, etc. 

All of this creates high barriers to entry and high levels of informational asymmetry. Incentives are not aligned and the retail investor is basically hung out to dry

Here’s an Example

What happens if you want to buy 150 shares of Apple for $130 but there are only 50 shares that people are willing to sell for that price and the next available price people are willing to sell is $131? This is where the market maker comes into play. 

Market makers make markets by providing the remaining 100 shares to the buyer as long as the buyer is willing to pay more for the spread. This enables instantaneous, continuous trading. Since no one is willing to sell for less than $131, market makers could sell their Apple shares for $130.99 until someone is willing to sell for $130.99, etc. Market makers won’t just take undue amounts of risk to complete your trades, they may also trade against you. 

Now let’s say you sell your 100 shares. There is no trader on the other side trying to buy them at the price you offered. The market maker buys them. The market maker then buys a put option so they profit if the price of their Apple shares decline. If the put becomes in-the-money, then the market maker is incentivized to execute the option giving them 100 more shares to sell. They can now sell 100 shares onto the open market while still retaining their original 100 shares. If the share price goes up, the market maker makes money; if the share price goes down, the market maker makes money. 

You can see how deeply integrated and necessary market makers have become in TradFi. They are privy to much more information than retail traders because of this order book structure. If a company like Robinhood states that they offer feeless trading, that is not entirely true because they sell your trades to a market maker who then profits off this spread. The reflexive relationship between market makers and the market causes unnatural price action as derivatives have an outsized effect on the underlying asset’s price.

Cue Liquidity Pools 

Liquidity pools operate entirely on their own without the need for any market makers. They enable individuals to provide liquidity to traders by pooling tokens together into a smart contract and proportionately distributing trading fees to liquidity providers

How do they work?

Liquidity providers deposit an equivalent value of two tokens and in return, they receive LP tokens in proportion to how much they deposit. Traders then swap tokens with the liquidity pools (funded by the liquidity providers) and the trading fees are proportionally distributed to the LP holders. The liquidity providers must then burn their LP tokens by selling them back to the liquidity pool to take back the underlying liquidity and any accumulated swapping fees.

The formula

Each swap adjusts the price via a deterministic algorithm called an automated market maker (AMM). Different protocols use different AMMs for different purposes but they are fundamentally based on the same concept. 

x * y =k

This formula describes the relationship between the assets deposited into liquidity pools. It implies that the quantity and value of token X must equal the quantity and value of token Y which enables a constant value K representing the level of liquidity available. 

Arbitrage bots are incentivized to take advantage of any indiscretions between the price of the assets in the pool and the price of that same asset on another exchange. The first liquidity provider sets the price of the assets and each swap thereafter will affect the asset’s prices, engaging the arb bots. If a trader wants to buy ETH with USDC, the trader will be depositing USDC into the liquidity pool while removing ETH. 

The AMM asymptotically increases token prices as quantities decrease because the ratio of tokens within the pool dictates token prices. 

Source: Dmitriy Berenzon

The Result

This balance of consistent liquidity and accurate pricing enables users to trustlessly trade on decentralized exchanges (DEXes) simply by connecting a non-custodial digital wallet. The days of needing to deal with market makers manipulating prices and taking advantage of illiquidity are over. You can now freely make a market for just about anything and rely on nothing but the trust of the underlying smart contract governing the transactions. 

Larger liquidity pools enable larger trades so many platforms have been incentivized to reward liquidity providers with extra tokens for providing liquidity. This process is called liquidity mining which can be very profitable and helped kickstart DeFi Summer of 2020. 

The Risks

Although there has been huge amounts of progress and development in DeFi over the past few years, it is still considered an unproven technology at scale. Doing anything in DeFi carries three risks you can’t avoid: smart contract bugs, admin key risk, and systemic risk. 

Smart contract bugs are vulnerabilities or errors encoded within the smart contracts governing your capital. Even audited smart contracts can contain these bugs and the results can be disheartening. Admin key risk refers to the creators of the contract retaining too much control over it which puts the assets within it at risk. Systemic risk can be anything from the blockchain you are using failing or even the price of stable coins depegging from their intended values. 

Along with all of the above, engaging with liquidity pools entails one more risk that needs to be considered.

Impermanent Loss

Impermanent loss is a confusing name. It’s a result of one token’s price change affecting the aggregate value of the tokens in the liquidity pool. 

The loss becomes permanent once the LP tokens are sold back to the AMM. The loss can go away if the liquidity provider chooses to keep holding the LP tokens and the token price returns back to normal. Depending on when you deposit your tokens into a liquidity pool, it may be more profitable to simply hold them as described by the image below. 

However, trading volumes and platform incentives may offset impermanent loss. It’s important to understand how price changes will affect the underlying liquidity you provide to any pools.

The Issues

Liquidity pools are dynamic, powerful tools that can potentially disrupt the entirety of centralized finance. While there are benefits to trading with an order book, there are also many drawbacks and liquidity pools aren’t perfect. 

Innovation requires iteration. 

The new AMMs being designed are much more complicated than what is explained above. The x*y=k formula describes the relationship of a simple 2 asset liquidity pool. New pools can contain much more than two assets. Some may even be hybrid of multiple forms of AMMs to enhance liquidity in specific regions. This substantially lessens a trader’s losses due to slippage and enables pools with tokens that are pegged to each other (USDC/DAI, ETH/wETH) to experience less price variation.

Liquidity providers can be fickle as well. As soon as they feel like it, they can just leave. This makes the market they were providing liquidity to suddenly illiquid and when this happens, prices crash. As a remedy to this issue, platforms like Olympus DAO have sprung up with the concept of protocol owned liquidity (POL) as opposed to the rented liquidity enabled by traditional liquidity pools. 

POL involves a number of symbiotic mechanisms and may be a powerful force moving forward.

Final Thoughts

TradFi requires too many intermediaries taking fees. Retail investors suffer from a lack of information and assets just aren’t yielding what they used to while inflation is rampant. The order book has worked until now but the convoluted system involved is ripe for innovation. 

Liquidity pools present an alternative that can help fix each of these problems. Not only do they enable permissionless trading but they incentivize everybody to get involved. The barriers to entry are very low.

If you can understand this article, you can understand how to be a liquidity provider. 

We have a new extension