Since the dawn of human civilization, we have (probably) been exchanging one stuff for another on a daily basis. Fast forward to now, the 8 billion people on this planet form a thriving global economy consisting of millions, if not billions, of markets. But there is still stuff that you can’t easily buy or sell: properties, art, and digital assets like some crypto.
One of the advantages our modern financial system boasts is that with enough manpower and processing power, we can pretty much come up with a solution to any problem. For assets that may not be liquid enough, market makers are here to save the day.
Market making#
In very simple terms, a market consists of potential buyers and willing sellers of a certain asset. When there are enough buyers and sellers, this asset becomes liquid - even if you decide to buy and sell it in quick succession several times for some reason, you won’t lose too much money. The difference between the immediate buy (best ask) and the immediate sell (best bid) is called the spread. Naturally, liquid assets tend to have more buyers/sellers and lower spreads.
But not all assets are blessed with these. For some, there just aren’t enough buyers and sellers to form a thriving market. This is where market makers step in.
In financial terms, market makers are firms (sometimes individuals) that act as buyers and sellers at the same time, effectively helping make the market, hence the name. They would put up limit orders in between the current best bid/ask (and outside them of course) to reduce the spread, while actual buyers and sellers will be able to fulfil their orders at better prices.
Obviously, market makers are not doing this for free. While they have reduced the spread, the best ask is still higher than the best bid (otherwise these orders will collide with each other and get annihilated). Thus, when their best ask is met and best bid is taken, they will be able to earn the difference between these two prices - the spread.
Setting all emotions aside, market makers are just as much of a market participant as any other buyer or seller. The only difference is that they just want the market to thrive so they can make as many times on the spread as possible.
Or is it?
Market making problems#
When something has a price, it’s very likely that this price is determined by its supply and demand. When there is higher demand (buyers), sellers with lower asks will be bought out and the price will go up, and vice versa. But for markets with market makers, things can get a little bit different.
If you must say it, market makers are entities afloat with capital pretending to be everyday buyers/sellers. If they should decide to manipulate the price of a certain asset, chances are that they will get what they want. That’s why there are a ton of rules and regulations to prevent market makers disrupt the market this way. In reality, market makers often have to compete with other market makers for the best liquidity offering so that makes them a little less likely to turn malicious this way.
On the other hand, market makers have their own risks. They can’t just place limit orders in between existing spreads and sleep on it. If the asset depreciates too fast, they run the risk of bulk-buying assets that are worth much less, resulting in a huge drop in their portfolio value. Even if the price hikes up in a few minutes, they will still be at the risk of not being able to properly make the market - without enough assets to place sell orders (because they have sold most of them) while holding more and more assets that don’t appreciate (say USD).
Modern market maker firms are complex institutions that actively adjust their strategies to market conditions and their risk appetite. That’s why they hire some of the most brilliant minds on this planet to make sure they are consistently making more money while properly making the market. In a sufficiently healthy market, traders are trading assets with ease on more than enough liquidity, market makers are profiting off of the tiny spread many times a day, and exchanges are earning trading fees from thousands of orders fulfilled each day.
Automated market makers#
Just when everyone looks happy in these markets, blockchain and crypto enter the conversation. The good news is that cryptocurrencies can be traded on order-book-based exchanges (like centralized exchanges or CEXs) and traders will need market makers to get a better experience. On the flip side, it looks like crypto shuns anything that’s not properly decentralized so people are seeking alternatives to centralized institutions.
Enter decentralized exchanges with their automated market makers - liquidity pools managed by on-chain smart contracts that process any buy or sell orders within seconds. They are the market makers and the exchange at the same time. When traders submit an order, they will immediately get a quote based on the assets available in the liquidity pool. You don’t have to go through KYC, AML, or any other hassle involved when you trade on a CEX.
The first generation of AMMs is pretty simple and straightforward. Most of them are constant product market makers (CPMM):
X * Y = K,
Where X is the number of one asset in the liquidity pool and Y is the other. X times Y will always be the same constant K and the price of one asset in relation to the other is represented by the ratio between them (Y/X).
Let’s go through an example that has been put forward a thousand times: we have an ETH-USDC liquidity pool consisting of 1 ETH and 2,000 USDC. The constant K is 2,000 and the price of ETH is currently 2,000 USDC.
Alice decides to swap some ETH worth 2,000 USDC from this pool. She deposits her 2,000 USDC and the pool must give out 0.5 ETH to keep the constant product. As a result, Alice gets 0.5 ETH for 2,000 USDC (4,000 USDC per ETH) and the pool now has 0.5 ETH and 4,000 USDC. The price of ETH is now 8,000 USDC (4,000/0.5)
At first glance, this is as decentralized and permissionless as a blockchain enthusiast could ask for. But things are never that easy.
For one, these AMMs are disconnected from all CEXs so they will never adjust the ratio of the assets without swapping with external traders. This gives arbitrageurs plenty of room for profit when the price fluctuates. To make matters worse, they rely on arbitrageurs to push the price to the right point. And when arbitrageurs who trade against these AMMs profit, someone will lose.
Everything is impermanent#
It wasn’t long before someone did some math and found out the problem with CPMMs. If we go back to the Alice example, we will notice that as liquidity providers, our portfolio (the entire liquidity pool) changes whenever someone swaps their assets. We started with 1 ETH and 2,000 USDC when ETH price was 2,000 USDC, and ended up with 0.5 ETH and 4,000 USDC when the price of ETH was 8,000 USDC. Our portfolio value went from 4,000 USDC to 8,000 USDC.
You may be surprised when I say our portfolio is suffering from impermanent loss even when it just doubled in value. The way impermanent loss works is that we are not comparing our portfolio to its former self, but a hypothetical hodler who never put their assets into this liquidity pool. Say we have 1 ETH and 2,000 USDC and the price of ETH just went from 2,000 to 8,000 USDC, our portfolio will be worth 10,000 USDC, as opposed to 8,000 USDC if we put them into this liquidity pool. Our impermanent loss, in this case, is 2,000 USDC - the difference between the hypothetical hodler portfolio and its current state (minus any fee we may receive as liquidity providers).
The reason it’s called impermanent loss is if ETH goes back to 2,000 USDC, our portfolio will be reverted to 1 ETH and 2,000 USDC - exactly the state we started with, and with no profit or loss whatsoever. This term indicates that if we wait until the price goes back to when we deposited our assets, we won’t suffer from any loss if we withdraw.
That doesn’t seem fair. But if ETH goes down to 500 USDC, your portfolio will become 2 ETH and 1,000 USDC, suffering from a 2,000 USDC loss. And if you’re a hodler, you will still be holding onto 1 ETH and 2,000 USDC that’s worth 2,500 USDC now. You’re now suffering from a 500 USDC impermanent loss.
That’s not all. Impermanent loss only accounts for the value lost at the end of a price movement. If the price keeps moving up and down, the portfolio may lose even more when accounting for loss versus rebalancing (LVR).
Pull dat LVR#
Going back to that AMM with the ETH-USDC liquidity pool. Let’s pretend we’re an average trader who knows when to rebalance our portfolio. When ETH goes up to 8,000 USDC, we will know to sell some ETH to take profit. If we sell 0.5 ETH, as the AMM did but at ETH’s current price, we will end up with 0.5 ETH and 6,000 USDC, 2,000 USDC more than the AMM. And if ETH goes back to 2,000 USDC afterwards, we can buy back 0.5 ETH as the AMM did but, again, at ETH’s current price. We will end up with 1 ETH and 5,000 USDC, 3,000 USDC more than our AMM. This 3,000 USDC is the cumulative LVR of our AMM suffered compared to a somewhat-active rebalancing strategy. Refer to the table below for more information (all values are calculated in USDC):
ETH Price | AMM Portfolio & Value | Hodler Portfolio & Value | Rebalancing Portfolio & Value |
---|---|---|---|
2,000 | 1 ETH + 2,000 = 4,000 | 1 ETH + 2,000 = 4,000 | 1 ETH + 2,000 = 4,000 |
8,000 | 0.5 ETH + 4,000 = 8,000 | 1 ETH + 2,000 = 10,000 | 0.5 ETH + 6,000 = 10,000 |
2,000 | 1 ETH + 2,000 = 4,000 | 1 ETH + 2,000 = 4,000 | 1 ETH + 5,000 = 7,000 |
Clearly, there’s no end to how well our rebalancing strategy can be optimized, but LVR will just settle for a simple buy high and sell low when the price is right.
To eliminate impermanent loss and LVR, researchers and developers have entered the arena to come up with the best AMM formula.
AMMs galore#
Before we set sail in this direction, I must state that all of the calculations above have not accounted for trading fees, which would have made up for either impermanent loss or LVR to some extent.
Our first contestant is Uniswap, the very protocol that made CPMMs famous. With their time-weighted average price (TWAP) and concentrated liquidity mechanism, they aim to make AMMs resistant to impermanent loss. The TWAP mechanism is an oracle that calculates the price of an asset not by its current state, but the trajectory it has gone through - its history prices up to a certain point weighted by the time it has spent on each price point. This reduces the price impact from everyday orders and prevents price manipulations from malicious arbitrageurs.
Their concentrated liquidity turns one liquidity pool into thousands of mini liquidity pools where the assets are only utilized within a certain price range. This way, AMMs will behave somewhat like order books and traders can enjoy a CEX-like experience where limit orders become possible.
Bancor v2.1 proposed a single-sided liquidity pool. Liquidity providers (LPs) can deposit any single asset of their choosing and Bancor will mint BNT as the other asset. With trading fees also paid in BNT, as long as BNT is well managed and reasonably priced, there seems to be no way this could fail or even incur too much loss.
Other contestants, like DODO, chose a more traditional path where they tried to actively rebalance the liquidity pool based on the supply of two assets. Their proactive market maker (PMM) believes there will always be an equilibrium where the two assets are ‘balanced’. Any swap will tip the scale towards an unbalanced state and the price will try to correct itself back to the equilibrium. Until then, PMMs will attempt to balance their portfolios by buying back the asset they just sold at a slightly lower price or selling the asset they just bought at a slightly higher asset, pocketing some profit in the process.
One protocol, Clipper, even claimed to have eliminated impermanent loss with their formula market maker (FMM). This new market maker will be even more active than DODO in rebalancing their multi-asset liquidity pools. In fact, they behave just like the average trader in our LVR example, buying low and selling high because they believe crypto moves like stocks or commodities: a daily rebalancing process will correct any movement they made at the beginning of the day. FMMs take advantage of this process and reap some of the profit for their LPs, effectively becoming arbitrageurs themselves.
There are dozens more of other innovative AMM designs and I’d be damned if I could cover all of them in one article. These designs, however, were all haunted by the same problems.
Are they real?#
If you haven’t noticed, almost all AMM designs after the CPMM model have been developed and optimized to minimize impermanent loss or LVR. But is that the right cause?
When we trade crypto, we all wish we were hodlers who held onto an asset that 1000X later on. But the sad truth is, fewer than 0.01% of us could actually do that. You often hear people wish they had bought BTC at $0.01, but few could still hold their nerve if one of their stocks just doubled in price.
The problem is the same but more complex with LVR. We all wish we could buy low and sell high, but that’s just as impossible. When we buy low, the price may just go a little bit lower and when we think we’ve sold high, there will always be some room for the price to go up. As Tom Hougaard stated in Best Loser Wins,
I (Tom) have seen a lot of trading systems, but none of them had an acceptable success ratio of predicting tops or bottoms.
This is why I say that you should buy strength and you should sell weakness. Buy high, sell higher; sell low, buy back lower.
A wise trader (and most of the time, a profitable one) will not attempt to catch the reversal but follow the trend because no one and no machine on this planet can consistently time the market that perfectly.
In fact, as we mentioned several times in this article, it often takes modern market makers an army of talents to constantly adjust their strategies to get an edge in the market and be consistently profitable. How can we hope a pre-defined formula (that’s even open for all to see) can outperform the market when there are predators everywhere trying to take advantage of others whenever there’s a bit of information gap?
Impermanent loss and LVR are not fair benchmarks for AMMs, to begin with. Setting aside the fact that they both represent a ‘perfect’ hodler/trader, when a liquidity pool decides to buy or sell an asset to adjust its portfolio, the rest of the market will absorb the impact. Besides, in a sideways market, your impermanent loss will likely be close to 0 and your LVR will keep piling up. But market makers love sideways actions because that’s when buy orders and sell orders both get easily filled and trading fees accumulate. LPs will likely not pay any attention to impermanent loss or LVRs since they are outperforming hodlers and even some rebalancing strategies.
But that’s not all. Let’s go back to the Alice and ETH-USDC liquidity pool example. We have been talking about impermanent loss and LVR after Alice swaps some assets from the pool. What about Alice, who just got ETH for 4,000 USDC per when the price has gone up to 8,000?
The elephant in the pool#
Let’s take a step back to the world of traditional finance. As we mentioned above, when an asset goes in a single direction in price, market makers are at the risk of holding the relatively depreciated asset because traders will always pursue the other. That’s why they must actively manage their portfolios with complex strategies and instruments like options.
If we go back to our ‘sufficiently healthy market’ example, the three happy players involved in this market are:
Player | What they do | Make money from | Risks | Playing against |
---|---|---|---|---|
Traders | Trade assets | Other traders | Bad strategy | Other traders |
Exchanges | Trading platform | Trading fees from the other 2 | Bad operation | Other exchanges |
Market Makers | Make markets | The spread | Bad strategy | Other market makers |
On most exchanges, there are several market makers competing for the best execution price. Most market makers will be market-making for quite a few assets on several exchanges. They are all competing against their peers in providing the best service.
I didn’t include arbitrageurs in this table because, on CEXs, they only represent a small fraction of the profit made and are not omnipresent. When price moves, CEXs won’t rely on arbitrageurs because existing limit orders can be replaced with orders that may yield higher profit for traders. Most arbitrageurs are only trying to cash in on a 0.1% price difference or a 0.02% funding fee rate difference between exchanges.
With AMMs, things are completely different. They are both the exchange and the market maker at the same time. But since most AMMs without external price oracles rely on arbitrageurs to move the price, an important player just entered this game:
Player | What they do | Make money from | Risks | Playing against |
---|---|---|---|---|
Traders | Trade assets | Other traders | Bad strategy | Other traders/arbitrageurs |
Arbitrageurs | Squeezing profit | Information gap | Bad info | Other arbitrageurs, traders, and AMMs |
AMMs | Trading platform | Trading fees from the other 2 | Bad strategy/operation & Market fluctuations | Traders & arbitrageurs, plus other exchanges |
By fusing the exchange and the market maker into one, AMMs are no longer market makers spanning across several assets and exchanges but laser-focused liquidity pools. They can not compete with their peers on the same platform and must now trade against everyone who swaps on them, including the arbitrageurs they rely on. Even if they fail in the competition, they will still fall prey to the arbitrageurs because without enough traders, their price won’t move fast enough, and there will still be enough profit to motivate the arbitrageurs.
In this state, the market becomes a zero-sum game where for one side to make money, the other side must suffer from losses. And since AMMs are passively trading against everyone else, they are doomed to be the losers. Arbitrageurs are taking the profit away from traders and AMMs alike because if they don’t, they will become just another average trader in the dark forest - fresh meat on the table.
To solve the AMM problem once and for all, we must first break this dynamic. Some choose to introduce more incentives and make everyone more profitable, like issuing new tokens to make up for the loss. But that’s like putting a band-aid on a dam failure. New tokens can be easily manipulated and go horribly wrong, not to mention fixing the economics by inflating the market is always a debatable move. Or, we can introduce new players or break existing players up, like splitting exchanges and market makers, MEV auctions, and more.
With their V4 proposal, Uniswap introduced hooks, a series of function triggers that can be programmed into your smart contracts. Some protocols, like Arrakis, have already tried to minimize LVR with their Arrakis Diamond protocol. If block builders wish to profit from price fluctuations, they must first deposit enough collateral to counter their actions. Plus, they are required to bring the asset price at AMM in line with external oracles at the first transaction of each block. In return, Arrakis offer them the chance to back-run most transactions for a much lower profit.
Both Uniswap V4 and Arrakis Diamond haven’t been out for long, so we still need more time to see what may happen. In theory, this will significantly reduce arbitrage & MEV activities by turning arbitrageurs (mostly block builders) into players with more stakes in this game and having them duel it out with the whale traders. However, without enough whale traders, arbitrageurs and traders will both likely be discouraged here due to a lack of liquidity.
There are certainly more protocols trying to tackle this problem, and given enough time, smarter and cleaner solutions will surely come up.
Conclusion and afterthoughts
While the first AMM can be traced back to 2017, the first market happened a few thousand years ago. Crypto and blockchain have only gone through a tiny fraction of what traditional markets have experienced. As technology and computation evolve, there will surely be more innovative AMM designs. It’s just that a simple AMM attempting to minimize impermanent loss and LVR may not be what we’re looking for.
Also, maximal extractable value (MEV) plays an important part in arbitrage but since it may take another series of articles to get to the bottom of it and categorizing MEV players as arbitrageurs doesn’t affect the market dynamic this article proposed, I choose to leave it to future content.
Technically, the CEX market dynamic is also a zero-sum game but since most players are competing against their peers, they are always perfecting their strategies and making the market a better place. In other words, if they try to be the best at what they do, they will very likely be profitable, and the market may just be better for it.
Please be advised that none of the above is financial advice.