WWW2026

Analysis of CEX-DEX Arbitrage Opportunities with Hidden Markov Models

Bence Ladóczki

Abstract

Web3 technologies and decentralised finance (DeFi) have not only revolutionised finance, but they have also given rise to completely different concepts in terms of how we handle our wealth and how we utilise the Internet, which is still an unreliable medium for the exchange of information. To overcome trust issues, cryptographic tools were introduced and these days we even put our digital assets on the blockchain. These new technologies enabled us to make most financial solutions decentralised. A widely popular financial product that is implemented on blockchains is a constant product market maker (CPMM). A CPMM can be used to swap digital assets between mutually untrusting parties by relying on prices calculated from its bonding curve. A blockchain-based automated market maker (AMM) quotes prices that usually lag behind external market prices, and this price difference can be exploited by automated bots, aka. arbitrageurs. The question we investigate in this work focuses on this issue. More specifically, we experiment with different approaches from financial mathematics to account for stochastic price changes, perform extensive measurements to quantify the characteristics of the DeFi market, focusing on mainnet Ethereum and develop stochastic grid optimisers to fit model parameters to actual AMM market data that we extract from the logs of the Ethereum virtual machine. We report on model performance that is more aligned with reality compared to previous works that have relied on naive two-parameter Black-Scholes (BS) models. Our results reveal that hidden Markov models can give better estimates for both the number of arbitrage trades and the arbitrage profits when combined with a jump diffusion model and a two-parameter BS model.