1.4 KiB
Prediction Market Arbitrage
Supports Kalshi prediction markets, Nadex binary options, and CME event contracts (through tradovate client). Draws basis future pricing from yahoo finance.
Currently has code for nasdaq and s&p pairs, but can easily support any contract traded on these platforms.
Setup
Provide auth data in *.auth files in json format.
Relies on python venv with requirements.txt.
If you're going to use nadex, install node and package.json for lightstreamer.
The pair you're considering and the minimum spread to execute a trade is controlled in the runner files
e.g. nasdaqdaily.py or spdaily.py.
Running
Just run python nasdaqdaily.py or python spdaily.py etc. You can provide "demo" as a sys arg to run in the sandbox environment (for
the trading platforms that support this).
Log data, of good spreads found and trades executed, are outputted to stdout, so you should run this on
tee (into systemd-cat if you're on the hetzner server so we can export from journalctl).
Login sessions are outputted into *.session files, which can be cleaned up using ./clean.
Testing
Run pytest -rA.
Todo
- Add fidelity, and equities vs futures (this requires non-piecewise math solveer)
- Reverse engineer and reimplement lightstreamer in python
- Rigorously model execution risk better than just a minimum spread (look into Almgren-Chriss mean-variance and LVaR models)
- Refactor source code layout