Follow-Up Analyses of LP Profitability in Uniswap V3

CrocSwap
12 min readJan 6, 2023

--

This post is a new installment in an ongoing series by 0xfbifemboy on Uniswap liquidity pools, concentrated liquidity, and fee dynamics. It is a direct follow-up to a prior analysis, Usage of Markout to Calculate LP Profitability in Uniswap V3, aimed at addressing several finer points which were not adequately discussed.

Introduction

Are liquidity providers on Uniswap V3 profitable? This is a tricky and inexact question to answer, because it depends substantially on how one calculates profitability and what baseline standard for comparison is used. However, one reasonable way to do so is by imagining an entire Uniswap liquidity pool as an active trader and calculating the markout PnL of the trades taken by the pool. This method of analysis, quite common in high-frequency trading firms, was first applied to the analysis of Uniswap LP profitability by Twitter user @thiccythot_, which stimulated a great amount of vigorous discussion.

As part of that discussion, we published a research article last month which expanded upon various points made by thiccythot as well as by the Uniswap team. As we discussed our findings with others, we thought of many rich directions in which our analysis could be extended. This current post is a first attempt to expand upon our prior work and to more deeply expand Uniswap V3 dynamics in the context of markout PnLs, which appear to be a very effective tool for the accurate estimation of the profitability of AMM liquidity providers.

Autocorrelation of swaps on Uniswap V3

One initial question which was not fully explored was the degree to which incoming swaps to the Uniswap ETH/USDC pools are directionally autocorrelated. First, the more autocorrelated the swap flow, the better it is to use an external source of price data for calculating markouts, such as Binance price data. Second, the extent of autocorrelation gives us a sense of the timescale on which microstructural features are visible, which in turn informs our choice of markout period, which must be at least long enough to capture most such features.

Calculating the correlation of swap directionality alone across the ETH/USDC pools’ swap history, we find that swap direction drops off very sharply with respect to the number of contiguous swaps:

While two consecutive swaps have nearly r = 0.1 correlation between their directions, this drops down to nearly r = 0.01 if we consider a lag of 10 swaps and practically zero at 15 or more swaps. This suggests that if our markout periods are generally long enough to include the next 10 or so incoming swaps, we are probably capturing most of the microstructural detail in the ETH/USDC swap flow and need not increase the markout out period excessively beyond that point.

Of course, swaps do not arrive at a fixed rate! However, we can ask the following question: How much time does it take to observe the next N swaps, on average? The distribution of these times is plotted below for several values of N.

Generally speaking, if we want to observe the next 15 or even 20 swaps, we will almost surely do so by waiting 10 minutes! This of course suggests that 10 minutes is a fairly “reasonable” duration to use when calculating markouts. Even 5 minutes is not unreasonable; in over 90% of cases, the next 10 (or more) swaps can be observed by waiting 5 minutes, by which time swaps are only weakly correlated (r = 0.01) with the first observed swap.

Comparing Ethereum mainnet to Polygon

Another interesting analysis we can perform is to compare LP profitability on Ethereum mainnet versus Polygon. In a recent article published in response to my analysis, thiccythot writes that “12 second block times and relatively expensive network fees to cancel and replace orders make [Ethereum mainnet] quite unfriendly for liquidity providers,” meaning that the Uniswap ETH/USDC pool follows, rather than leads, in price discovery. This in turn contributes to poor markout PnLs for Uniswap liquidity providers.

Polygon is an alternative L1 on which Uniswap V3 is deployed with substantially shorter block times and lower fees. In fact, Polygon has an approximately 80% lower block time (2.3 seconds compared to 12.5 seconds) and minuscule fees (easily 90% lower in typical network conditions). Of course, Polygon does not itself lead in ETH/USD price discovery; however, at the very least, the shorter block times and lower gas fees should lead to faster and more efficient arbitrage, which should increase fee accrual for liquidity providers and ameliorate unfavorable markout PnL.

Various problems were encountered with retrieving all Polygon swap data (the rate of block production is very high…); however, in the end, we were able to isolate a 2–3 month segment of Polygon data following the deployment of Uniswap V3 on Polygon which overlaps with the time interval over which our initial mainnet analysis was performed. Repeating the same calculations and comparing the 0.05% pool between both networks, we find that Polygon LPs do a little bit better than mainnet LPs, perhaps losing 10–20% less money on average (the analysis is normalized to the amount of liquidity available at each point in time):

Exactly why do LPs seem to do better on Polygon? In a very simple model, consider that the price of ETH goes from $1 to $1.01 back to $1. If swap fees on mainnet are sufficiently high compared to swap fees on Polygon, it is easy to imagine a case where no arbitrage occurs on mainnet but the Polygon ETH/USDC pools are arbitraged up to $1.01 and then back down to $1.01. Similarly, if the price dislocations occur fast enough, then there may simply not be enough time on mainnet for arbitrage to occur even if arbitrageurs are able to capture the spread up and down on Polygon. It is clearly beneficial for Uniswap LPs for arbitrage to occur in both directions, because at the end their portfolio value is strictly higher (the price of ETH is the same, while they have captured some swap fees from arbitrage).

There are of course many other differences between Ethereum mainnet and Polygon, and it is conceivable that these differences may also ultimately bias the markout PnL one way or the other. However, it appears at least plausible that shorter block times and/or lower fees work to the benefit of Uniswap LPs, even if only modestly. For example, it is empirically clear that swaps arrive at a much higher frequency on Polygon, e.g. if we look at the amount of time it takes to observe the next 20 swaps on each network:

Swaps on Polygon are also much smaller, consistent with the presence of arb flow capturing smaller price dislocations, although of course overall Polygon TVL is also much lower than mainnet TVL, meaning that large swaps are preferentially executed on mainnet to minimize price impact.

Finally, comparing the 0.05% and the 0.3% liquidity pools on Polygon, we observe results roughly consistent with those that we observed when comparing the 0.05% and 0.3% fee tiers on Ethereum mainnet: the 0.3% pool is modestly more profitable than the 0.05% pool.

This is a comforting observation: the reproduction of these same internal relationships in the Polygon data suggests that, while Polygon is qualitatively different from Ethereum mainnet, it is not so different as to make a comparison of the two networks impossible. Consequently, the fact that the relationships between different fee tiers on Polygon display a pattern consistent with those on Ethereum mainnet suggests that the differences we do see between Polygon and Ethereum mainnet may be attributable, in large part, to reduced block sizes and lower swap fees, as previously speculated.

Per-swap PnL by notional trade size

The follow-up article from thiccythot contained an interesting series of analyses looking at how the profitability of individual swaps varied based on the notional size of the swap. He found that small swaps, likely representing uninformed retail flow, are consistently profitable, whereas moderately large swaps, likely representing arbitrage flow, are responsible for most of Uniswap LPs’ losses:

First, we reproduce this result exactly: segmenting trades by their notional trade size, we find that the bottom 75% of all swaps are actually net profitable for Uniswap LPs even when using 10-minute Binance markouts to calculate PnL:

However, the lions’ share of LPs’ losses originate from swaps in the upper 25% (very much analogous to what happens in traditional high-frequency market-making)! These almost surely originate from arbitrageurs taking advantage of price differences between Uniswap and external venues. Also consistent with thiccythot’s analysis, we observe that at the very upper end of trade size, swap PnL appears to tick upwards a little bit, which is perhaps once again due to the introduction of highly insensitive trade flow, this time from protocol hackers looking to buy ETH in enormous swaps as fast as possible.

For reference, the actual distribution of notional swap sizes is illustrated below, showing that the 75th percentile of notional swap size corresponds almost exactly to $100k swaps:

It is also interesting to explicitly consider the profitability of each swap relative to its own notional value. The above plot shows total swap PnL for each percentile of swap notional size, allowing us to see where the aggregate pool PnL comes from. However, we can also ask: what is the per-swap profitability in terms of basis points, in other words, adjusted for the notional size of the swap itself?

Doing so, we see that swaps below the 75th percentile in notional size are profitable to the order of 5 basis points for Uniswap LPs on average, consistent with the numerical result given in thiccythot’s article. After that point, however, profitability drops precipitously, reaching a bottom of nearly 3 basis points of loss for the largest swaps. In relative terms, 3 basis points is not a huge loss; however, because these swaps make up the vast majority of overall swap volume on Uniswap, they dominate the aggregate PnL calculation, resulting in large overall losses.

When we separate out the per-swap relative PnL by fee tier (distinguishing the 5 against the 30 basis point fee pool), another curious pattern reveals itself:

In this above plot, for any fixed percentile of notional swap size, we are considering the same absolute notional swap size for both fee tiers. Therefore, when small swaps actually make it to the 0.3% fee tier, they tend to be quite profitable; however, we can guess from the variation in the plot that the sample sizes involved are relatively low, i.e., it is relatively uncommon for swaps with low notional size to be executed at the 0.3% fee tier.

The fact that swaps are preferentially executed at lower fee tiers if possible likely explains why adverse selection only shows up at the 75th percentile for the lowest (0.05%) fee tier, whereas the extent of adverse selection increases more consistently with swap size percentile for the higher fee tier. It is likely because the majority of the swap flow that is executed in the 0.3% pool is “spillover” from large swaps or correlated groups of swaps which first dislocate the 0.05% pool more than 25 basis points away from the 0.3% pool before resorting to execution against the 0.3% pool. In this setting, it is perhaps intuitive that the extent of adverse selection is greater when the size of such “dislocating,” directionally consistent swap activity is greater.

Finally, when we compare the 0.05% pools between Ethereum mainnet and Polygon, we see that the degree to which Polygon LPs are exposed to advere selection declines with increasing notional swap size in an even more pronounced way:

Notice that in both cases, we are looking at the cheapest fee tier on each network, so there should be no “overflow” effect as with the 0.3% pool on Ethereum mainnet. Why do we see this effect on Polygon, then? The true reasons are not immediately clear; however, one possibility is that there is much less organic flow on Polygon overall, and the probability of any given swap being arbitrage flow therefore increases very consistently with notional swap size. Alternatively, because block times are much shorter and swap fees are much lower than compared to Ethereum mainnet, it is actually more possible to execute small arbitrage transactions which would not be profitable on Ethereum mainnet.

One small note here is that the distributions of notional swap size used to calculate percentiles are different across the mainnet and the Polygon data. We can see that Polygon swaps are much smaller on average:

Therefore, for any given fixed percentile value, the notional swap size referred to is smaller for the Polygon data than it is for the Mainnet data.

Design of a dynamic swap fee

The above discussion motivates the construction of a dynamic swap fee that charges arbitrage flow a greater fee than normal swaps. Clearly, we can distinguish arbitrage flow right now on the basis of swap size; however, if Uniswap increased the swap fee for larger swaps, arbitrageurs would simply split up one swap transaction into multiple swap calls. Such measures are therefore not easy to implement, although one can imagine procedures that change the marginal swap fee based, for example, on the directional imbalance of swap flow that has accumulated across the last N blocks, and so on.

Alternatively, we can think of this as a problem of liquidity overprovision. That is to say, the reason why large arbitrages cause losses for Uniswap LPs is because they are not exposed to enough price impact, because of a substantial oversupply of relatively insensitive liquidity in Uniswap liquidity pools.

What degree of price impact swaps actually subject to? Adjusting execution price to remove fees, we see that price impact is nearly exactly linear in notional swap size:

(The somewhat higher price impact of the 30 basis point fee tier is likely due to the fact that the 30bp pool has lower overall liquidity as well as a different distribution of liquidity concentration across ETH/USDC prices.)

We can formulate an interesting argument around the notion of price impact. Essentially, price impact is just the difference between the final and initial price of a swap; in some sense, then, if our goal is LP profitability, we might want to make prices respond faster to a fixed notional swap size, equivalent to increasing the slope of these curves. How much of a change would it take? Recall that swaps even in the 95th or higher percentile of notional swap size are only unprofitable for LPs by around 2 to 3 basis points! In comparison to the degree of price impact that one typically observes with a 100k+ swap, this is a fairly small amount. As such, we might be able to increase the “sensitivity” of liquidity and change the net profitability of LPs quite substantially with small modifications that do not have overly large effects on the QoL of the typical swapper.

Conclusion

Overall, we make several novel observations:

  • Low level of swap direction correlation after a series of 10–15 swaps suggests that markout durations of 10 minutes at max capture most microstructural features
  • Polygon ETH/USDC pools on Polygon are very similar to those on Ethereum mainnet when it comes to the net profitability of LPs (per a Binance markout analysis) and the relationships between different fee tiers
  • Degree of adverse selection clearly increases with notional swap size, with a minority of swaps responsible for almost all LP losses, even though the magnitude of LP (un)profitability seldom exceeds several basis points in either direction
  • A dynamic approach that adjusts fee based on swap sizes or accumulated imbalance of swap directionalities, or perhaps somehow modulates the sensitivity of pool prices, could be effective in ameliorating LP losses

There is a great deal more interesting work to be done in this area, and we hope that the reader looks forward to our next installment!

-0xfbifemboy

--

--