How It Works
A precision alerting system for detecting unusual activity on Kalshi prediction markets
The Pipeline
The system runs continuously, processing data in a loop:
| Step | Frequency | What It Does |
|---|---|---|
| Market Sync | Every 30 min | Pulls all active markets from Kalshi, filters to eligible ones |
| Trade Ingestion | Every 5 min | Fetches recent trades for every eligible market |
| Orderbook Snapshots | Every 5 min | Captures current bid/ask depth for eligible markets |
| Baseline Computation | Every 2 hours | Calculates each market's "normal" behavior over a rolling 7-day window |
| Scoring | Every 5 min | Runs the model against the last 30 minutes of data |
| Alert Generation | Every 5 min | Flags markets scoring 70+ for the dashboard and email alerts |
Eligibility
A market must meet at least one of these thresholds to be monitored:
- 24-hour volume ≥ $50
- Open interest ≥ $100
Additionally, the market must be open/active, expiring in 2+ hours, and not in the Sports or Weather categories.
The Scoring Model
Each eligible market is scored on a 0–100 scale using six independent signals. Every signal compares the market's current behavior to its own historical baseline — so a 500-contract trade in a low-volume market and a 50,000-contract trade in a high-volume market can both trigger alerts when they deviate from what's normal for that specific market.
Individual signals are capped at 95 to prevent any single signal from dominating the composite.
1. Trade Size 30% weight
Detects abnormally large trades relative to a market's history.
- Z-score of largest trade — How many standard deviations above the market's average trade size is the biggest trade in the window? A 5+ sigma trade scores 100.
- Volume spike — Total volume in the window vs expected volume for the time span. A 5x volume ratio scores 100.
- Combined as 70% z-score + 30% volume ratio.
2. Price Impact 25% weight
Measures whether trades are moving the price more than they normally would.
- Cumulative impact — Total price movement across the window vs expected (baseline avg change per trade × number of trades). A 5x ratio scores 100.
- Max single-trade impact — Largest single price move relative to the baseline.
- Combined as 70% cumulative + 30% max single.
3. Liquidity 20% weight
Detects unusual changes in the orderbook structure.
- Depth collapse (40%) — If order book depth drops to 10% of average, scores 100. Depth collapse is weighted more heavily than depth surge because it often precedes large moves.
- Spread widening (35%) — Current spread vs baseline average spread. A 4x widening scores 100.
- Imbalance shift (25%) — Change in the bid/ask depth ratio between the earliest and latest snapshot. A shift of 15%+ triggers the signal.
4. Clustering 15% weight
Identifies burst patterns — trades arriving in concentrated bunches rather than evenly distributed.
- Concentration (40%) — The window is divided into 5-minute buckets. What fraction of all trades landed in the busiest bucket? 80%+ concentration scores 80+.
- Trade rate (40%) — Actual trades per hour vs baseline. A 5x rate ratio scores 100.
- Directional pressure (20%) — Are trades overwhelmingly one-sided? 75%+ on the same side (YES or NO) triggers the signal.
5. Timing 5% weight
Flags activity occurring at unusual times or near market expiration.
- Off-hours trading (after 8pm ET or before 6am ET): +40 points
- Weekend trading: +20 points
- Last 5% of market lifetime before expiration: +40 points
- Last 10% of market lifetime: +25 points
6. Cross-Market 5% weight
Checks whether sibling markets in the same Kalshi event are also spiking. If multiple related markets are scoring Medium (55+) or above, correlated activity is likely meaningful. Each elevated sibling adds 25 points.
Multi-Signal Confirmation Gate
To prevent false positives from a single noisy signal, a market must pass a confirmation gate to reach "High" or above:
- At least one primary signal (Trade Size or Price Impact) must score 60+
- At least one secondary signal (Liquidity, Clustering, Timing, or Cross-Market) must score 40+
If a market would score 70+ but fails the gate, it is capped at 54.99 (Low). This ensures that a genuine alert always has confirmation from multiple independent signals.
Score Labels
| Score | Label |
|---|---|
| 85–100 | Very High |
| 70–84 | High |
| 55–69 | Medium |
| 40–54 | Low |
| 0–39 | Very Low |
Tradeability Overlay
After scoring, each market receives an opportunity status:
| Status | Meaning |
|---|---|
| Open | Fresh signal, tight spread (≤10¢), sufficient depth (20+ contracts each side) |
| Needs Review | Strong signal but stale (>10 min old) or wide spread / thin depth |
| Late | Price already moved 10+ cents within the window |
| Likely Moved | Price moved and signal is stale — opportunity probably passed |
Baselines
Every metric is compared to a per-market baseline computed over a rolling 168-hour (7-day) window. Baseline values include:
- Average trade size and standard deviation
- Average trades per hour and volume per hour
- Average orderbook spread and depth
- Average price change per trade
A minimum of 20 trades in the baseline window is required before scoring begins for a market. This prevents false signals on markets with sparse data.