# providing liquidity to a DEX

( ... coming soon)

# Providing liquidity to a DEX

Many people try to earn money by providing liquidity (LP) to a decentralize Exchange (DEX)

Here is a quick summary explaining the major elements

⚠️Impermanent loss" is the most important concept in DeFi.

1) The Basics

The point of a DEX is to replace market makers with "liquidity providers" (LPs).

Traditional market makers buy at the bid and sell at the ask of a pair. They take risk by holding 'inventory', which they typically hedge. Over time they make money capturing the bid/ask spread.

Instead, they require LPs to offer trading pairs in a set ratio.

If Asset A is worth \$100, and Asset B is worth \$10, an LP puts in 1 unit of Asset A and 10 units of Asset B. The ratio of 10:1 units equals the 10:1 price ratio.

But how does that market stay in equilibrium when prices change?

2) Mathematical Bids & Offers

The 'innovation' of a DEX is to create a simple formula that keeps this market balanced:

It requires that the multiple of the units stays constant regardless of price.

So if prices change, the *ratio of units* (= ratio of prices) of A vs. B changes proportionately, but the *multiple of units* of A x B stays constant.

But how does a pool get from a starting ratio + multiple of units, to a *new ratio* of units/prices, but the *same multiple* of units?

3) Arbitrage

The excel gives an example of a one LP and one arb to keep it simple.

But in short an LP starts with a price/units ratio, and an arb enters to buy/sell enough of A/B to move the ratio to balance with other markets (while being forced by the DEX equation not to change the multiple of units).

As with other markets, DEXs charge fees.

Uniswap averages ~12bps today on avg.

To pay LPs for market making, they receive most of the trading fees.

And higher DEX trading volumes relative to LP assets ('asset turns') mean higher LP yields.

5) Impermanent Loss vs. Total P&L*

So 3 line items drive P&L for an LP:

a) Yield received for market making

b) Change in the value of the assets put up

c) Amounts lost to arbitragers

Total P&L is the sum of those three.

"Impermanent Loss" is just the third line item.

You can describe it in different ways.

The simplest is as the delta between what you would have made had you just held the underlying assets minus what you actually end up with, with arbs capturing the difference.

With the key driver of P&L the relative price change of A vs. B.

Newer DEXs use this concept and add complexity. But the underlying math is the same.

The key takeaway is that LPs do not realize headline yields.

Uniswap's TVL-weighted LP yield has averaged 12% for the last year.

Realized yields are lower and depend on the price behavior of the specific pool.

As always, intelligent risk taking requires mathematization.