I built a system to monitor token prices on a given EVM blockchain. I monitor the token prices on several decentralized exchanges (DEX) by looking at the reserves of tokens for pairs of tokens.
To achieve that, I perform the following steps:
- Track the "Sync" events on the pairs when a new block is mined
- When a "Sync" event is detected on a pair, fetch the reserves for this pair
- Look at all the pairs involving the same tokens (from other DEX)
- Find gaps in prices
- Compute an arbitrage
This process typically takes ~200 ms. This is kinda fast, considering there is some I/O involved. However while running this system, I noticed that profitable arbitrages (i.e: gain from arbitrage + gas fess > 0$) typically stay open for ~300 ms.
And I wonder: how is it possible to close an arbitrage that fast? Am I missing some piece of information?
I would like to know if "fast" arbitrage bots use a specific technique to detect arbitrage opportunities and perform transactions, or if they are just faster. For example:
- Do they use the pending transactions to compute the pair reserves in advance to have a transaction ready earlier?
- Is a smart contract trading on their behalf, or are the transactions computed by a machine and then sent to the blockchain?
- Do they use flashbots to make their transactions faster?