Liquidity Pool

All you need to know about Liquidity Pools

Do you really know what a liquidity pool is or how it works? Have you ever wondered how liquidity pools like Uniswap really run it's operations? With this article, I would like to share some information about liquidity pools in terms of what it really is, how it operates or why is it important in the crypto industry so that you can understand it better without having to look somewhere else. Do note this is a long article and I recommend watching this video by Whiteboard Crypto to have a visual understanding if you prefer that format.

TLDR version: Liquidity pools are just pure code, i.e., smart contracts that allow traders to trade tokens and coins, even if there are no buyers or sellers. They are able to do so because of an algorithm known as Automated Market Maker which dictates the price at which a sale can happen. People who invest money in a liquidity pool are known as liquidity providers.

Let's understand it in details

How traditional stock markets work

Before getting into liquidity pools, it is essential to understand how the traditional stock market works so that we can draw parallels with it because essentially cryptocurrencies are being traded like stocks. A traditional stock market works on something known as - Order Book Model. What is it? In this model, buyers and sellers of various stocks or securities, simply write down how much of what stock they are willing to buy or sell at what price. The order book collects all the details and when it finds a buyer's bid meeting a seller's ask, then a trade happens. Buyer gets the stock and the seller gets the money. Both the parties are happy. The stock exchange which facilitated this trade may or may not charge a fee for this operation.

stock market

But this model is inefficient for many reasons. First, a buyer needs to set a price at which some seller is selling that particular stock. There are methods to simply put up a price and wait for the stock price to rise/fall but if the buyer wants to get it immediately, then that person has to comply with the price the seller sets. Similarly, if the seller is in a hurry then that person needs to sell off his stocks at whatever price the buyer bids, which is usually lower than the market rate. That's not all. Stock market opens in the morning at around 9:30 AM and closes in the evening at around 3:30 PM. No trading can happen before or after this time slot. Also there is another catch - a stock can only be bought, if someone is selling it. If there are no sellers, there are no stocks for the buyers to buy. This limits both the buyers and sellers with their capabilities. So what is the solution?

Enter Liquidity Pools

Liquidity pools are brought forward to the world with the invention of blockchains and smart contracts which enabled the functioning of decentralized exchanges. Essentially a liquidity pool is a smart contract, which uses an algorithm to facilitate trade between between buyers and sellers such that anyone can always buy or sell assets no matter how high or low the price is, no matter what time of the day it is or no matter whether there is a buyer or seller to execute the trade.

Smart Contract

How can this happen? Well, as mentioned before, the liquidity pool uses an algorithm to do this operation automatically. In most of the cases, the algorithm that is used is known as Automated Market Maker algorithm, or to be specific - constant product automated market maker algorithm. Automated Market Maker or AMM is a type of algorithm that allow traders to buy or sell certain coins or tokens by dictating how expensive that asset should be based on how much of it there is. In layman's terms, this means that if a lot of people buys a lot of asset X from the pool, then the quantity of that asset in the pool becomes less than before and it will drive it's price higher making it more expensive. Similarly, if a lot of people sells a lot of asset Y to the pool, then the quantity of that asset in the pool increases which will drive the price down making it more cheaper than before. This is a simple case of 'Supply and Demand'.

That's a lot to understand; let's conceptualize it better with some detailed explanation and examples. I recommend watching this fantastic video made by this YouTube channel - Whiteboard Crypto (I am not affiliated to them in anyways) which explains everything there is to know about AMM. Definitely check it out if you want visual explanation. The following example is directly taken from this video which I believe is a brilliant analogy to understand AMM.

Automated Market Maker (AMM)

This example is going to be a long one but please bear with me -


Imagine there is an island X where all the farmers in that island grows potatoes and nothing else. The island produces a lot of potatoes but no one is interested in buying it since every household produces potatoes. These farmers wants to their potatoes to be sold for something else like apples. Suddenly, there arrives a trader in a ship and that person tells the farmers that there is another island Y where all the farmers produce apples. The trader invites the island X's farmers to invest in a trade between both the islands such that they can exchange potatoes for apples. Happily the island X's farmers agreed.

automated market maker

The trader informed them that island Y's farmers have put up 50,000 apples to his 'Apple - Potato trade business'. If the island X's farmers wants to participate, they will have to put up 50,000 potatoes to get things started. They did so. So now, the trader has got 50,000 apples and 50,000 potatoes in the ship's super secure store rooms where the produce doesn't get spoiled and will stay evergreen. Now this trader has got a strict accountant who wants to keep a perfect ratio of value, 50:50 for both these produce. So the accountant told them that in order to keep this perfect ratio between potatoes and apples as 50:50, when produce X (potatoes) is multiplied with produce Y (apples) it should be always equal to K, 2.5 billion (50,000 X 50,000 = 2,50,00,00,000). This way, if the number of any of the product is less than the other during a harvest season, that product will become more expensive to buy.

Liquidity Pool

The accountant continues and states that there are at the moment a perfect 50:50 ratio of potatoes to apples because this person has priced them at $1 each. He warned that when these products are being traded, one of them will become more valuable than the other and then it should be priced more than a $1. As he was talking about it, there came a farmer from island X with 7000 potatoes. The farmer gave his potatoes to the trader hoping to get apples in return. Trader asked the accountant to do the calculation and give apples to this farmer. So the accountant started his work. There were 50000 potatoes and 50000 apples in the pool. Now there are 57000 potatoes in the pool and the number of potatoes multiplied by the number of apples should be 2.5 billion. So he divided 2.5 billion with 57000 in order to get the number of apples there should be in the pool in order to keep the constant at 2.5 billion and he got a result of 43859. So from 50000, 43859 apples should remain in the pool and whatever is left, i.e. 50000 - 43859 = 6140 can be given to the potato farmer in exchange for his potatoes. 57000 multiplied by 43859 gives 2.5 billion so the ratio remains unchanged.


Why did he get less apples (6140) for his 7000 potatoes? Well, by putting in 7000 more potatoes to the pool, he increased the amount of potatoes in the pool thereby driving it's price lower, i.e. 50000/57000 = $0.87 per potato. He was hoping the accountant would price the potatoes at $1 per potato but the increase in supply of potatoes has lowered it's price and when that happened, it inversely increased the price of apples, i.e. 50000/43859 = $1.14 per apple, because the number of apples got reduced after the accountant gave apples in exchange for the potatoes to the potato farmer. So, he got less apples for his potatoes as apples became more expensive than potatoes.


Now another potato farmer brings in 10,000 potatoes to the pool to get apples in return. This will drive up the price for the apples even higher because the pool is getting more & more potatoes and apples are taken away reducing it's supply thereby driving up it's demand. So the total potatoes became 67000 from 57000. 2.5 billion divided by 67000 = 37313 apples should remain in the pool. That means the second potato farmer would get 43859 - 37313 = 6546 apples. This is even lesser than what the first farmer got! That's how the liquidity pool works. The price is inversely proportional to the available amount of the product, i.e., the lower the amount of product, the higher it's price and vice versa. That means now the price of each potato has become $50000/67000 = $0.75 and price for each apple is $50000/37313 = $1.34. At the end of the day, there will be $50000 worth of potatoes and $50000 worth of apples in the lot as the accountant keeps the perfect ratio 50:50.


This is exactly how an automated market maker algorithm works. In this analogy, the farmers are users who wants to buy or sell various assets, the trader is the liquidity pool and the strict accountant is the algorithm. The formula the 'accountant' used is an oversimplified formula which the 'constant product automated market maker algorithm' uses to facilitate trade in the liquidity pool, which is X * Y = k where X and Y are the assets in the tradable pool and k is a constant which always has to remains the same in order to facilitate the trade.

How does a liquidity pool works

A liquidity pool typically contains 2 or more assets to trade for. For the sake of simplicity, let's assume there are only two at the moment. Consider ETH and SHIB as these two assets in the liquidity pool. A liquidity pool is essentially a smart contract written in a way to hold certain funds (in this example ETH and SHIB), do some math with the funds and let the users trade based on the outcome of the math that it did. The pool starts off with both ETH and SHIB in 50:50 ratio. That means if a user wants to put in $1000 into the pool, that person needs to put $500 worth ETH and $500 worth SHIB (it's not the amount of coins, it's the value of the coins). As stated before, the pool is governed by 'constant product automated market maker algorithm'.

AMM Algorithm

As the users slowly buy or swap more and more SHIB coins by giving the pool ETH, the value of SHIB rises as each sale goes by. For example - the first sale might have happened at $1.20. The second one would be at $1.20 and 1/10 of a penny and so on; the hundredth sale, going by the trend, would happen at $1.50. Why? because the value increases exponentially as discussed in the previous paragraph. As more and more SHIB exists the pool, the available amount of SHIB decreases which will increase it's price based on the formula = X * Y = k in order to keep the perfect 50:%0 ratio of ETH and SHIB. Also note that every transaction in a liquidity pool comes with a tax which is generally a very small percentage of the trade. We will discuss what it is being used for in a minute.


An example of a liquidity pool is - Uniswap. Uniswap allows to trade almost any ETH token for any other ETH token for a small fee. Now there arises a question - what if we have a bunch of SHIB tokens and instead of ETH, we want GRAPH tokens which is not in this liquidity pool? Well most of the decentralized liquidity pools allows traders to perform this trade by connecting to another liquidity pool which sells GRAPH token. This usually happen with multiple swaps i.e., first pool A will take SHIB tokens and convert it to ETH, then swaps this ETH with GRAPH token in pool B and gives this GRAPH tokens to the user. This is referred to as - routing. Routing allows a decentralized liquidity pool to exchange any token for any other tokens by literally routing the trade requests to appropriate liquidity pools even if they don't trade that token.

Investing in a Liquidity Pool

Anyone can be an investor in a liquidity pool. When someone puts money in a liquidity pool, that person is refereed to as a liquidity provider. Remember how each trade costs a small fee or tax? It goes to the liquidity providers, for providing that 'liquidity' for the traders to trade, based on how much money each of them have put up. When more and more people trade on a liquidity pool, those fees will add up and becomes a huge amount. For example some decentralized exchanges offer up to 500% APR or Annual Percentage Rate to the liquidity providers because the pool needs more liquidity providers to get more liquidity in the pool and there aren't many liquidity providers in the market as the crypto trading is yet to reach out to a lot of people. As more and more people joins the pool, this rate comes down which is fairly expected.


As the pool grows in liquidity, i.e. as more money is put in to the liquidity pool, it takes much more money to move the price of the assets. For example, let's say in a $2000 liquidity pool if someone swaps $500 of ETH tokens for SHIB tokens, this will drive up the price of SHIB drastically, because they took out a lot of SHIB from the pool. But if the same happened in a $50,00,000 liquidity pool, this $500 swap barely dents the price because there is a lot of SHIB to be swapped with compared to the $2000 liquidity pool. This is known as 'price impact', which refers to how much a liquidity provider can impact the price of a token within that liquidity pool. Price impact inversely depends on the size of the liquidity pool - smaller the pool, bigger the price impact; bigger the pool, smaller the price impact. When the pool grows, the price impact gets smaller and thereafter large buy-ins doesn't affect the price much.


Another thing worth mentioning about liquidity pools is - Arbitrage Trading. It refers to driving the price of an asset down in an exchange by exploiting the price impact, then buying it and selling it in another exchange for a higher price. For example - say there is small liquidity pool of $2000 which trades in ETH and SHIB where 1 ETH = $500 and 1 SHIB is $1. If someone brought in a lot of ETH and swapped them for SHIB, in that particular pool, the price of ETH drops to say $450. Even if this person has to pay the small trading fee, they can buy ETH for $450 a piece and immediately sell it in other exchanges where the price is $500, thereby making an instant profit of $50 per ETH. It sounds shady but it is allowed to happen because it ensures that the price of an asset remains the same across all the liquidity pools. After one trade, as the quantity of ETH lowers, the price stabilizes. Arbitrage traders trade after paying the pool fees so it is perfectly okay to do so.


There are some cons associated with liquidity pools. Two of the major ones are - impermanent loss and rug pulls. Decentralized liquidity pools are also vulnerable to various hacks. We will talk more about these in another article.

Examples of Liquidity Pools

The following are some examples of decentralized liquidity pools:

and many more.


Couple of other articles which you might be interested in:

How do you rate this article?


Mishal Alexander
Mishal Alexander

Crypto Enthusiast | Budding Blockchain Developer |

What You Should Know
What You Should Know

Welcome to my blog, people.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.