Light-weight and performance-optimized arbitrage bot that monitors price discrepancies between Binance (CEX) and Uniswap V3 (DEX) for the ETH/USDT pair. It is designed for robust, low-latency execution and can be extended to other pairs or exchanges.
- Monitors real-time prices from Binance and Uniswap v3
- Executes arbitrage trades when profitable opportunities are detected
- Handles process management, shared memory, and event-driven execution
- Includes mock mode for safe testing (no real trades)
- Python 3.10+
- Clone the repository
- Create a virtual environment:
python3 -m venv venv source venv/bin/activate - Install dependencies:
pip install -r requirements.txt
- Configure environment variables:
- Set your Binance and Ethereum credentials in your environment or
.envfile if running in real mode.
- Set your Binance and Ethereum credentials in your environment or
- (Optional) Disable mock mode:
- By default,
mock_mode=Trueinconstants.pywill mock CEX and DEX executions for safe testing.
- By default,
- Run the bot:
python main.py
Description:
- The bot continuously polls both Binance and Uniswap for the latest ETH/USDT prices.
- When a profitable arbitrage opportunity is detected (based on a configurable bps threshold), it triggers simultaneous order execution on both CEX and DEX.
- The bot tracks the status and execution price of each leg, and logs all outcomes.
- If one leg fails, the bot attempts to resolve by retrying or reversing the trade on CEX due to stability.
- Note: Rebalancing (restoring inventory between CEX and DEX) is skipped in this implementation.
The following logs were generated with mock_mode=true (no real trades executed):
Note:
- The default configuration is safe for testing. To enable real trading, set
mock_mode=Falseinconstants.pyand provide valid API keys and wallet credentials. - For more details, see comments in the code and constants in
constants.py.

