You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Maltysen 03cbd968ea
commit
3 weeks ago
.gitignore commit 3 weeks ago
README.md commit 3 weeks ago
clean commit 3 weeks ago
kalshi.py commit 3 weeks ago
lightstreamer.js commit 3 weeks ago
mocks.py commit 3 weeks ago
nadex.py commit 3 weeks ago
nadex_ws.js commit 3 weeks ago
nasdaqdaily.py commit 3 weeks ago
package-lock.json commit 3 weeks ago
package.json commit 3 weeks ago
piecewise.py commit 3 weeks ago
requirements.txt commit 3 weeks ago
spdaily.py commit 3 weeks ago
test_kalshi.py commit 3 weeks ago
test_piecewise.py commit 3 weeks ago
test_utils.py commit 3 weeks ago
tradovate.py commit 3 weeks ago
utils.py commit 3 weeks ago
yahoo.proto commit 3 weeks ago
yahoo_pb2.py commit 3 weeks ago
yahoo_stream.py commit 3 weeks ago

README.md

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