Automated Market Makers (AMMs) and liquidity pools allow you to trade virtual currencies instantly, without the need for either a conventional middleman or a partner on the other side of the trade.
Ok, that’s the top-line, but there’s loads of other stuff you should know about this concept as it’s very much on the tip of the crypto zeitgeist right now (and it’s something we offer on rhino.fi, if you’ll pardon the plug).
In this edition of RhinoLearn we’ll give you the full lowdown on AMMs and liquidity pools, so you can decide whether you want to trade this way.
Ok, so how do AMMs and liquidity pools work?
Essentially, the liquidity pool provides the tokens you want to trade, while the AMM provides the logic to regulate the trading activity.
Before trading begins, the pool itself is ‘filled up’ with a pair of digital assets, either coins or tokens. So, for example, a pool might be filled with Ethereum and Bitcoin, or Avax and USDT.
The people ‘filling’ the pool are the ones that use the platform (yep, that’s right: the liquidity is actually provided by the users themselves, who receive rewards for their contribution).
Once the pool is filled and trading begins, then the AMM gets to work. It’s an algorithm that is constantly adjusting the valuations of the two currencies in the pool, in response to trading activity.
Right, so how do AMMs and liquidity pools differ from conventional trading?
The traditional form of trading is based on order books, which are basically master lists of all the orders that traders place.
Under this more traditional system, buyers and sellers place their orders and the order book matches them up.
So, if you want to buy 1 Ethereum for $500, your order will be filled when you find someone willing to sell at that price. Neither party can make their desired trade until they get a price match on the other side.
The role of ‘market maker’ in this system is often played by big financial entities, which agree to buy and sell at specific prices and so provide the liquidity the system needs (i.e. they provide a guaranteed market by completing trades which might otherwise be impossible). These organisations often charge a fee for this service.
With AMMs and liquidity pools, by contrast, take a very different approach.
When trading begins, traders buy from and sell into the pool directly. In other words, they don’t have to wait for a trading partner on the other side. The system itself acts as the partner, buying and selling the assets.
Then, as trading continues, the two currencies in the trading pair will go up and down. Returning to our ETH-USDT example, if traders were buying loads of ETH, then the size of the ETH pile would go down and the USDT pile would go up.
The AMM uses this information to provide price updates: there’s no need for a human to oversee the process. Which means you always get accurate valuations in real time.
Wait, how does the AMM determine the price of the two tokens in the pool?
Ok, we’re going to get into the weeds here, so bear with us.
First off, it’s important to note that AMMs and liquidity pools always strive to reflect the valuations of tokens in the outside world.
In other words, the liquidity pools don’t create a bubble, cut off from what happens on other markets. If they did, they would create what are known as arbitrage opportunities – valuation glitches that allow traders to rush in and trade tokens for a better price than they would get elsewhere.
To ensure this doesn’t happen, the person who opens the pool (the first liquidity provider) provides tokens on both sides of the pair, in a balance that reflects their real-world valuations.
So let’s say, for example, we’re opening an ETH:USDT pool and 1 ETH is worth $50 USDT. To ensure the pool reflects these valuation, the first liquidity provider might provide 1 ETH and $50 USDT, 2 ETH and $100 USDT, 0.5 ETH and 25 USDT… you get the picture.
From then on, every subsequent liquidity provider must also fill up the pool on both sides, in the same balance.
Then, when the pool opens, the AMM algorithm takes this initial ratio as a benchmark and uses it to continually adjust the weightings of the relative currencies, using a mathematical formula.
AMMs can use several different formulas, but the simplest is called the constant product formula, which is K = X * Y. ‘X’ and ‘Y’ are the two tokens in the pool, and K is the total liquidity, which must remain constant.
What this means, in very simple terms, is that K cannot change from its initial value when the pool opens. So, if either ‘X’ or ‘Y’ goes up, the other must go down – and this triggers a change in their valuations.
Confused? Don’t worry, here’s another simple example:
Let’s take another dip in our hypothetical ETH:USDT pool, with its 1:50 valuation.
Let’s imagine that before trading starts we filled the pool up to 10 ETH (X) and 500 USDT (Y). This gives us total liquidity (K) of 5,000 (500 X 10).
Now let’s play it forward, and imagine the first trader in the pool buys 1 ETH, which will obviously cost them 50 USDT. Suddenly the pool contains 9 ETH and 550 USDT.
So now, the sum has to be rebalanced: ‘K’ is still 5,000, but as ‘X’ has gone down to 9, ‘Y’ has to go up to balance it out.
In this case, we can divide ‘K’ by ‘X’ to find the new ‘Y’ value, which is 55.56 (the AMM will do it far more smoothly than this, but we hope you get the picture).
One final note before we leave the math behind: the trading platform will typically fill the pools as deep as possible, to minimise the risk of ‘slippage’ – a shift in price while the trade is being processed.
If the pool is shallow, a large trade can instantly distort the prices of the two currencies, and a trader may find the final price of their trade is far different to the one they wanted.
What are the benefits of providing liquidity?
Those who provide the liquidity will typically receive interest for doing so. Just like conventional market-makers, they will be rewarded with a share of the fees generated on the platform.
But even more than that, they will play an active role in the platform they use to trade. Instead of relying on faceless corporations, they take control themselves.
This is true decentralised finance at work: the system is built for the community, by the community.
What kind of trades are suitable for AMMs and liquidity pools?
As mentioned above, AMMs and liquidity pools are best-suited to simple, binary trades.
If you want to make complex trades involving several different assets, an old-school order-book system is still better, as it allows for more flexibility.
At rhino.fi we offer both order books and AMMs. In fact we plan to roll out a feature that compares both the AMM and order book markets, to ensure our traders get the best deal.
So, in summary:
- Liquidity pools are pre-filled with pairs of assets, and traders buy from and sell into these pools directly.
- The AMM adjusts the price of the two assets in response to trading activity.
- The community provides the liquidity, thereby taking ownership of the whole system and removing the need for banks and financial institutions.
Ok, now you know how AMMs and liquidity pools work, why not try ours? We’ve just launched our first pools and will be rolling out a total of 17 over the next few months. Get involved by checking out our dedicated page here (LINK TO AMM/LIQUIDITY POOLS HERE).
And if you’ve enjoyed this edition of RhinoLearn and want something even more advanced, check out our explainer on API trading here.