Market Signals
TickerStrikeDirKalshi Opt ProbOpt EdgeOpt Signal Hist ProbHist EdgeHist SignalVolume
Weather Signals
TickerCityDateMetricThreshDir KalshiModel ProbSourceStatusEdgeConfSignal
Cumulative P&L
Daily Summary
DateTradesWinsLosses Win RateP&LBestWorstAvg Edge
Combined Portfolio
Recent Trades
TimeTickerStrikeSide EntryExitQtyEdge SignalP&LStatusTelegram Line
How the System Works (Simple Version)

The Big Picture

Think of this like a weather forecast, but for the stock market. We have a robot that:

  1. Gets data — pulls real-time prices from Kalshi (a prediction market) and other sources
  2. Runs the numbers — uses two different math models to predict what the S&P 500 will do
  3. Finds mispricings — looks for cases where our prediction differs from what the market thinks
  4. Logs trades — keeps track of "paper trades" (fake money, no real risk)
  5. Shows results — displays everything on a dashboard you can open in your browser

What Each Part Does

ComponentWhat It Does
Kalshi APIConnects to the prediction market to get prices
S&P 500 ScreenerScans through all the markets, runs the math, decides if there's a good trade
Historical ModelUses past stock movements to guess future volatility
Options ModelUses options prices (like side bets on stocks) to extract what the market expects
Paper TraderKeeps a log of what trades we'd make — like a video game save file
Web DashboardThe pretty interface you see at localhost:5050
Model 1: Looking at Past Stock Movements

The Idea

Imagine you've been watching how jumpy the stock market is for the past year. Some days it moves a lot, some days it's calm. This model asks: "Based on how volatile it's been recently, what's a reasonable guess for how much it could move today?"

How It Works (Plain English)

  1. Get past prices — Download the last ~2 years of daily S&P 500 closing prices
  2. Calculate volatility — Figure out how much the index typically moves each day (this is called "volatility")
  3. Weight recent data more — Recent movements matter more than old ones (last month is more relevant than last year)
  4. Scale for time — Adjust the prediction based on how much of the trading day is left (more time = more opportunity to move)
  5. Convert to probability — Use a math formula (Student-t distribution) that accounts for rare but extreme moves

Why This Matters

Volatility is basically "how scared should I be?" for stocks. When volatility is high, stocks can move a lot in either direction. When it's low, things are calmer. Our model uses this to estimate the probability of the S&P 500 hitting different price levels by the end of the day.

remaining_vol = daily_vol * sqrt(remaining_fraction)

Before market open, remaining_fraction = 1.0 (full daily vol). After close, probabilities collapse to 0 or 1.

Probability Computation

For each strike K with current price S, uses a Student-t distribution with df=5 for fat tails (assigns ~3x more probability to 3-sigma moves vs Normal):

z = ln(K / S) / remaining_vol
P(close >= K) = 1 - T_5(z)
Model 2: What Options Traders Think

The Idea

Instead of looking at past prices, this model looks at options — these are like side bets on whether stocks will go up or down. When lots of people trade options, they basically vote with their money on what they think will happen.

How It Works (Plain English)

  1. Get option prices — Pull the prices for all "call options" on SPY (an ETF that tracks the S&P 500)
  2. Find the middle price — Average the buy and sell price for each option
  3. Extract probabilities — Use a math trick (Breeden-Litzenberger) to figure out what probability the options market is implicitly assigning
  4. Map to our strikes — Convert SPY prices to S&P 500 equivalent prices

Why This Is Cool

This is basically crowd wisdom. Thousands of professional traders are constantly betting through options. By looking at their prices, we can extract what the collective market "thinks" will happen. It's often more accurate than just looking at historical data!

How We Decide to Trade

The Core Idea: Finding Mismatches

We have two different ways to predict where the S&P 500 will end up. Now we compare those predictions to what Kalshi is pricing. If there's a big difference — that's our "edge."

The Simple Formula

Edge = Our Prediction - What the Market Says

If our model says there's a 60% chance of "YES" but the market is only pricing it at 50%, we have a 10% edge! That's like finding a bet where the payout is better than it should be.

When Do We Trade?

We only trade when our edge is big enough to be worth the risk:

Our EdgeSignalWhat It Means
7%+STRONG BUYWe're pretty confident — bet bigger!
3.5%+LEAN YESSome advantage — bet small
-3.5% or lessLEAN NOMarket might be too optimistic
-7% or lessSTRONG NOWe're pretty confident it won't hit

Why the Thresholds?

We need a big enough difference to make it worth trading. Markets are usually pretty efficient, so finding a 7%+ mismatch is rare — that's why when we see it, it's exciting!

Weather & Climate Prediction Markets

What Are Weather Markets?

Kalshi also lets you trade on weather events — like "Will this month be the hottest ever?" or "How many tornadoes will hit in May?" We build models to predict these too!

How We Predict Weather

  1. Temperature: Look at historical data from NOAA/NASA going back to 2015. Compare this year to past years to estimate probability.
  2. Tornadoes: Use historical averages by month (e.g., May usually has ~275 tornadoes in the US). If the market asks for more than average, we estimate probability based on past occurrences.
  3. Hurricanes: Similar approach — look at average hurricane seasons (about 8 Atlantic hurricanes per year) and compute probability of exceeding any threshold.
  4. Rain in NYC: Fetch 20 years of historical rainfall data, then compute what percentage of months had more rain than the market's threshold.

Confidence Score

Some predictions are more reliable than others. We score each one:

Paper Trading (Simulated Money)

Why Paper Trading?

We don't use real money — this is a simulation. Think of it like a flight simulator for trading. We log every trade we'd theoretically make, track the results, and see how well our models perform over time.

When Do We "Trade"?

How Much Do We Bet?

The bigger our edge, the more we bet (within limits):

EdgeContracts (Bets)
5%1 contract
10%2 contracts
25%5 contracts
50%+10 contracts (max)

How It Pays Out

Kalshi contracts are binary — either YES or NO. If you bet YES and it resolves to YES, you win $1. If it resolves to NO, you win $0. Same logic applies in reverse for NO bets.

Infrastructure & Automation

Cron Jobs

S&P 500: Every 15 minutes, weekdays 8 AM - 5 PM ET. Runs screener, settles trades, places new trades. Telegram alerts at 9:30 AM, 12 PM, and 4:15 PM.

Weather: Every 30 minutes, 24/7. Telegram alerts at 8 AM, 2 PM, and 9 PM ET (only if signals exist).

Kalshi API Authentication

RSA-PSS signature scheme. Signs message {timestamp_ms}{METHOD}{path} with SHA-256 and MGF1. Headers: KALSHI-ACCESS-KEY, KALSHI-ACCESS-TIMESTAMP, KALSHI-ACCESS-SIGNATURE.

Key Design Decisions

ChoiceRationale
Student-t df=5~3x more probability to 3-sigma moves vs Normal, matching empirical market behavior
EWMA span=20~1 month of trading days, responsive to regime changes while remaining smooth
Options wider thresholds (7% vs 3.5%)Options-implied is the gold standard; lower bar for signal confidence
Historical wider thresholds (10% vs 5%)Statistical model is less precise, requires larger edge to trade
Weather confidence gate (>= 50)Prevents trading on unreliable long-horizon or low-quality market types