Implied probability anomaly detection engine for Kalshi prediction markets. Scans live markets, computes Z-score deviation from category baselines, and surfaces ranked trading signals via REST API and Streamlit dashboard.
- Ingests all active Kalshi markets via REST API (auto-fallback to demo data)
- Computes a baseline probability for each market using historical category resolution rates + time-to-expiry correction
- Computes a Z-score: how many standard deviations is the market price from the data-derived baseline
- Flags OVERPRICED (Z > 2.0) and UNDERPRICED (Z < −2.0) markets
- Serves ranked signals via FastAPI and displays them on a Streamlit dashboard
kalshi_edge/
├── kalshi_client.py # Kalshi API ingestion + fallback sample data
├── analytics.py # Baseline computation, Z-scores, signal generation
├── main.py # FastAPI: /health /markets /signals /summary
├── app.py # Streamlit dashboard
├── requirements.txt
└── README.md
pip install -r requirements.txtuvicorn main:app --reload --port 8000Test it:
curl http://localhost:8000/signals?min_z=2.0
curl http://localhost:8000/summaryIn a second terminal:
streamlit run app.pyOpens at http://localhost:8501
If Kalshi's API is unavailable during your demo, set:
USE_FALLBACK=true uvicorn main:app --reload
USE_FALLBACK=true streamlit run app.pyOr add USE_FALLBACK=true to a .env file.
The app will load built-in sample data and remain fully functional.
| Method | Path | Description |
|---|---|---|
| GET | /health |
Status, uptime, cache state |
| GET | /markets |
All markets with implied prob and volume |
| GET | /signals?min_z=2.0&category=economics&direction=UNDERPRICED |
Anomaly signals ranked by |Z| |
| GET | /summary |
Aggregate stats and category breakdown |
baseline = historical category resolution rate
+ time-decay correction (long/short-dated adjustment)
edge = kalshi_mid_price − baseline_probability
z_score = edge / category_historical_std
signal = fired when |z_score| > 2.0
Category standard deviations are fixed constants set per category (see analytics.py).
Baseline rates are fixed historical estimates per category (see kalshi_client.py).
- Create a new Zerve project
- Upload all six files (or paste them into the file editor)
- Open the Zerve terminal and run:
pip install -r requirements.txt uvicorn main:app --host 0.0.0.0 --port 8000 - In a second Zerve process, run:
streamlit run app.py --server.port 8501 - Zerve will expose both as public URLs — use these in your demo
If Kalshi API is blocked in Zerve's network:
Add USE_FALLBACK=true to Zerve's environment variables.
Quant / trading focus:
Built a market microstructure signal engine for Kalshi prediction markets: ingested live exchange data, computed Z-score deviations from category-derived probability baselines, and generated ranked OVERPRICED/UNDERPRICED signals via a REST API with 30-minute response caching.
Fintech SWE focus:
Designed and deployed a real-time anomaly detection API for prediction market data: Python ingestion layer with API fallback resilience, statistical signal generation (Z-score threshold = 2.0), FastAPI serving layer with four endpoints, and Streamlit dashboard with live category filtering.
Backend / data engineering focus:
Built end-to-end data pipeline from Kalshi REST API through statistical analysis to API deployment: robust price-format parsing (handles Kalshi's fixed-point and cents-integer formats), Pandas/NumPy analytics engine, FastAPI serving with in-memory caching, and Streamlit frontend — demo-safe fallback mode included.