How Resilient is Uniswap v3?
This is the second post in our series, co-written with Polina Nezlobina and Nikita Zinoviev, on order flow toxicity on decentralized exchanges. For other posts in this series, see: part one (on execution strategies for large orders), part three (on execution with Uniswap range orders), part four (solving order flow toxicity).
Introduction
In our first post, we discussed two strategies that regular, non-arbitrage, traders can use to execute large swaps on centralized exchanges. The first strategy is to split a large order into several small market orders and execute them gradually over time. With this approach, the trader tries to take only liquidity that is very close to the mid-price at each point in time, without walking through the order book. For this strategy to work, the market needs to be liquid and resilient.
As before, we will focus on Uniswap v3 — perhaps the only decentralized exchange that is competitive in terms of liquidity to the top centralized exchanges. In this post, we focus on the protocol’s resiliency — the speed with which its price recovers and liquidity is replenished after non-arbitrage trades. How resilient is Uniswap v3?
In theory, Uniswap resilience should be high…
Similar to our examples in the first post, let’s say Alice wants to buy ETH 1000 for USDC. Assume that the current price of ETH on Uniswap is USDC 1000 — we will call it the automated market maker’s, or the AMM, price. Let’s further say that there is ETH 20 of liquidity per basis point available around that price. We rounded the price, but the liquidity amount is close to actual in the Uniswap ETH/USDC pool with a 30 bps fee at the time of this writing. This pool is the most liquid ETH-to-stablecoin pair on Uniswap. As in our first post, we ignore gas fees. We can visualize the pool’s liquidity as follows.
In this figure, each bar corresponds to a ten basis point change in price and contains ETH 200 (=10 bps*20 ETH/bps) units of liquidity. Ignoring for now the swap fee, if Alice were to buy ETH 1000 in a single swap, she would have to take the five red bars in the figure above at an average price of USDC 1002.5. This is a 25 bps (0.25%) premium over the current AMM price.
Now consider what happens if instead Alice chooses to take one bar at a time. Recall how the Uniswap protocol works: the USDC that she pays for the first ETH 200 will be immediately put up for sale to the left of the new AMM price. Therefore, the pool’s liquidity after her first swap will look as follows.
Assume that the global market price of ETH stays at USDC 1000 (recall that Alice’s trade is non-arbitrage or uninformed) and that there is a lot of supply and demand on other centralized and decentralized exchanges at that price. Then, the liquidity situation in Figure 2 should immediately attract arbitrageurs, who will buy ETH elsewhere at USDC 1000 and sell it to Uniswap at prices ranging from USDC 1000 to USDC 1001. These arbitrage swaps will push the AMM price back down to USDC 1000 and revert the liquidity position of the pair back to the one in Figure 1. After that, Alice can execute another small swap again at an average price of USDC 1000.5, keeping her total execution cost at 5 bps rather than 25 bps for a single large swap.
So the strategy we discussed last time also works on Uniswap v3 in theory…
…yet not so much in practice
In reality, the benefits of breaking down a large trade are much smaller on Uniswap v3 than on comparable exchanges with central limit order books (CLOBs). To see why, we need to take a deeper dive into how the fee charged by the protocol interacts with the mechanism described above. To incentivize liquidity providers, the ETH/USDC pair charges traders a 30 bps fee for each swap. Now taking into account this swap fee, the pool’s liquidity looks as follows from Alice’s perspective:
Note that the fee essentially creates an after-fee bid-ask spread: the first unit of ETH can be purchased from the pool for USDC 1003 but sold to it only for USDC 997. Once Alice takes the leftmost red bar, the liquidity picture becomes:
The new AMM price is USDC 1001. As before, the ETH liquidity is reduced by the bar that Alice just took, and the USDC tokens that she paid into the pool are now available for sale in the new rightmost green bar.
In the figure above, should we expect the best ask price to return to USDC 1003, i.e., the blank bar to turn red again? Recall that, in theory, our hope is that arbitrageurs will push the AMM price back to the efficient level. But to do so in the presence of the swap fee, an arbitrageur would need to swap the liquidity in the rightmost green bar: sell 200 ETH to the protocol at an average price of USDC 997.5. This is, obviously, an unprofitable transaction for the arbitrageur given that the global market price of ETH is currently USDC 1000. In fact, an arbitrageur would only have incentives to push the AMM price down if Alice first moved it up by 30 bps (the swap fee). Even then, the arbitrageur would only push the AMM price to USDC 1003, not USDC 1000. This brings us to the main point of the post.
In the Uniswap protocol, market participants do not have incentives to push the mid-price towards the efficient level unless it deviates from it by more than the swap fee.
Here one might ask: Doesn’t the same problem apply to the traditional CLOB exchanges?
Not quite. The difference is that in exchanges with limit order books, the liquidity that Alice takes can be immediately replenished by new limit orders. Such new orders can be posted inside the current bid-ask spread, improving it and restoring the mid-price. (We illustrate this process in our next section, which can be skipped by readers familiar with market-making in CLOB exchanges.) In contrast, in Uniswap, liquidity providers cannot move the mid-price and improve the best (after-fee) bid or ask prices. The protocol relies exclusively on liquidity takers for price discovery.
So what is missing? Spread improvement!
Let’s take a closer look at how this problem is resolved on traditional exchanges. Consider a CLOB exchange has a fee structure similar to the pool that we have just considered: a 30 bps taker fee, no maker fee. (While Uniswap returns taker fees to LPs, our argument works even without maker rebates.) In this market, we should expect market makers to be happy to place sell limit orders (red) just slightly above USDC 1000 and buy limit orders (green) just below this price. Assume that initially limit orders are distributed approximately uniformly, with the same density as in our example Uniswap pool, so that the initial order book looks as follows after adjusting for the taker fee:
Now, once Alice takes ETH 200 from the ask side, the after-fee order book becomes:
The main difference with the Uniswap protocol so far is that we do not necessarily expect the USDC that Alice pays for her swap to appear on the bid (green) side of the book.
Observing the book above, Bob, a market maker, can purchase ETH 200 elsewhere at USDC 1000 and put them up for sale on our exchange with limit orders at prices ranging from USDC 1000 to 1001 (or USDC 1003 to 1004 after the taker fee). Bob will then essentially replace the liquidity that Alice just took and make some profit on the way. This, somewhat more subtle, form of arbitrage is sometimes called cross-exchange market making , and hummingbot explains it in more detail. Unfortunately, Bob’s strategy cannot be implemented on Uniswap because LPs cannot move the AMM price by contributing liquidity inside the current after-fee spread.
Is there an easy fix?
It might appear that there is a simple solution to this problem: perhaps, Uniswap should just charge a lower swap fee. We will spare the reader the details, but, roughly speaking, to achieve parity in price discovery, the swap fee on Uniswap should be equal to one half of the lowest maker plus a high-volume taker fee on a comparable CLOB exchange. For pairs like ETH/USD, this number currently appears to be in the neighborhood of 2.5–3 basis points.
Lowering the fee, however, is not free on Uniswap and comes with its own challenges. In CLOB exchanges much of the liquidity is provided by directional traders — market participants who use limit orders to buy or sell one of the assets. In principle, a CLOB market is sustainable even without any taker fees. In contrast, in the Uniswap protocol, LPs are motivated primarily by earning fees from the takers. (As we discuss in our next post, using LP positions for directional trading is not nearly as efficient as using limit orders.) So while lowering the taker fee can improve price discovery and lead to a higher non-arbitrage trading volume, it can also hurt LPs’ revenues. A lower taker fee also increases LPs’ losses to arbitrageurs.
Some evidence of this can already be observed in existing pairs. For instance, at the time of this writing, the ETH/USDC pair on Uniswap with a 5 bps fee has 25% less liquidity and appears to be significantly less profitable for LPs than the same pair with a 30 bps fee. (In one of our future posts, we will describe a simple mechanism to compare the profitability of equivalent pairs with different swap fees.) The ETH/USDT pair with a 5 bps fee has almost five times less liquidity than the corresponding 30 bps fee pair. To summarize, the taker fee can affect LPs’ returns in several different ways. An important issue for Uniswap to resolve is how to achieve price discovery comparable to that of centralized exchanges without significantly lowering its taker fees.
Conclusion
While Uniswap v3 has a lot of liquidity, the protocol does not offer a degree of resilience similar to that of centralized exchanges. In contrast to CLOB exchanges, LPs on Uniswap cannot improve the current after-fee bid-ask spread of the AMM. The protocol relies exclusively on liquidity takers for price discovery, who only have incentives to push the AMM price towards the efficient price once the two deviate by more than the swap fee. As a consequence, the benefits of gradually executing a large trade on Uniswap v3 are usually lower than on comparable CLOB exchanges.
In our first post, we discussed one more strategy for the execution of large trades — splitting them up into small limit orders. Stay tuned for part three, in which we will study the associated risks and benefits on Uniswap v3!
Next series: Designing a low-toxicity AMM