Files
weatherbot/README.md
T

128 lines
4.2 KiB
Markdown
Raw Normal View History

2026-03-20 07:13:08 -05:00
# 🌤 WeatherBet — Polymarket Weather Trading Bot
2026-03-03 15:32:53 -06:00
2026-03-20 07:13:08 -05:00
Automated weather market trading bot for Polymarket. Finds mispriced temperature outcomes using real forecast data from multiple sources across 20 cities worldwide.
2026-03-03 15:32:53 -06:00
2026-03-04 00:40:52 -06:00
No SDK. No black box. Pure Python.
---
## Versions
2026-03-20 07:13:08 -05:00
### `bot_v1.py` — Base Bot
2026-03-10 13:41:05 -05:00
The foundation. Scans 6 US cities, fetches forecasts from NWS using airport station coordinates, finds matching temperature buckets on Polymarket, and enters trades when the market price is below the entry threshold.
2026-03-04 00:40:52 -06:00
No math, no complexity. Just the core logic — good for understanding how the system works.
2026-03-20 07:13:08 -05:00
### `weatherbet.py` — Full Bot (current)
2026-03-04 00:40:52 -06:00
Everything in v1, plus:
2026-03-20 07:13:08 -05:00
- **20 cities** across 4 continents (US, Europe, Asia, South America, Oceania)
- **3 forecast sources** — ECMWF (global), HRRR/GFS (US, hourly), METAR (real-time observations)
2026-03-04 00:40:52 -06:00
- **Expected Value** — skips trades where the math doesn't work
2026-03-20 07:13:08 -05:00
- **Kelly Criterion** — sizes positions based on edge strength
- **Stop-loss + trailing stop** — 20% stop, moves to breakeven at +20%
- **Slippage filter** — skips markets with spread > $0.03
- **Self-calibration** — learns forecast accuracy per city over time
- **Full data storage** — every forecast snapshot, trade, and resolution saved to JSON
2026-03-04 00:40:52 -06:00
2026-03-03 15:32:53 -06:00
---
## How It Works
2026-03-09 02:26:29 -05:00
Polymarket runs markets like "Will the highest temperature in Chicago be between 4647°F on March 7?" These markets are often mispriced — the forecast says 78% likely but the market is trading at 8 cents.
2026-03-03 15:32:53 -06:00
The bot:
2026-03-20 07:13:08 -05:00
1. Fetches forecasts from ECMWF and HRRR via Open-Meteo (free, no key required)
2. Gets real-time observations from METAR airport stations
2026-03-09 02:26:29 -05:00
3. Finds the matching temperature bucket on Polymarket
2026-03-20 07:13:08 -05:00
4. Calculates Expected Value — only enters if the math is positive
5. Sizes the position using fractional Kelly Criterion
6. Monitors stops every 10 minutes, full scan every hour
7. Auto-resolves markets by querying Polymarket API directly
2026-03-09 02:26:29 -05:00
---
## Why Airport Coordinates Matter
Most bots use city center coordinates. That's wrong.
Every Polymarket weather market resolves on a specific airport station. NYC resolves on LaGuardia (KLGA), Dallas on Love Field (KDAL) — not DFW. The difference between city center and airport can be 38°F. On markets with 12°F buckets, that's the difference between the right trade and a guaranteed loss.
| City | Station | Airport |
|------|---------|---------|
| NYC | KLGA | LaGuardia |
| Chicago | KORD | O'Hare |
| Miami | KMIA | Miami Intl |
| Dallas | KDAL | Love Field |
| Seattle | KSEA | Sea-Tac |
| Atlanta | KATL | Hartsfield |
2026-03-20 07:13:08 -05:00
| London | EGLC | London City |
| Tokyo | RJTT | Haneda |
| ... | ... | ... |
2026-03-03 15:32:53 -06:00
---
## Installation
```bash
git clone https://github.com/alteregoeth-ai/weatherbot
cd weatherbot
2026-03-10 13:41:05 -05:00
pip install requests
2026-03-03 15:32:53 -06:00
```
2026-03-10 13:41:05 -05:00
Create `config.json` in the project folder:
2026-03-03 15:32:53 -06:00
```json
{
2026-03-20 07:13:08 -05:00
"balance": 10000.0,
"max_bet": 20.0,
"min_ev": 0.05,
"max_price": 0.45,
"min_volume": 2000,
"min_hours": 2.0,
"max_hours": 72.0,
"kelly_fraction": 0.25,
"max_slippage": 0.03,
"scan_interval": 3600,
"calibration_min": 30,
"vc_key": "YOUR_VISUAL_CROSSING_KEY"
2026-03-03 15:32:53 -06:00
}
```
2026-03-20 07:13:08 -05:00
Get a free Visual Crossing API key at visualcrossing.com — used to fetch actual temperatures after market resolution.
2026-03-03 15:32:53 -06:00
---
## Usage
2026-03-04 00:40:52 -06:00
```bash
2026-03-20 07:13:08 -05:00
python weatherbet.py # start the bot — scans every hour
python weatherbet.py status # balance and open positions
python weatherbet.py report # full breakdown of all resolved markets
2026-03-04 00:40:52 -06:00
```
2026-03-03 15:32:53 -06:00
---
2026-03-20 07:13:08 -05:00
## Data Storage
2026-03-03 15:32:53 -06:00
2026-03-20 07:13:08 -05:00
All data is saved to `data/markets/` — one JSON file per market. Each file contains:
- Hourly forecast snapshots (ECMWF, HRRR, METAR)
- Market price history
- Position details (entry, stop, PnL)
- Final resolution outcome
This data is used for self-calibration — the bot learns forecast accuracy per city over time and adjusts position sizing accordingly.
2026-03-03 15:32:53 -06:00
---
2026-03-09 02:26:29 -05:00
## APIs Used
| API | Auth | Purpose |
|-----|------|---------|
2026-03-20 07:13:08 -05:00
| Open-Meteo | None | ECMWF + HRRR forecasts |
| Aviation Weather (METAR) | None | Real-time station observations |
2026-03-09 02:26:29 -05:00
| Polymarket Gamma | None | Market data |
2026-03-20 07:13:08 -05:00
| Visual Crossing | Free key | Historical temps for resolution |
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.