Learn the basics of investing in DeFi liquidity pools like Uniswap and Bancor
Liquidity pools offer a new standard for efficiently trading assets while allowing investors to earn a yield on their holdings. In this article, we discuss how liquidity pools work and their main advantages over order book exchanges.
To invest and track your tokens in liquidity pools, log in to Zerion and open the “Invest” tab.
How it works
There are currently two types of decentralized exchanges on Ethereum: 1) order book peer-to-peer exchanges (e.g. 0x exchanges like Radar Relay) and 2) liquidity pool exchanges (e.g. Kyber, Uniswap and Bancor).
Order book exchanges rely on a bid/ask system to fulfill trades. When traders place a buy or sell order at their chosen price for a token, the exchange’s matching engine only executes the trade once an opposite order at that price is available. Traders who place (limit) orders on the order book are called market makers and traders who execute their orders against orders already on the order book are called takers. A token’s price is therefore determined by the traders who choose at what price level to place orders.
This system works fairly well when there are enough buyers and sellers in the market, but there are a few unavoidable issues: tokens that lack liquidity due to low volume or interest not only become difficult to buy and sell, but are also susceptible to unpredictable price swings caused by large individual transactions. Consequently, tokens that are characterised by high price volatility and inefficient conversions are unlikely to be adopted.
Liquidity pools directly address this problem by removing the dependence of tokens on trade volume and ensuring constant liquidity. Compared to the traditional order book model, liquidity pools have four main advantages:
1. Guaranteed liquidity at every price level
Behind the scenes, the “liquidity pool” is just an automated market maker in the form of a smart contract that automatically matches traders’ buy and sell orders based on predefined parameters. Traders do not need to be matched directly with other traders, so as long as investors have deposited assets into the pool, liquidity is constant (although trades that are large relative to the available liquidity can still incur significant slippage).
2. Automated pricing enables passive market making
On order book exchanges, market makers need to constantly adjust their bids and asks as asset prices move. Unsurprisingly, market makers tend to be professionals who have the time and expertise to actively manage their market making strategies. Liquidity pools don’t need to aggregate information across exchanges to determine the price of assets. Liquidity providers simply deposit their assets into the pool and the smart contract takes care of the pricing.
3. Anyone can become a liquidity provider and earn
Liquidity pools require no listing fees, KYC, or other barriers characteristic of centralized exchanges. Anyone can invest in an existing liquidity pool or create a new exchange pair for any token, at any time. When an investor wants to supply liquidity into a pool, they deposit the equivalent value of both assets. Supplying $100 of liquidity into an ETH/DAI pool requires a deposit of $100 worth of ETH and $100 DAI, so $200 in total. In return, the investor receives liquidity pool tokens which represent their proportional share of the pool and allows them to withdraw that share at any time. When someone places a trade, trading fees are deducted from the asset that the trader sends to the exchange contract and added to the liquidity pool after the trade. For example, Uniswap charges a 0.3% trade fee. If your $100 ETH/DAI contribution makes up 0.007% of the pool, you’ll get 0.007% of that 0.3% trading fee.
4. Lower gas fees
Decentralized exchanges like Uniswap have a minimalist smart contract design that reduces gas costs. Efficient price calculations and fee distributions within the pool means less friction between transactions. For example, most smart contracts can only send traded funds back to the same wallet; Uniswap enables traders to exchange assets and send to another wallet in a single transaction.
A closer look at asset-pricing
Liquidity pools are designed to perform trades and maintain pricing according to a constant product formula that ensures the value of each reserve stays constant even as the ratios of the assets change. Buy transactions increase the price of the bought asset relative to the sold asset (since the bought asset’s ratio of the pool decreases) and sell transactions decrease the price of the sold asset (since its ratio in the pool increases).
The example below shows the calculations of a trade selling 1 ETH for DAI on Uniswap’s ETH/DAI exchange. A trader selling 1 ETH for DAI on a Uniswap pool with an initial exchange rate of 140 DAI/ETH receives a rate of 138.20 DAI/ETH. After the trade, the pool has an exchange rate of 137.25 DAI/ETH.
Liquidity pool exchanges: Uniswap and Bancor
Uniswap is a decentralized ETH and ERC-20 token exchange that charges a 0.3% trading fee on all its pools. Direct token-token pools are not yet supported, so token-token trades occur in two separate steps: first a sell transaction of the sold token for ETH, followed by an ETH sell transaction to buy the second token.
Bancor supports liquidity pools (called Bancor Relays) between their native BNT token and Ethereum or EOS tokens, as well as between Bancor’s stablecoin (USDB) and any Ethereum or EOS token. In this article, we focus on Bancor’s liquidity pools on Ethereum. Similar to Uniswap, investors are required to supply equivalent values of each token. Unlike Uniswap, Bancor’s trading fees vary between pools as they are set by the first user to add liquidity to a Bancor Relay. Current fees are in the range of 0.1–0.5%.
To withdraw liquidity on either protocol, investors simply return their pool tokens (called Relay Tokens with Bancor) at any time, and their proportional share of the pooled assets and the accrued trading fees are sent to their wallet.
Liquidity pool returns depend on three factors: 1) asset prices when supplied and withdrawn, 2) liquidity pool size, and 3) trading volumes. It’s very important to note that as trading activity can change the price and quantity of assets in the pool, investors will likely end up withdrawing a different ratio of assets compared to what they first deposited. This is where the movement of the market can either work for or against you. Since you’re required to supply a equivalent value of the two assets in the pool, large price changes between the time of supply and withdrawal in either asset can result in losses compared to simply holding each asset individually in a 50/50 portfolio (referred to as “impermanent loss” in some sources). Therefore, the realized returns that investors earn also depend on price and pool ratio changes in addition to earned trading fees.
The graph above shows the returns for a $10,000 portfolio on Uniswap’s SAI-ETH pool. In practice, this means the investor supplied $5,000 worth of each pool asset on the first day of the period (3/11/2018) and withdrew them on the last day (17/2/2020). The green columns show the weekly cumulative trading fees earned and the red columns show the weekly impermanent loss resulting from price volatility. Over the period, this initial SAI-ETH deposit returned 27%, growing from $10,000 to just over $12,500.