The primary goal of this bot is to execute profitable arbitrage trades by continuously monitoring price feeds from different DEXs in real-time, allowing for fast, efficient, and low-risk trade execution. Unfortunately, the bot is still some time away from being functional, however I've created a start to this project and will need to further refine it.
The three DEXs that are monitored right now are Uniswap V3, SushiSwap, and 1Inch. 1inch was included due to it being an aggregator providing a strong benchmark to the lowest possible price at the moment.
As for overall features:
- Constantly checks for price discrepancies between different exchanges for the same trading pairs. If it identifies an arbitrage opportunity where the price of an asset on one exchange is significantly different from the price on another exchange, it triggers an alert and prepares to execute a trade.
- The system can be customized to monitor specific pairs or exchanges, optimizing for profitable pairs with high volatility.
- Before executing a trade, the bot evaluates the liquidity available on both exchanges to ensure that a trade of the intended size can be executed without significant slippage.
- Liquidity checks help avoid scenarios where large trades move the market price too much, which could nullify the profitability of the arbitrage opportunity.
- The bot will calculate the gas fees required for trade execution and dynamically adjusts trade sizes based on current gas prices to ensure the trade is profitable after accounting for fees.
- To minimize risk, the bot factors in potential slippage. Each trade is executed with predefined slippage limits. If the slippage exceeds the threshold, the trade will not proceed, preventing unexpected losses. A planned feature was to also have the bot monitor slippage across exchanges, ensuring trades are executed on platforms with the least slippage for the target pair.
Technologies used:
- The Graph & Substreams: Substreams were used to attain real-time, instantaneous data to capitalize on trade opportunities.
- Rust: Rust was used as the primary programming language.
- Smart Contracts, ABIs, & Event Handlers: These were utilized to parse and decode useful information from different DEXs.
- Docker: Docker was employed to containerize and manage the development environment.
Worth mentioning Hacky detail:
- This was my first time ever working with Rust, crypto, and essentially everything mentioned above. I'm primarily a finance student and wanted to take this opportunity to learn more about DeFi.