01Discover Weather Markets
The scanner queries Polymarket's Gamma API using the tag:weather filter. It finds all active markets like "Highest temperature in Paris on March 13?" — typically 200-800 markets at any given time. Each market has multiple outcomes (e.g. 10°C, 11°C, 12°C, 13°C, 14°C, 15°C or higher) with prices set by traders on Polymarket.
02Parse Market Titles
Each title gets parsed to extract the city (mapped to lat/lon coordinates), date, temperature unit (°C or °F), and outcome options. The parser handles formats like "on March 13", "on 13 Mar", and detects ranges like "30-31°F" vs exact values like "14°C" vs tail outcomes like "15°C or higher".
03Fetch Independent Forecasts
For each city/date combo, the engine fires parallel API calls to independent weather models — four globally, plus a fifth (HKO) for Hong Kong:
GFS (NOAA)
US global model via Open-Meteo. 16-day hourly forecasts. Best for North America.
ECMWF (European)
Considered the world's best global model. 10-day, 9km resolution. Gets the highest weight.
UKMO (UK Met Office)
British model via Open-Meteo. 7-day seamless. Strong for European weather patterns.
NWS (NOAA Direct)
US-only hourly forecast + active weather alerts. Best local station data for US cities.
HKO (Hong Kong Observatory)
Hong Kong only — the official HQ gauge Polymarket resolves HK markets on. 9-day forecast + a live running-max read used for resolution-day edge.
Each model returns hourly temperature arrays. The engine extracts the maximum temperature for the target date from each.
04Weighted Consensus with Outlier Detection
The models are blended with weights: ECMWF 35% · GFS 25% · UKMO 20% · NWS 20%. But first, the engine calculates the raw mean and checks each model's distance from it. If a model is more than 1.5x the standard deviation away, it's an outlier and its weight gets halved — this prevents one bad model from skewing the consensus.
Example: GFS 13.2° · ECMWF 12.8° · UKMO 13.0° · NWS N/A
Consensus: 12.98° · Spread: ±0.2° · Agreement: VERY HIGH
05Dynamic σ — Forecast Uncertainty
This is the key parameter. σ (sigma) represents how uncertain we are about the forecast. A same-day forecast is much more reliable than a 7-day forecast. Three factors determine σ:
TIME TO RESOLUTION
< 6h → σ = 0.8°
12h → σ = 1.0°
24h → σ = 1.3°
48h → σ = 1.8°
72h → σ = 2.2°
5d → σ = 3.0°
7d → σ = 3.8°
10d+ → σ = 5.5°
MODEL COUNT
4 models → ×1.0
3 models → ×1.1
2 models → ×1.25
1 model → ×1.5
Fewer models = wider σ = less certainty
MODEL DISAGREEMENT
Each 5° of spread adds 100% to σ
0.5° spread → ×1.1
2.5° spread → ×1.5
5.0° spread → ×2.0
Disagreement = less confident
This is where the biggest edge lives. Same-day markets with tight model agreement have σ ≈ 1°, making even small mispricings tradeable. Week-out markets need huge mispricings to overcome the uncertainty.
06Bayesian Integration with Historical Data
The NOAA NCEI source provides the last 10 years of recorded max temperatures for the same calendar date at the nearest weather station. This becomes our Bayesian prior — "what does this date usually look like?" The forecast becomes the likelihood. They combine using precision-weighted averaging:
// Forecast: 12.98° (σ=1.14°) → precision = 0.77
// Historical: 12.0° (σ=3.5°) → precision = 0.082
Combined mean = (12.98 × 0.77 + 12.0 × 0.082) / 0.852 = 12.88°
Combined σ = √(1 / 0.852) = 1.08°
The forecast dominates because it's more precise. But if the forecast predicted something unusual for that date (25°C in March in Paris), the historical prior would pull it back and widen σ by 30%.
07Edge Calculation — Normal CDF
For each outcome option, the engine calculates the probability that the actual recorded temperature falls in that range using the Normal CDF (cumulative distribution function) with our consensus mean and dynamic σ:
// "12°C" means Weather Underground records high between 11.5–12.5
P(12°C) = CDF(12.5) − CDF(11.5) = 20.1%
P(13°C) = CDF(13.5) − CDF(12.5) = 41.5%
P(15°C+) = 1 − CDF(15.0) = 2.5%
Edge = Forecast Probability − Market Price
// If market says 30% and we say 41.5%:
Edge = +11.5% → BUY YES
08Kelly Criterion — Position Sizing
The edge alone isn't enough — you need to know how much to bet. The Kelly Criterion calculates the optimal fraction of your bankroll to maximize long-term growth while minimizing ruin risk:
Kelly fraction = edge / implied_odds
// BUY YES on 13°C at 30¢: odds = (1/0.30)−1 = 2.33
// Raw Kelly = 0.115 / 2.33 = 4.9%
Quarter-Kelly (safety) = 1.2% of bankroll
EV per $1 = (41.5% × $2.33) − (58.5% × $1) = +$0.38
// 38 cents profit expected per dollar risked
How trade sizing works in WeatherBot:
You set two values in Config — your Bankroll (total capital) and a Max Per Trade cap. Each trade is automatically sized using Kelly, but never exceeds the cap:
STRONG EDGE
Kelly: 2.4%
$500 × 2.4%
= $12 trade
Under cap
VERY STRONG EDGE
Kelly: 8.5%
$500 × 8.5%
= $42 trade
Under cap
EXTREME EDGE
Kelly: 15%
$500 × 15% = $75
→ $50 (capped)
Max cap protects
We use Quarter-Kelly (25% of the full Kelly fraction) — this is standard practice among professional bettors. Full Kelly is mathematically optimal but has brutal drawdowns. Quarter-Kelly sacrifices ~25% of long-term growth for dramatically smoother equity curves.
09Claude AI — Final Decision
All of the above is pure math. Claude AI adds human-level reasoning as the final layer. It receives every data point — all 4 model forecasts, consensus, σ, historical base rate, market prices, edge analysis, and weather alerts — then considers things the math can't:
Is the weather station at an airport? (often reads 1-2° warmer)
Is a cold front or weather system moving in that models might underweight?
Does the market price reflect insider knowledge or irrational crowd behavior?
What's the actual risk/reward after accounting for liquidity and slippage?
Claude returns a structured decision: BUY YES, BUY NO, or SKIP — with confidence level, reasoning, risk notes, and a suggested position size.