An Improved Algorithm to Identify More Arbitrage Opportunities on Decentralized Exchanges

Yu Zhang,Tao Yan,Jianhong Lin,Benjamin Kraner,Claudio Tessone
2024-06-24
Abstract:In decentralized exchanges (DEXs), the arbitrage paths exist abundantly in the form of both arbitrage loops (e.g. the arbitrage path starts from token A and back to token A again in the end, A, B,..., A) and non-loops (e.g. the arbitrage path starts from token A and stops at a different token N, A, B,..., N). The Moore-Bellman-Ford algorithm, often coupled with the ``walk to the root" technique, is commonly employed for detecting arbitrage loops in the token graph of decentralized exchanges (DEXs) such as Uniswap. However, a limitation of this algorithm is its ability to recognize only a limited number of arbitrage loops in each run. Additionally, it cannot specify the starting token of the detected arbitrage loops, further constraining its effectiveness in certain scenarios. Another limitation of this algorithm is its incapacity to detect non-loop arbitrage paths between any specified pairs of tokens. In this paper, we develop a new method to solve these problems by combining the line graph and a modified Moore-Bellman-Ford algorithm (MMBF). This method can help to find more arbitrage loops by detecting at least one arbitrage loop starting from any specified tokens in the DEXs and can detect the non-loop arbitrage paths between any pair of tokens. Then, we applied our algorithm to Uniswap V2 and found more arbitrage loops and non-loops indeed compared with applying the Moore-Bellman-Ford (MBF) combined algorithm. The found arbitrage profit by our method in some arbitrage paths can be even as high as one million dollars, far larger than that found by the MBF combined algorithm. Finally, we statistically compare the distribution of arbitrage path lengths and the arbitrage profit detected by both our method and the MBF combined algorithm, and depict how potential arbitrage opportunities change with time by our method.
Computational Finance
What problem does this paper attempt to address?
The paper attempts to address the problem of identifying more arbitrage opportunities in decentralized exchanges (DEXs). Specifically, the paper points out the following limitations of the current Moore-Bellman-Ford algorithm used for detecting arbitrage paths: 1. **Can only identify a limited number of arbitrage cycles**: Each time the Moore-Bellman-Ford algorithm is run, it can only identify a limited number of arbitrage cycles, which restricts its effectiveness in practical applications. 2. **Cannot specify the starting token of the arbitrage cycle**: The existing algorithm cannot specify the starting token of the detected arbitrage cycle, further limiting its application in certain scenarios. 3. **Cannot detect non-cyclic arbitrage paths**: The existing algorithm cannot detect non-cyclic arbitrage paths between any two tokens. To overcome these limitations, the paper proposes a new method that combines line graphs and an improved Moore-Bellman-Ford algorithm (MMBF), aiming to identify more types of arbitrage opportunities, including: - **Arbitrage cycles starting from any specified token**: Capable of detecting arbitrage cycles starting from any specified token. - **Non-cyclic arbitrage paths between any two tokens**: Capable of detecting non-cyclic arbitrage paths between any two tokens. Using this method, the paper conducted experiments on Uniswap V2 and found that compared to the traditional Moore-Bellman-Ford algorithm, the new method can identify more arbitrage opportunities, with some arbitrage paths yielding profits of up to $1,000,000. Additionally, the paper provides a statistical analysis of the distribution and profits of the identified arbitrage opportunities, offering insights into the market efficiency of Uniswap V2.