This article looks at the mechanics of CEX/DEX arbitrage trading, focusing on the AMM side of execution, aiming to show the relationship between block time, block base fee, and the participants (LPs, searchers, etc.) involved in these trades. It includes simulation results with available source code.
It is widely believed that CEX/DEX arbitrage trading creates a large portion of DEX trading volume, perhaps even the majority of that volume. The Loss and Rebalance (LVR) Model 1 is a method to quantify and model the amount of arbitrage from a theoretical perspective.
However, it is susceptible to misunderstanding and misinterpretation. For example, some research papers state (or imply) the assumption that LP losses on arbitrage trades grow with the square root of the block time. This comes from modeling LVR in an idealized setting. However, works that actually run simulations (such as this one) generally reveal that shorter block times have minimal impact. How do we reconcile these different results and bridge the gap between theory and practice?
Arguably, much of the difference comes from the assumption that arbitrage is a two-person zero-sum game, as is typically modeled in LVR research. However, this assumption is not valid in a post-EIP-1559 world, where transactions cannot be free. Not only does each arbitrage trade split the profit between searchers, builders, and proposers (SBPs, as mentioned later in this article), it also burns some ETH based on the block space requirements at the time of the arbitrage. To borrow a term from physics, base fees introduce friction into this process. This friction eliminates a large portion of potential transactions and reduces the revenue of LPs.
1 — Personally, I prefer to call it CVR (cost and rebalance) because in real-world DEXs, there is no real entity that accurately quantifies losses through LVR. Instead, a key question that DEX designers and LPs can consider is what percentage of the theoretical LRV they are enduring, i.e. what portion of the LVR is actually the expected loss of LPs in a model where the DEX is used only by arbitrage traders. That said, I will stick to LVR in this article to avoid more confusion.
Price Action Example
Let’s look at the arbitrage mechanism in detail. The following figure shows a typical state in a DEX pool after the price change on the CEX is enough to attract arbitrage.
The following figure depicts the state after an arbitrage trade. The DEX price has shifted from P_Old to P_DEX, and LPs sell their assets at the P_Sale price, which represents the geometric mean between the two prices. The new DEX price is still slightly off from the CEX price, but still within the non-arbitrage zone. Therefore, unless the CEX price rises slightly or falls sharply to completely cross the non-arbitrage threshold and then some, no further trading will occur.
What happens if the CEX price rises 0.001% now? No trading will occur. This is because, on both sides of the non-arbitrage gap caused by the pool swap fee, there is a friction area caused by the blockchain's base fee and other factors, including CEX fees (if any), priority fees and bribes to block proposers, arbitrageurs' prediction accuracy and risk tolerance, etc.
For the purpose of this article, it is assumed that the block base fee causes most of the friction and other factors are ignored. The friction caused by the base fee is predictable by arbitrageurs, and they are unlikely to create any swaps when the expected profit after subtracting the expected base fee of the next block is negative.
Single Transaction LVR Analysis
When the difference between the CEX and DEX quotes is large enough to exceed the pool's swap rate, an arbitrage trade is triggered. But the LVR achieved by a single arbitrage trade is not proportional to the spread. Instead, the LVR is proportional to the difference between the trade execution prices on the CEX and DEX. Assume that the CEX trade execution price is equal to the quote, but the DEX trade execution price is P_Sale, which is the geometric mean of the quotes before and after the trade.
In addition, a single transaction LVR is distributed among three entities:
Liquidity Providers
Searchers, block builders, and block proposers (SBPs) as a collective entity
ETH holders, affected by the ETH destroyed in the transaction
LPs collect swap fees, while SBPs collect arbitrage profits, which are then distributed among these three participants. It is not surprising that synthetic searchers-builders dominate the arbitrage market, as they deal with a simplified version of the principal-agent problem in profit distribution.
ETH holders are not directly compensated, but their ETH value will increase slightly in the long run due to deflationary pressures.
High volatility increases the likelihood of price increases, thereby increasing arbitrage trading. Furthermore, it makes the expected jumps larger. LP fees are usually uncorrelated with volatility, leading to an unfair distribution to LPs when volatility rises.
By comparing the LVR of a single trade and the LP fee for that trade, we can assess the fairness of that trade to LPs. In the case of a smooth price evolution with no jumps, LP fees almost recover the LVR and LPs lose little. However, if the DEX to CEX spread fluctuates due to block time granularity or actual price discontinuities on the CEX, the LP fee will be less than the LVR, resulting in some losses for LPs for this (theoretical) rebalancing strategy.
Example Scenario
Let's model the range of liquidity for the Uniswap v3 ETH/USDC 0.05% pool. As of April 2024, it holds about $1 billion worth of virtual assets, equivalent to about $150 million in physical assets, with a liquidity concentration of 6. Having deep liquidity is critical if we want to be able to arbitrage swaps even on relatively small scales and price changes.
A simple Uniswap v3 swap might consume about 150,000 Gas, equivalent to a USD cost of $10 per swap, assuming a reasonable 22 gwei base fee cost and a $3,000 ETH/USDC price. Costs could easily increase several times during DeFi stress and high volatility periods.
Example 1
Assume that the starting price of ETH on both CEX and DEX is $3000.
First, let's see what happens when the CEX price changes by +0.1%. The current CEX price is $3003, which is outside the non-arbitrage zone. The arbitrageur calculates the DEX target price P_T, which is equal to 3003 · 0.9995 due to the 0.05% fee charged by the mining pool, and exchanges part of the USDC for ETH on the DEX, raising the DEX price to the target price. The swap amount is defined by the liquidity L in the pool and the (virtual) reserves x and y:
This will return the amount without fees, to get the input amount with fees the result must be divided by 0.9995 (for a 0.05% pool).
LVR is calculated based on delta and the CEX price P_C:
Then, LVR is divided into the LP fee part, the SBP profit part, and the block basic fee, which does not depend on the details of the transaction except its Gas cost:
If the estimated SBP profit is positive, the trade may happen, otherwise it will not.
For the example pool of $1B worth of virtual assets, the LVR of the swap is $93.66 and the LP fee is $62.46, resulting in 33.3% of the theoretical single trade LVR being realized as LP losses. About a third of the losses come from the $10 block base fee.
Example 2
Keep the same assumptions, but let the CEX price change by 1%.
In this case, the LPs do earn an impressive fee of $1,184.66. However, the single transaction LVR grows much faster, to $12,406.47, meaning that LP losses account for 90% of the theoretical LVR.
This shows that LP losses are super-linear with price changes. The price increased 10x (0.1% vs 1.0%), but LP losses increased by more than 360x ($31.19 vs $11,221.81).
Example 3
From the previous examples, it can be seen that LPs are better off if they can trade gradually, rather than all at once.
Let us consider a short block world where the price changes by +0.1% twice (i.e., from $3000 to $3003 and then to $3006), and a long block world where the price changes by +0.2% once.
The LP fee is $187.39, which is the same in both cases. (These transactions are path-independent because we assume non-compounding fees.) However, the LVR for the second one is higher.
Specifically:
For the short block, the cumulative LVR is $343, and the LP loss is 45.4%.
For the long block, the cumulative LVR is $468, and the LP loss is 60.0%.
Example 4
Finally, let's consider the example of oscillating prices. First, the price changes by -0.1%, and then increases to +0.2% from the starting price. In the short block world, LPs were able to trade both, while in the long block world, LPs were unable to trade the price drop and its reversal because they both occurred within the block.
The results are:
For short blocks, the cumulative LVR is $843, LP fees are $312, and LP losses are 63.0%.
For long blocks, the cumulative LVR is $248, LP fees are $187, and LP losses are 60.0%.
This example shows that LVR is a counterintuitive metric. In the short block world, the pool has much higher volume and collects correspondingly higher fees. Moreover, the final price is the same, so the impermanent loss is equal in both worlds. However, both the realized LVR and the LP loss quantified by the LVR are higher in longer block worlds.
Example Summary
To summarize the results:
If prices can be modeled as a GBM process, then overall both models suggest that a short block world may be preferable.
If prices follow some other pattern, such as fluctuating around the mean, then shorter blocks will lead to worse outcomes according to the LVR model.
The LP results are summarized as shown in the figure above.
It is worth emphasizing that using impermanent loss + fees as a measure yields very different results from the LP perspective:
However, we know that for volatile pairs that follow the GBM assumptions, the IL and LVR based models should eventually converge to the same results, since the expected value of the LVR is equal to the expected value of the IL. We need to look beyond the specific cases analyzed so far. See the next section!
Simulation Study
The following chart shows DEX performance metrics simulated using a stochastic GBM. The simulation assumes an annual volatility of 50%, which corresponds to a daily volatility of about 2.6% for 12-second blocks and a volatility of 0.03% per block. This is roughly how ETH has fluctuated in recent years.
The simulation ran for 3600 seconds, and by coincidence, the LVR was about $1 per second or $3600 per hour². LP losses range from $350 to $900 per hour ($3-8 million per year). To be clear, this theoretical model does not include any LP fees from noise/uninformed traders, whose LVR is expected to be zero, thus compensating LP losses on arbitrage trades.
The results show that when the basic fee is zero, the LP loss can indeed be calculated by the function sqrt(blocktime) + const is modeled exactly (i.e. not by its own square root, since there is some offset from the x-axis even for short blocks). However, this result no longer holds after we introduce the EIP-1559 basefee into the model, since more frequent transactions also consume more ETH, offsetting much of the positive effect on LP fees - see results below. Furthermore, and more importantly, the basefee costs increase by a constant offset from the x-axis.
² — Due to the settings chosen for the simulation, the results can be used as a rough and likely very inaccurate approximation of the Uniswap v3 USDC/WETH 0.05% pool on mainnet. Analyzing the matches and identifying the biggest reasons for the differences between the empirical performance could be a subject of further research.
Generalizing the results
to other pools. The simulation results are specific to the USDC/ETH 0.05% pool, which is typically the most liquid volatility pool on Uniswap v3. For pools with lower liquidity, the importance of friction caused by the basefee will increase. For example, assume the ETH/USDT 0.05% pool has 1/3 of the liquidity. Then the results for this pool with a $10 basefee will match those for the USDC/ETH pool with a $30 basefee. Friction will similarly decrease for pools with higher liquidity, such as USDC/USDT and other stablecoin pairs.
Generalizing to other chains. The model assumes that shorter blocks simply divide the available block space differently, rather than adding more block space. If the reduction in block time was accompanied by a proportional reduction in basefees, the simulation results would not be as generalizable and would look very different.
Replicating Theoretical Results
(This is a more technical section that most readers can skip.) While my simulations are not guaranteed to be accurate, they can be compared to the results of the paper “Automated Market Making and Arbitrage Profits in the Presence of Fees”. There are two main differences in the setup/assumptions between the different works:
The paper assumes that trading is frictionless - there are no base fees or other costs for arbitrageurs.
The paper assumes that block times are Poisson distributed.
Rather than redesigning the DEX simulation to incorporate non-uniform block times, I designed a separate function for “fast” simulations that only computes the probability of a transaction per block, rather than other metrics. The results are in very good agreement with the paper:
When the function is changed to use uniform block times, the results are slightly different, but not dramatically so. The results of the full DEX simulation are in very good agreement with the fast simulation, giving confidence that it is implemented correctly. (Or at least, with the same assumptions):
However, when a non-zero base fee is added, the positive impact of shorter block times is greatly reduced:
While shorter blocks do benefit LPs, the impact is limited and less significant than other factors (base fees, liquidity depth, pool fee tiers, and other potential factors). A more compelling argument for fast block times may come from the perspective of traders — since faster confirmations can improve the trading user experience — or from other participants, such as smaller block builders, who will have more opportunities to win proposer auctions in a short block environment. However, shorter block times also come with significant centralization risks: increased network bandwidth and latency requirements for network validators; increased processing requirements; greater importance of geographic proximity; and an overall design bias toward HFT. Needless to say, the existence of alternatives could reshape the entire debate depending on how it evolves — such as moving to L2; adding pre-confirmations to L1; or others.
Thus, we can divide the block time design problem into two parts:
L1 perspective: A decentralized, trusted neutral design is absolutely necessary for Ethereum and other L1 blockchains that aim to compete with Ethereum. No matter how important they are, they should not be over-optimized for the performance of a single application.
L2/Appchain perspective: In contrast, L2 or Appchains do not need to tailor their design for general-purpose applications. L2 fees may already be low enough to reduce the friction caused by the base fee to negligible levels. If this is not the case, then exempting CEX/DEX arbitrage swaps from the EIP-1559 base fee would paradoxically benefit DEX users.
To summarize
To summarize:
Due to the EIP-1559 base fee and other factors, arbitrage trading is not frictionless.
Thus, the theoretical LVR in a real-world DEX is split among three entities: LPs, ETH stakers, and SBPs as a collective entity.
More gradual price changes result in a fairer distribution of LVRs between these three entities.
On chains with higher transaction costs, changing block times will only slightly increase LPs’ profits relative to other factors.
Preview
Gain a broader understanding of the crypto industry through informative reports, and engage in in-depth discussions with other like-minded authors and readers. You are welcome to join us in our growing Coinlive community:https://t.me/CoinliveSG