2026-03-03 15:32:53 -06:00
# 🌤 Weather Trading Bot — Polymarket
2026-03-04 00:40:52 -06:00
Automated weather market trading bot for Polymarket. Finds mispriced temperature outcomes using Open-Meteo forecasts.
2026-03-03 15:32:53 -06:00
2026-03-04 00:40:52 -06:00
No SDK. No black box. Pure Python.
---
## Versions
### `bot_v1.py` — Base Bot
The foundation. Scans 6 cities, fetches forecasts from Open-Meteo, finds matching temperature buckets on Polymarket, and enters trades when the market price is below the entry threshold.
No math, no complexity. Just the core logic — good for understanding how the system works.
### `bot_v2.py` — Kelly + EV Edition *(current)*
Everything in v1, plus:
- **Expected Value** — skips trades where the math doesn't work
- **Kelly Criterion** — sizes positions based on edge strength, not a flat %
- **Live monitor** — updates `simulation.json` every 10s so the dashboard stays current
- **Auto-exit** — closes positions when price hits the exit threshold
~400 lines of pure Python.
### `bot_v3.py` — Coming Soon
- Auto-cycle every hour — continuously scans and opens new positions
- Forecast monitoring every 10 minutes — closes positions if the forecast changes and EV goes negative
- Historical calibration — uses 10 years of weather data to validate probabilities
2026-03-03 15:32:53 -06:00
---
## How It Works
Polymarket runs markets like *"Will the highest temperature in NYC be between 40– 41°F on March 4?"* These markets are often mispriced — the forecast says 78% likely, but the market is trading at 8 cents.
The bot:
2026-03-04 00:40:52 -06:00
1. Fetches 4-day forecasts from **Open-Meteo** (free, no API key)
2026-03-03 15:32:53 -06:00
2. Finds the matching temperature bucket on Polymarket
2026-03-04 00:40:52 -06:00
3. Calculates Expected Value — skips the trade if EV is negative
4. Calculates Kelly Criterion — sizes the position based on edge strength
5. Runs a full $1,000 simulation against real market prices before you risk anything
2026-03-03 15:32:53 -06:00
---
## Kelly + EV Logic
**Expected Value** — is this trade mathematically profitable?
2026-03-04 00:40:52 -06:00
2026-03-03 15:32:53 -06:00
```
EV = (our_probability × net_payout) − (1 − our_probability)
```
**Kelly Criterion** — how much of the balance to bet?
2026-03-04 00:40:52 -06:00
2026-03-03 15:32:53 -06:00
```
Kelly % = (p × b − q) / b
```
2026-03-04 00:40:52 -06:00
We use fractional Kelly (25%) and cap each position at 10% of balance.
2026-03-03 15:32:53 -06:00
---
## Installation
```bash
git clone https://github.com/alteregoeth-ai/weatherbot
cd weatherbot
pip install requests
```
Add your settings to `config.json` :
2026-03-04 00:40:52 -06:00
2026-03-03 15:32:53 -06:00
```json
{
"entry_threshold" : 0.15 ,
"exit_threshold" : 0.45 ,
2026-03-04 00:40:52 -06:00
"locations" : "NYC,Chicago,Seattle,Atlanta,Dallas,Miami" ,
"max_trades_per_run" : 5 ,
"min_hours_to_resolution" : 2
2026-03-03 15:32:53 -06:00
}
```
---
## Usage
2026-03-04 00:40:52 -06:00
### bot_v1.py
```bash
# Scan markets and show signals
python bot_v1.py
```
### bot_v2.py
2026-03-03 15:32:53 -06:00
```bash
# Paper mode — shows signals + Kelly/EV analysis, no trades
2026-03-04 00:40:52 -06:00
python bot_v2.py
2026-03-03 15:32:53 -06:00
# Simulation mode — executes trades, updates virtual $1,000 balance
2026-03-04 00:40:52 -06:00
python bot_v2.py --live
# Live monitor — updates dashboard every 10s
python bot_v2.py --monitor
2026-03-03 15:32:53 -06:00
# Show open positions and PnL
2026-03-04 00:40:52 -06:00
python bot_v2.py --positions
2026-03-03 15:32:53 -06:00
# Reset simulation back to $1,000
2026-03-04 00:40:52 -06:00
python bot_v2.py --reset
2026-03-03 15:32:53 -06:00
```
---
## Dashboard
2026-03-04 00:40:52 -06:00
Run a local server in the bot folder:
```bash
python -m http.server 8000
```
Then open `http://localhost:8000/sim_dashboard.html` in your browser.
2026-03-03 15:32:53 -06:00
- Balance chart with floating +/- labels on each trade
- Open positions with Kelly %, EV, and price progress bar
- Full trade history with W/L tracking
2026-03-04 00:40:52 -06:00
- Refreshes every 10 seconds automatically
2026-03-03 15:32:53 -06:00
---
## Configuration
| Parameter | Default | Description |
2026-03-04 00:40:52 -06:00
|-----------|---------|-------------|
2026-03-03 15:32:53 -06:00
| `entry_threshold` | `0.15` | Buy below this price |
| `exit_threshold` | `0.45` | Sell above this price |
| `locations` | `NYC,...` | Cities to scan |
| `max_trades_per_run` | `5` | Max trades per run |
| `min_hours_to_resolution` | `2` | Skip if resolves too soon |
---
## Live Trading
The bot runs in simulation mode by default. To execute real trades, add Polymarket CLOB integration:
```bash
pip install py-clob-client
```
2026-03-04 00:40:52 -06:00
Then replace the paper mode block in `bot_v2.py` with your CLOB buy function. Full guide in the article linked below.
2026-03-03 15:32:53 -06:00
---
## APIs Used
| API | Auth | Purpose |
2026-03-04 00:40:52 -06:00
|-----|------|---------|
| Open-Meteo | None | Weather forecasts |
| Polymarket Gamma | None | Market data |
| Polymarket CLOB | Wallet key | Live trading (optional) |
2026-03-03 15:32:53 -06:00
---
## Disclaimer
This is not financial advice. Prediction markets carry real risk. Run the simulation thoroughly before committing real capital.