DeFi Deep Dive: Uniswap Part 2
Introduction
This research is an extension of our first deep dive into the DeFi ecosystem, starting with constant product AMMs, namely Uniswap.
Check out part 1 on our analysis of the Uniswap V 3ETH/USDC pool here:
The TLDR of the first part is that we used “markouts” to measure execution quality of the Uniswap ETH/USDC pool. It shows that LPs have been losing money on average since the inception of V3.
Our friends at Crocswap dived even deeper, exploring improvements to the markout methodology. Huge kudos to 0xfbifemboy for his detailed analysis and for opening up further research discussion on the topic.
In part 2 of this analysis, we’ll respond to some of the findings of the Crocswap analysis and dive deep into some data on how to conceptualize the state of the AMM world.
X Marks the Spot
Behold this beautiful graph.
Trading is just a measurement problem. When it comes to measuring execution quality, using the right price to mark your trades to is very important.
In my initial analysis, I marked trades to the last trade measured by the Uniswap trade price x minutes in the future. This is obviously not the most accurate thing to do because Uniswap is far from the leading source of price discovery for ETH/USDC.
0xfbifemboy performed the 5-minute markout analysis using 1-minute Binance candles that look even more negative than the initial analysis. Binance marks are truly the gold standard, since they have over 60% of spot market share and lead price discovery for ETH.
This is damning evidence that the true 5-minute execution is clearly worse than initially thought. This is not surprising because in the original analysis, the markouts continued to degrade with a longer time horizon until it saturates at around the 1 day horizon.
Because price discovery on Uniswap ETH/USDC lags behind centralized exchanges, it should be intuitive why the 5 minute markout using Uniswap’s last swap price underestimates compared to when using Binance.
As stated in 0xfbifemboy’s analysis, shorter term markouts tend to have higher bias due to outsized impact of the trading fees on the impact and lower variance. Imagine if we measured a 100 millisecond markout, then using the pool mid price would always look amazing.
Last traded price converges to the fair price quicker than using mid, which is especially important when the venue you are marking prices to has very slow price discovery like on Uniswap.
Another beautiful chart by 0xfbifemboy displays this effect very clearly. There is a lagging effect on Uniswap compared to Binance, whose short term markouts and long term markouts have less decay. Binance converges to the fair value much quicker than on Uniswap.
Here we can visualize the bias-variance tradeoff for the 5min, 1hr, and 24h markout horizons using Uniswap last trade data. LPs are losing around 2–4 bps on average (YTD data).
Price Discovery
So why isn’t Uniswap the source of price discovery for ETH/USDC?
- Block times too slow
- Expensive to cancel orders
12 second block times and relatively expensive network fees to cancel and replace orders make it quite unfriendly for liquidity providers.
Market makers on CEXes typically enjoy 20–50ms of round trip latency on tier 1 crypto exchanges, alongside free cancellations and high messaging limits, all of which is absent on-chain. Since the price discovery is happening off-chain, most of the flow on-chain is from arbitrageurs moving the price in-line with fair value.
Wide spreads along with gas fees make it uneconomical for large taker volume to occur on Uniswap, putting it at the bottom of the router for order flow. This makes the aggregate order flow quite toxic, hurting LPs.
The above shows rolling 30d aggregate markouts measured in bps for the Uni V3 ETH/USDC pools, which are almost consistently negative all year.
Most of this negativity can be explained by network fees. Gas can be viewed similarly to an exchange fee since it’s part of the bid-ask spread that the network captures on every trade.
The network has captured around $600M in gas fees (marked to market at time of trade) for Uni V3, and all of Uni has done over $1.2T in trade volume since inception. This equates to roughly 5 bps aggregate capture from the network.
The network capture varies with demand for blockspace , having peaked during the bull market run-up to over 9 bps. As things have cooled, it currently sits at a more reasonable 1 bp.
For reference, the capture on Binance ETH/BUSDon their highest tier is ~1.07 bps (-1bps maker, 2.07 bps taker).
As you can see, improving gas efficiency in AMM design is very important in reducing LP negativity. The LP wants to capture as much of the spread as possible. What if the MEV from Uniswap pools could be retained only by the pools LPs? 🤔
All flow is equal, but some flow be more equal than others
0xfbifemboy looked at dynamic fee pool simulations in an effort to reduce the arb:retail flow ratio.
This operates under the assumption that arbitrage flow (read: toxic) is much more fee sensitive than retail flow (read: uninformed). During times of turmoil, which coincide when the pool loses the most money, wider fees could shift the equilibrium of arb:retail volume such that the LP can actually turn a profit.
DeFi is supposed to be permissionless, but some flow (retail) is clearly more desirable than others. Is there anything else we can do to segment the flow we get?
Segmenting our flow by swap size shows 3 clear swapper profiles.
- Swaps < 175k notional are skewed towards retail swaps and have positive markouts for LPs.
- Between 175k and 4M swap size is highly toxic and likely result from an imbalance of sharky taker flow.
- Anything above 4M is likely price insensitive flow from a hacker trying to dump that is quite profitable for the protocol.
These results should be quite intuitive to any market maker. Small trade sizes are typically more uninformed and are more likely to be indicative of benign two-sided trading. A market maker’s paradise. These are typically 5 bps positive for the taker! Incredibly juicy.
Larger trade sizes usually correspond when spot prices move violently, correlating with more adverse selection for makers.
Markouts are in aggregate positive until we start including flow from the 85% percentile trade size and above. Power law baby.
From a pure trading volume perspective, swaps < 175k notional make up less than 15% of total volume. The pool is truly mostly arbs.
In a completely permissionless world, actually implementing this segmentation can be tricky. Smart takers can break up their transaction sizes or send from multiple addresses, sneaking through like wolves in sheep’s clothing.
Ideally, we can alter the price impact model function based on the inflection point of trade size for any given pool so that the LP can capture all any additional benefits. We would rather not enforce limits that just require more gas from takers because as we mentioned earlier, the network captures all of that spread.
This is just another suggestion under the grand vision of shifting the equilibrium of retail flow and toxic flow more favorably for LPs. Market making has always been a challenge of figuring out how to cater to trading profiles of profitable uninformed flow while defending oneself from sharks looking to pick you off.
Interested in contributing to the Friktion quantitative research and strategy effort? Join one of our Taskforces and let’s build the future of finance together.
Website: friktion.fi
Twitter: @friktion_labs
Discord: discord.gg/friktion
Medium: friktionlabs.medium.com
Documentation: docs.friktion.fi