How do liquidity pools work?

Imagine you’re standing in a huge field.

In front of you is an empty swimming pool with a concrete wall splitting it in half.

There are two big signs, one at each end of the pool. One sign reads ‘Apples only’, the other reads ‘Bananas only’, and there’s a robotic lifeguard sitting on one of those tall sentry chairs, overlooking the empty pool.

Now imagine that two trucks back up to the pool, one at each end.

One truck empties 1000 apples into the ‘apple’ side of the pool. The other truck empties 500 bananas into the ‘banana’ side, then both trucks drive off.

The robot-lifeguard turns to you and tells you that the dollar value of both sides of the pool is equal at $1000. Then the robot-lifeguard asks you, ‘What is the dollar value of one banana?’

‘$2, of course’, you answer, because 500 bananas @ $2 each = $1000. Simple.

Now let’s say another truck comes along with 500 apples. The truck driver tells the lifeguard that he wishes to swap all his 500 apples for bananas. Since we know bananas are currently worth $2 each, it makes sense that the truck driver will be able to receive 250 bananas for this trade, right?

Not so fast.

The robot-lifeguard tells the truck driver, ‘I want you to add the apples slowly, one by one, and remove the bananas slowly, one by one.’

‘That’s an annoying request!’ the truck driver replies. You, watching this weird situation unfold, have to agree.

‘Tough luck’, says the robot-lifeguard. So, begrudgingly, the truck driver places one apple into the apple end of the pool, then a second apple, then retrieves a banana from the banana end, and pops it into his truck.

Next, without asking permission, the truck driver grabs another two apples from his truck and adds them one by one to the apple end, then goes to grab another banana.

‘STOP!’, says the robot-lifeguard before the truck driver can grab the second banana. ‘Two apples isn’t enough anymore.’

The truck driver is confused, and asks what the problem is.

‘The price of bananas just went up. And the price of apples went down’, replies the robot-lifeguard.

‘What!? Why?’ asks the truck driver.

‘Supply and demand. You’ve diluted the apple supply and made the bananas rarer, and thus more valuable’.

A little frustrated, the truck driver goes back to his truck and gets another apple.

This process keeps on going, with the truck driver having to provide exponentially more and more apples to pay for the bananas, which are getting exponentially rarer in the pool, and exponentially more expensive.

Halfway through the trading, the truck driver gets angry and stops.

‘This is ridiculous!’, says the truck driver.

‘It’s just slippage’ replies the robot-lifeguard.

You, the bystander, make a mental note to yourself to never trade large amounts through small liquidity pools.

Then, all of a sudden you hear a noise. You look up and realise that the huge field you’re standing in is actually full of hundreds of these concrete pools, each with trucks coming and going and trading different assets, and each with their own robot-lifeguard keeping watch.

‘Am I in the matrix?’ you wonder. No. You’re in a decentralized exchange, watching automated market makers (the robot lifeguards) facilitate trading through liquidity pools.

A little more context

Until not that long ago, if someone told you they were a ‘day trader’, you would be fairly safe in assuming they meant they traded stocks on the stock exchange. But instead of assuming, you might have asked them what they traded, and on which exchange. Stocks on the NYSE? Bonds on the London Stock Exchange? Gold on the NASDAQ?

If they told you they were trading on the NYSE, and lived in Sydney (for example), you’d also be fairly safe in assuming that they slept throughout the day and were up all night trading. Why? Because, unlike decentralized exchanges which are open 24/7, traditional stock exchanges are only open roughly 9–5, and consequently, time differences create a big barrier to trading.

When you compare traditional exchanges with decentralized exchanges, the former seem almost absurdly outdated. Having to wait until the exchange opens in the morning to place an order seems like something from a bygone era, but it’s how traditional exchanges still operate.

In contrast, decentralized exchanges don’t rely on an order book. Rather, they use liquidity pools (as outlined above) where assets are traded instantly, with no waiting for stock exchanges to open, and no waiting for buyers and sellers to agree on a price.

Sounds good. Is there a downside?

For traders, as long as there’s enough liquidity in the pools so that slippage doesn’t become a problem, no, there’s no real downside to trading through liquidity pools.

For liquidity providers, however, there can be a downside, and it’s called ’impermanent loss’.

Put simply, impermanent loss is where the fees you earned for providing liquidity are worth less than the gains you would have enjoyed if you had simply held the assets in your wallet and not added them to a liquidity pool in the first place.

Let’s get (a little) technical

When Uniswap launched in November 2018, it made famous a fairly simple formula upon which many decentralized exchanges are now based: X * Y = K

In this formula, K is a constant created at the time the liquidity pool is set up, and it’s a constant of the quantity of the tokens in the pool, not their value.

Using our apple and banana analogy above, where the initial liquidity provider deposited 1000 apples and 500 bananas, K equalled 500,000.

Regardless of how long they continued providing liquidity to that pool, and how much trading happened through it, when the liquidity depositor eventually removes their liquidity, K would still equal 500,000.

Let’s go back to the fruit analogy above. Say people all across the marketplace decided they were really really hungry for bananas, and they would basically trade anything to get their hands on some bananas.

Nectarine holders would trade their nectarines. Mango owners would trade their mangos. Across the board, the value of bananas in the pools would go through the roof.

When the apple:banana liquidity provider eventually removed their position from the apple:banana pool, they would have far more apples and far fewer bananas than they initially put in — but the value of the bananas that they do still hold would have skyrocketed.

However, if they had never provided liquidity in the first place, they would be in a better position, as they would be holding more bananas — and the market had decided (using lots of fruit, not just apples) that bananas were very valuable.

I was thinking about being a liquidity provider. How worried should I be about impermanent loss?

There are several schools of thought on this question. Some people believe it’s better to choose two tokens that you like equally, and pair them together in a liquidity pool. That way, whether you end up with more of one or the other, you don’t really mind as you like them both.

Other people believe liquidity pairs work best when one side is a stablecoin, as the risk of impermanent loss is dramatically reduced.

Typically, the fees from being a liquidity provider outweigh the impermanent loss, but this is not always the case — so make sure to do your research and think very carefully before entering into a liquidity providing position.

What about single sided liquidity pools?

Compared with two-sided liquidity pools, single-sided pools are an even newer invention, and they deserve an entire article dedicated to them on their own.

Suffice to say for this article that single-sided liquidity pools eliminate the risk of impermanent loss, but they are not necessarily ‘better’ than two-sided pools.

How does a liquidity pool compare with the Liquid Loans Stability Pool?

The Stability Pool provides the Liquid Loans system with the liquidity to repay debt from liquidated Vaults, which ensures that the total USDL supply always remains backed by PLS.

Unlike a two-sided liquidity pool, only USDL stablecoin can be added to the Stability Pool inside the Liquid Loans protocol, so impermanent loss is not a big factor, but it can creep into the picture when liquidations happen as the price of PLS is dipping.

However, since most stability providers in the Liquid Loans protocol will be big believers in holding PLS forever and #neverselling — and they’ll be receiving healthy rewards in LOAN token — most won’t be too worried about this theoretical impermanent loss.

Our sacrifice phase is on now — don’t miss it!

Right now, Liquid Loans is running a sacrifice phase where you can make a political statement against corporate-owned, censorable, centralized stablecoins, and express your desire to see something better emerge on PulseChain. Should you choose to participate in this sacrifice, you must have no expectation of profit derived from the work of others. To learn more, go to thesacrifice.io or join our highly active community on Telegram.

Disclaimer: Please note that nothing on this website constitutes financial advice. Whilst every effort has been made to ensure that the information provided on this website is accurate, individuals must not rely on this information to make a financial or investment decision. Before making any decision, we strongly recommend you consult a qualified professional who should take into account your specific investment objectives, financial situation and individual needs.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Liquid Loans

A truly decentralized borrowing protocol that allows you to draw 0% interest-free loans against your Pulse coins. Non-custodial, immutable and no admin keys.