TLDR:
Challenges on tracing and quantifying CEX-DEX mev
Define the CEX-DEX mev as a “Time Arbitrage”, capitalizing the price difference of DEX price at the beginning of the block and price of CEX at the end of the block, rather than the instantaneous price difference between two exchanges
Tracking CEX-DEX between Osmosis and Binance over 2 weeks, I identified the highest mev block with $33,440 arb opportunity
Huh CEX-DEX – why I haven’t seen any?
There has long been humors about the multi-million (or even billion) industry of CEX-DEX statistical arbitrage on blockchain (at least in 2022 the peak of bull market). But nobody knows how realistic is this estimation. Unlike the on-chain atomic sandwich (tracked by explorers like MEV-explore), whose MEV is traceable through a difference in swap_in and swap_out amount of the same token in an atomic transaction, the CEX-part of the CEX-DEX arbitrage could not be associated with a trade on DEX, making the CEX-DEX mev profit a black box number.
Adding to the murkiness of the situation, people question the profitability of CEX-DEX arb due to settlement mismatch. The CEX-part of the trade can land instantaneously, yet the DEX-part needs to wait til the end of the block to be confirmed (had it ever been confirmed). Even though we can observe the price difference between CEX and DEX, there’s never a guarantee for the DEX-part arb to be executed successfully. To increase the likelihood of successful execution on a DEX, an arb-ers needs to accept a larger slippage on their DEX trade, which eats into the arb profit; if the arb-er doesn’t accept considerable slippage, the DEX swap might not be executed. As long as the DEX trade is pending and arb is incomplete, arbitrageur involuntarily holds the token and is exposed to the adverse price change. With this damning uncertainty, common belief is that the profit of the arb needs to be considerably marked down.
To every problem, there’s a solution
Despite the quantification for CEX-DEX arbitrage is murkier than the well-known atomic arbitrage, it’s not impossible to gauge the opportunity size for CEX-DEX. Before we dive into the quantification framework, first, it’s worthwhile to clarify some mysteries we accept previously:
Mystery #1: The execution price on DEX is non-deterministic at the time of submitting the DEX transaction
We all know the observed price on DEX when you make the trade is not usually the DEX execution price. Because the price you observed is the token’s price at the end of the last block. Then during the 12s block time, no updates on the price will appear until the receipt of the current block after the 12s. It seems like, after we have submitted the swap transaction to the DEX, all we can do is to pray the price hasn’t changed much during the current block time. The price changes are caused by transactions occurring earlier in the same block, which interact with the same liquidity pools as our transaction. Even if we submit the swap txs at the beginning of the current block time, we don’t know where in the block the transaction will end up. Without complete knowledge of the block's contents, it appears possible to trade on DEX at a deterministic price.
Yet, not everyone traders on DEX has no control over where its transaction ends up in the block. Searchers (mev-boost link) compete at block builders’ bundle auction for opportunities to reorder transactions to extract value. If the searcher positions the DEX transaction at the beginning of the current block, the execution price for this trade would be totally predictable, as DEX price is calculated solely by the pool balances at the conclusion of the previous block. Therefore, the DEX price can be deterministic, as long as this transaction is executed top-of-block before any other transaction changes the pool state.
Mystery #2: The CEX-DEX arbitrage equals the instantaneous price differences (minus fees) between two markets, which is hard to capture in real life
The common perception of arbitrage involves the simultaneous buying and selling of an asset to capitalize on differing prices. This is often thought of in terms of atomic arbitrages, where the transactions are concurrent. However, in the context of CEX-DEX, this simultaneity is not feasible due to their distinct operational mechanisms. CEX trades occur in continuous time, allowing for near-instantaneous execution. In contrast, DEX operates in discrete time, with transactions typically settling every 12 seconds. This discrepancy in trade execution times between CEX and DEX means that one part of the arbitrage trade (either the buy or the sell) will inevitably occur before the other. Therefore, when seeking arbitrage opportunities between CEX and DEX, the requirement isn't for an instantaneous price difference. Instead, the focus is on identifying a price difference that exists within the block time of the DEX. This approach acknowledges the inherent lag between executing trades on CEX and DEX, and reflects a more sequential or statistical approach to arbitrage, as opposed to the conventional atomic arbitrage model.
Getting into an arbitrageur’s mind
Now we have cleared up some common misconceptions about CEX-DEX mev, let take a look at how these arbitrage is executed:
First, Let’s assume the arbitrage market between DEX and CEX is efficient – at the time when a new block lands, the price difference between DEX and CEX is negligible taking account of transaction fees on both venues.
Soon after the last block lands on-chain, the arb-er sees the price on DEX freeze, while the CEX price started to drifts away from the DEX price. As time progresses, for example, 10 seconds after the last block, a significant price discrepancy emerges, presenting a sizable arbitrage opportunity. The arbitrager executes a trade on the CEX, which is settled instantly. Before the current block is recorded on the blockchain, the arbitrager can bid to insert a DEX-lag of arbitrage top-of-block, allowing them to trade at the DEX price from 10 seconds earlier (which reflects the pool's balance at the end of the last block).
CEX-DEX arbitrage is a “time arbitrage”
The largest arbitrage opportunities arise just before a new block is confirmed, when the PBS auction has concluded and the arbitrageur has a confirmation that its DEX-part of the arb will land on-chain. Securing the top-of-block DEX price, the arbitrager can now confidently place the CEX-part of the trade to close the arb, capitalizing the price gap between the latest CEX price and the DEX price from nearly 12 seconds earlier.
Note that, even though a bigger CEX-DEX price discrepancy might appear somewhere middle in the block, but the arb-er doesn't have the confirmation on the DEX-part execution. If the arb-er places a trade on CEX now, there's a (good) chance its DEX-part won't be executed, risking on a position unhedged. We all know that the higher the risk, the bigger the price discount. This uncertainty gravely discounts the observed arbitrage value. Therefore, the arb-er largest realizable profit still happens at the end-of-block.
Piecing it together:
Arbitrageur’s payoff:
Arbitrage profit = | end-of-block CEX price - top-of-block DEX price | * Size of the arbitrage trade - transaction fees
The potential profit from arbitrage largely depends on the size of the trade that can be executed before the price difference between two trading platforms becomes negligible. A key factor influencing this 'arbitrage size' is the liquidity available on these platforms.
For example, in commonly traded pools on Ethereum, like ETH-USDC pools, we can generally assume near-infinite liquidity at current price level on Binance (see An analysis of Uniswap markets by Angeris). This means that large trades can be executed on Binance without significantly impacting the market price. Here, the limiting factor is the amount of trade that can be executed on DEX like Uniswap before the price moves negligibly close to CEX. Empirically we found on other networks like Cosmos, DEX like Osmosis may exhibit deeper liquidity on most traded pools compared to Binance (as we will see from the following example). This difference in liquidity dynamics across different exchanges can significantly influence arbitrage strategies.
Empirical Data
Over a two-week period from April 21, 2023, to May 3, 2024, I conducted a study to capture arbitrage opportunities between 3 trading pairs on Osmosis and Binance. My observation was that Osmosis exhibited deeper liquidity for these pairs compared to Binance, which meant that the liquidity on Binance became the limiting factor for the scale of potential arbitrage.
To accurately capture these arbitrage opportunities, I took snapshots of the Binance order book just before new blocks were confirmed on Osmosis. Alongside these snapshots, I also recorded the state of the pools on Osmosis at each block. This data was used to calculate the potential arbitrage profit within each block with the afore-mentioned formula.
The results are presented in the following:
MEV gain on a typical day
Zoom in on a monster MEV block
High MEV corresponds to times with high market volatilities and deep Binance liquidity.
The biggest MEV opportunity we spot is in block 9355977 (2023-4-26 16:44:18 UTC) for OSMO/USDT pair. Within the minute of 16:44, OSMO/USDT price rallied 7.35%. Yet, this extraordinary event didn’t happen alone. Peculiar to the the Cosmos ecosystem, Osmosis has deeper liquidity than centralized exchange. The liquidity on Binance is usually the limiting factor the size of the arb trade (as trades on Binance quickly takes out liquidity on the top of order book, the prices on two platform closes and the left arbitrage opportunity diminishes). It happens that at that time, there’s deep liquidity on the Binance order book layer with the largest price difference with Osmosis. Taking advantage of these two conditions, we recorded $33,440.49 arbitrage profit for OSMO/USDT pair in this block alone. This is consistent with result from the LVR paper, where high market volatilities create great arbitrage opportunities at the expense of DEX LPs.