CEX-DEX arbitrage bot written in pure Python
Whack-A-Mole
The image is of Dugtrio from Pokemon.
And the banner is... Pokemon. I'm a Pokemon fan, what more can I say?
What the heck?
Whack-A-Mole is a CEX-DEX arbitrage bot written in Python.
Arbitrage strategies are like the global Whack-A-Mole game played in parallel.
Multiple players participate to find the mole that pops up, and jump to capture that opportunity.
Who knows who'll win...
What we know for certain is that you'll need a fast pair of eyes on the market at all times, and an extra fast execution engine to capture the moment without latency.
Will our beloved Python be able to accomplish this? We'll see 😎
Example Strategy #1: DEX arbitrage
The main branch is likely to go through a lot of changes, so to run an example that runs without breaking, you should switch to the examples/strategy/dexarbbase branch before running main.py. Run:
git checkout examples/strategy/dexarbbase
Example Strategy #2: CEX-DEX arbitrage
You said this is a CEX-DEX arbitrage bot, where the f is it?
I know...🥲 I'm still actively researching the CEX-DEX arbitrage space.
Everyone interested in the process can go visit my other repository which is actually a derivative of Whack-A-Mole:
https://github.com/solidquant/cex-dex-arb-research
This research template is an attempt to find alphas within the crypto space.
You can focus on DEX only arbs, CEX only arbs, and also CEX-DEX arbs using this template.
🛠 Recent Updates (2023.08.08):
- asyncio error: added nest_asyncio
- .env error: added some randomly generated sample private keys, addresses for people that want a complete testing environment
- requirements.txt: web3, flashbots, websockets often times have conflicting versions. You sometimes need to delete their fields in the requirements.txt file and install them manually
- Telegram bot: updated the code so that the bot runs without having to set the Telegram token in .env
import asyncio
import nest_asyncio
from strategies.dexarbbase import main
if name == 'main': nest_asyncio.apply() asyncio.run(main())
This code is in main.py.
python main.py
Check out my blog post describing in detail what this project attempts to do, and how you can use it.
⚡️ For readers that want to talk about MEV and any other quant related stuff with people, please join my Discord! There’s currently no one on the Discord server, so it’s not too active yet, but I hope to meet new people there! 🌎🪐
https://discord.com/invite/e6KpjTQP98