DeFi – Automated Market Makers (AMMs), Liquidity Pools, Impermanent Loss

Cryptocurrency News and Public Mining Pools

DeFi – Automated Market Makers (AMMs), Liquidity Pools, Impermanent Loss

Yesterday during r/CC Trivia Quiz I realized how not many people know about AMMs which is a very important concept in DeFi, hopefully this clears stuff up!

What is an automated market maker (AMM)?

An automated market maker (AMM) is a type of decentralized exchange (DEX) protocol that relies on a mathematical formula to price assets. Instead of using an order book like a traditional exchange, assets are priced according to a pricing algorithm.

This formula can vary with each protocol. For example, Uniswap v2 uses x * y = k, where x is the amount of one token in the liquidity pool, and y is the amount of the other. In this formula, k is a fixed constant, meaning the pool’s total liquidity always has to remain the same. Other AMMs will use other formulas for the specific use cases they target.

Traditional Market Makers help you get a good price and tight bid-ask spread on an order book exchange like Binance. Automated market makers decentralize this process and let essentially anyone create a market on a blockchain.

How does an automated market maker (AMM) work?

An AMM works similarly to an order book exchange in that there are trading pairs – for example, ETH/DAI. However, you don’t need to have a counterparty (another trader) on the other side to make a trade. Instead, you interact with a smart contract that “makes” the market for you.

You could think of AMMs as peer-to-contract (P2C). There’s no need for counterparties in the traditional sense, as trades happen between users and contracts. Since there’s no order book, there are also no order types on an AMM. What price you get for an asset you want to buy or sell is determined by a formula instead.

So there’s no need for counterparties, but someone still has to create the market, right? Correct. The liquidity in the smart contract still has to be provided by users called liquidity providers (LPs).

What is a liquidity pool?

Liquidity providers (LPs) add funds to liquidity pools. You could think of a liquidity pool as a big pile of funds that traders can trade against. In return for providing liquidity to the protocol, LPs earn fees from the trades that happen in their pool. In the case of Uniswap, LPs deposit an equivalent value of two tokens – for example, 50% ETH and 50% DAI to the ETH/DAI pool.

Can anyone become a market maker? Yes! It’s quite easy to add funds to a liquidity pool. The rewards are determined by the protocol. For example, Uniswap v2 charges traders 0.3% that goes directly to LPs.

Why is attracting liquidity important? Due to the way AMMs work, the more liquidity there is in the pool, the less slippage large orders may incur. That, in turn, may attract more volume to the platform, and so on. Remember, pricing is determined by an algorithm. In a simplified way, it’s determined by how much the ratio between the tokens in the liquidity pool changes after a trade. If the ratio changes by a wide margin, there’s going to be a large amount of slippage.

To take this a bit further, let’s say you wanted to buy all the ETH in the ETH/DAI pool on Uniswap. Well, you couldn’t! You’d have to pay an exponentially higher and higher premium for each additional ether, but still never could buy all of it from the pool. Why? It’s because of the formula x * y = k. If either x or y is zero, meaning there is zero ETH or DAI in the pool, the equation doesn’t make sense anymore. But this isn’t the complete story about AMMs and liquidity pools. You’ll need to keep in mind something else when providing liquidity to AMMs – impermanent loss.

What is Impermanent Loss?

Impermanent loss happens when the price ratio of deposited tokens changes after you deposited them in the pool. The larger the change is, the bigger the impermanent loss. This is why AMMs work best with token pairs that have a similar value, such as stablecoins or wrapped tokens. If the price ratio between the pair remains in a relatively small range, impermanent loss is also negligible.

On the other hand, if the ratio changes a lot, liquidity providers may be better off simply holding the tokens instead of adding funds to a pool. Even so, Uniswap pools like ETH/DAI that are quite exposed to impermanent loss have been profitable thanks to the trading fees they accrue.

“Impermanence” assumes that if the assets revert to the prices where they were originally deposited, the losses are mitigated. However, if you withdraw your funds at a different price ratio than when you deposited them, the losses are very much permanent. In some cases, the trading fees might mitigate the losses, but it’s still important to consider the risks.

submitted by /u/sggts04
[link] [comments]