Quantifying TAM of LVR in Uniswap v2 Pools

By
Unit Zero Labs
Research
15
min read

Quantifying TAM of LVR: True Costs to Liquidity Providers

Jack Forlines
Unit Zero Labs
jack@unitzero.io

Connor Flanagan
Unit Zero Labs
connor@unitzero.io


Abstract

This study investigates Loss Versus Rebalancing (LVR), a metric capturing the opportunity cost incurred by liquidity providers in Automated Market Makers (AMMs) compared to dynamic rebalancing strategies. We present an empirical analysis of LVR in a Uniswap V2 pool over a one-week period, utilizing on-chain data and external price feeds. Our findings reveal significant LVR, totaling over $1 million in a seven-day period, or 0.18% of the total trading volume, highlighting the hidden costs faced by liquidity providers in AMM systems.

1. Introduction

AMMs have emerged as a cornerstone of decentralized finance (DeFi), revolutionizing the provision of liquidity for token exchanges by eliminating the need for traditional order books. However, the rigid nature of AMM algorithms, particularly the constant function market maker (CFMM) model, often leads to sub optimal outcomes for liquidity providers (LPs) when compared to dynamic portfolio management strategies. This paper focuses on Loss Versus Rebalancing (LVR), a metric used to quantify the opportunity cost faced by LPs in AMMs (Zhang et al., 2021). Unlike impermanent loss, which compares LP returns to a static holding strategy, LVR measures losses against an optimal rebalancing approach that continuously adjusts portfolio composition based on price movements.

Our study aims to quantify the Total Addressable Market (TAM) of LVR and the true costs to liquidity providers by analyzing a specific Uniswap V2 pool over a one-week period. This focused approach allows us to develop a robust methodology for calculating LVR that can be applied to other pools and timeframes. Moreover, the results from this single pool study will serve as a baseline for comparison with other pools and AMM designs.

The code for our analysis, including reproducible data retrieval, can be found on this Colab notebook.

Our LVR metric is designed to capture the opportunity cost incurred by LPs compared to an optimal rebalancing strategy, while also accounting for real-world constraints such as transaction fees and gas costs. We base our calculations on several key considerations to provide a realistic estimate of LVR.

First, we assume that arbitrageurs can quickly capitalize on price discrepancies between the AMM and external markets, though not instantaneously. This assumption allows us to use actual trade data to measure the price differences exploited by arbitrageurs.

Our analysis incorporates gas fees and other transaction costs, providing a more accurate representation of the net LVR. We calculate the gas cost for each transaction and subtract it from the gross LVR to obtain the net LVR. We model the optimal strategy as one that rebalances in response to each trade in the pool, maintaining a constant ratio of assets as closely as possible given the discrete nature of blockchain transactions.

The methodology of analyzing historical data from a single pool over a defined period offers several advantages.By using actual trading data, we capture the true behavior of market participants, including the impactof market volatility and trading patterns. This method allows us to calculate LVR with some precision,accounting for every trade that occurred in the pool during the study period. While we focus on one pool,the methodology we develop can be easily applied to other pools and time frames, enabling broader marketanalysis in the future. Furthermore, by establishing a standardized approach to LVR calculation, we create aframework for comparing LVR across different AMM designs and market conditions.

2. Theoretical Framework

2.1 Automated Market Makers (AMMs) and Constant Function Market Makers (CFMMs)

The most common type of AMM is the Constant Function Market Maker (CFMM), which maintains a mathematical invariant between the quantities of tokens in its reserves. For a two-token pool (x and y), the general form of a CFMM is expressed as: f(x,y) = k, where f is some function and k is a constant. The most widely used CFMM is the constant product market maker, popularized by Uniswap: x ∗ y = k. This formula ensures that as one token’s quantity increases, the other decreases, maintaining constant total liquidity k.

While this model has proven effective in providing continuous liquidity, it inherently leads to an opportunity cost for liquidity providers (LPs). To understand this, we must consider how the CFMM responds to price changes in the broader market.

Consider a scenario when the market price of ETH changes from $2000 to $2100. The v2 pool’s price recalculation occurs only when a swap is executed in the pool, maintaining the constant product formula. Arbitrageurs can exploit this lag by buying ETH from the pool at a price lower than $2100, triggering a suboptimal rebalance for the LP as the pool effectively sells ETH below the current market price. This automated rebalancing, while ensuring continuous liquidity, results in less value capture for the LP compared to an ideal active management strategy, with the difference quantified by the LVR metric.

Mathematically, we can express this opportunity cost. Consider a pool where the initial state is: x * y = k, where x is the amount of ETH and y is the amount of USDC.

After a price change and subsequent arbitrage, the new state is: ∆x * ∆y = k, where x1 < x2 and y1 > y2

The opportunity cost for the LP is the difference between the value of their position after the CFMM’s adjustment and the value they would have had if they had held the base assets, a phenomenon referred to as Impermanent Loss (IL):

IL = (x1 ∗ Pnew + y1) − (x2 ∗ Pnew + y2)

where P_new is the new price of ETH in USDC.

You could also compare the opportunity cost of maintaining an LP position against a rebalancing strategy, forming the basis of Loss Versus Rebalancing (LVR). It represents the value that LPs forfeit due to the CFMM’s passive rebalancing mechanism compared to an optimal active rebalancing strategy.

Understanding this fundamental aspect of CFMMs is crucial for several reasons. First, it highlights a hidden cost for liquidity providers that is not immediately apparent from the simple x * y = k formula. Second, it explains why LPs might underperform compared to a simple buy-and-hold strategy during periods of significant price movement in one direction. Finally, it provides a theoretical foundation for potential improvements in AMM design, suggesting that mechanisms which can more closely mimic optimal rebalancing could provide significant value to LPs.

2.2 Loss Versus Rebalancing (LVR)

Loss Versus Rebalancing (LVR), introduced by Zhang et al. (2021), provides a more nuanced understanding of the costs faced by liquidity providers (LPs) in Automated Market Makers (AMMs). Unlike impermanent loss, which only considers the end states of a liquidity position, LVR quantifies the ongoing opportunity cost incurred by LPs due to the AMM’s passive rebalancing mechanism.

2.2.1 Discrete LVR Calculation

In our analysis, we implement a discrete LVR calculation that aligns closely with the practical realities of blockchain-based AMMs. For each trade in the Uniswap V2 pool, we calculate LVR as follows:

LVR = a(pm − pa)
where a = quantity of the asset traded (in our case, ETH), pm = market price at the time of the trade (from Coinbase), and pa = AMM’s effective price for the trade.


This formula, created by a16z and consistent with Zhang et al. (2021), captures the difference between the value extracted by arbitrageurs and the value that could have been captured by LPs if they had rebalanced optimally at market prices. This approach allows us to quantify LVR on a granular, per-trade basis, providing insights into how opportunity costs accumulate over time and under different market conditions.

2.2.2 Net LVR and Transaction Costs

A key element of our analysis is the incorporation of transaction costs, specifically gas fees on the Ethereum network. This provides a more realistic estimate of the economically viable arbitrage opportunities. We calculate the gas cost for each transaction:

gas_cost = (float(row['gas_price']) * float(row['gas_used'])) / 1e18 * coinbase_eth_price

We then compute the net LVR by subtracting the gas cost from the gross LVR, but only if the LVR is positive:

price_diff = coinbase_eth_price - uniswap_eth_price

lvr = eth_amount * price_diff

net_lvr = lvr - gas_cost if lvr > 0 else lvr


This approach ensures that we are capturing only the economically significant arbitrage opportunities, as arbitrageurs would only execute trades where the profit exceeds the transaction costs. To collate prices from multiple sources, we conducted significant data cleansing that removed many data points, indicating our results might be somewhat conservative.

2.2.3 Cumulative LVR and Market Impact

While we calculate LVR on a per-trade basis, the cumulative LVR over time provides crucial insights into the overall impact on LPs. By summing the net LVR across all trades in our study period, we obtain a measure of the total opportunity cost faced by LPs:

total_net_lvr = df_swaps['net_lvr'].sum()


Future research could extend this approach by incorporating more sophisticated models of market behavior, examining longer time periods, or comparing LVR across different AMM designs. Additionally, this analysis provides a foundation for developing AMM mechanisms that could more closely mimic optimal rebalancing strategies, potentially reducing LVR and improving outcomes for liquidity providers.

2.3 Rebalancing Strategies and LVR in AMM Context

To fully appreciate LVR, it is necessary to understand the concept of portfolio rebalancing in the context of AMMs. In traditional finance, portfolio rebalancing involves periodically adjusting asset allocations to maintain a desired risk profile or to capitalize on market movements. However, in AMMs, the rebalancing process is automated and continuous, governed by the CFMM formula.

In an ideal scenario, a liquidity provider (LP) would rebalance their portfolio in response to market price changes to maintain optimal exposure to each asset. However, the CFMM model used by AMMs like Uniswap’s v2 protocol does not allow for this type of active management. Instead, the pool’s composition changes only in response to trades.

The difference between this passive CFMM rebalancing and an optimal active rebalancing strategy is what gives rise to LVR. Our analysis quantifies this difference by comparing the AMM’s trade prices to contemporaneous market prices from a centralized exchange (Coinbase in our case).

2.4 LVR in the Context of AMM Design

The rigid nature of CFMM designs leads to LVR. As market prices change, the AMM’s price (determined by the ratio of reserves) doesn’t automatically align with the market price, creating arbitrage opportunities. These opportunities represent value extraction from LPs, which we quantify through our LVR calculations. Given our assumptions, this calculation captures the value that could have been captured by LPs if they had been able to rebalance optimally at market prices, instead of relying on the CFMM’s passive rebalancing mechanism.

2.4.1 Comparison to Tracking Error

LVR in AMMs is somewhat analogous to tracking error in index fund management. Tracking error (TE) is typically defined as:

TE = std(Rp − Rb)Where: Rp = portfolio return Rb = benchmark return

Both LVR and tracking error measure the divergence of a portfolio’s performance from a theoretical optimal strategy. However, while tracking error in index funds arises from practical limitations in perfectly mirroring an index, LVR in AMMs is a direct consequence of the CFMM design.

2.5 Implications for AMM Design and LP Strategy

Understanding LVR has significant implications for both AMM design and LP strategy:

1. AMM Design: Protocols may seek to minimize LVR through mechanisms such as:

• Oracle integration for more accurate pricing
• Dynamic fee adjustment based on volatility
• Concentrated liquidity provisions (as in Uniswap V3)

2. LP Strategy: LPs need to consider LVR alongside other factors such as impermanent loss and fee income when evaluating potential returns. Strategies to mitigate LVR might include:

• Providing liquidity in less volatile pairs
• Actively managing liquidity positions
• Utilizing protocols with LVR mitigation features

2.6 Challenges in LVR Quantification

While the theoretical framework for LVR is well-defined, practical quantification faces several challenges:

  1. Price Feed Accuracy: Determining the “true” market price (p in the LVR formula) can be challenging in decentralized, fragmented markets.
  2. Gas Costs: In blockchain networks, transaction costs (gas fees) can significantly impact the profitability of arbitrage opportunities and thus the realizable LVR.
  3. Slippage: Large trades can move market prices, potentially reducing the realized LVR compared to theoretical calculations.
  4. Multi-Asset Pools: While the theory is well-developed for two-asset pools, extending LVR calculations to multi-asset pools (like Balancer or Curve) introduces additional complexity.

3. Results and Analysis

3.1 Overview of LVR in a Uniswap v2 Pool

Our analysis of the Uniswap pool over a seven-day period revealed significant insights into the dynamics ofLVR. The total Net LVR, which represents the TAM for this period in this pool, amounted to $1,039,002.48.LVR constituted 0.18% of the total volume of the pool.

3.2 Daily LVR Analysis

The daily Net LVR exhibited considerable volatility, as illustrated in Figure 1. The average daily Net LVR was $129,875.31, with a median of $1,070.53. This substantial difference between the mean and median suggests a skewed distribution of daily LVR, likely influenced by extreme events. This observation is further supported by the wide range between the minimum daily Net LVR of -$554,826.81 and the maximum of$1,331,579.26.

Figure 1 reveals that LVR can fluctuate dramatically from day to day, with some days showing significant positive LVR (representing larger losses for LPs) and others showing negative LVR. This volatility underscores the unpredictable nature of LVR and the potential risks faced by liquidity providers.

3.3 Slippage Analysis

Figure 2 presents the relationship between slippage and ETH amount traded. The scatter plot reveals a concentration of trades with lower ETH amounts and relatively low slippage. However, there’s a noticeable trend of increased slippage variability as the ETH amount increases. Logically this makes sense: larger trades will incur higher slippage, which could contribute to greater LVR in these instances.

3.4 Cumulative Net LVR Over Time

Figure 3 displays the cumulative Net LVR over the seven-day period. The graph shows a general upward trend, indicating that LVR consistently accumulates over time. However, the path is not smooth, featuring periods of rapid increase followed by plateaus or slight decreases. This pattern suggests that LVR accumulation is not uniform but rather occurs in bursts, possibly correlating with periods of high market volatility or large trades.

3.5 Profitability Analysis

Our analysis revealed that 19,352 trades, or 53.04% of all trades that we observed, were profitable from an arbitrageur’s perspective. These profitable trades generated a total profit of $3,607,285.99. This finding is significant as it indicates that over half of the trades in the pool presented arbitrage opportunities, resulting in value extraction from liquidity providers.

The discrepancy between the total profit from profitable trades ($3,607,285.99) and the net LVR ($1,039,002.48)can be attributed to losses incurred in unprofitable trades and transaction costs. This highlights the importance of considering both profitable and unprofitable trades, as well as associated costs, when assessing the overall impact of LVR on liquidity providers.

The fluctuations in cumulative LVR, including occasional decreases, reflect the bidirectional nature of arbitrage opportunities. While arbitrageurs often extract value from LPs when market prices increase relative to the AMM price, the reverse can occur when prices decrease. In these instances, LPs may regain some value, causing temporary dips in the cumulative LVR. This highlights the complex dynamics of LVR and the importance of considering both positive and negative LVR events when assessing the overall impact on liquidity providers.

These results collectively demonstrate that LVR represents a substantial and persistent source of value extraction from liquidity providers in the analyzed Uniswap pool. The high variability in daily LVR, the relationship between trade size and slippage, and the consistent accumulation of LVR over time all point to the complex dynamics at play in automated market makers.

Figure 1: Daily Net LVR in Uniswap WETH/USDC V2 Pool
Figure 2: Slippage vs. ETH Amount
Figure 3: Cumulative Net LVR Over Time
Hire us to build a website using this template. Get unlimited design & dev.
Buy this Template
All Templates