Update README.md
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 🌤 Weather Trading Bot — Polymarket
|
||||
|
||||
Automated weather market trading bot for Polymarket. Finds mispriced temperature outcomes using Open-Meteo forecasts.
|
||||
Automated weather market trading bot for Polymarket. Finds mispriced temperature outcomes using real station data from NWS and Visual Crossing.
|
||||
|
||||
No SDK. No black box. Pure Python.
|
||||
|
||||
@@ -9,36 +9,66 @@ 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.
|
||||
|
||||
The foundation. Scans 6 US cities, fetches forecasts from NWS, 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)*
|
||||
### `bot_v2.py` — Kelly + EV Edition
|
||||
|
||||
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
|
||||
- **Live dashboard** — updates `simulation.json` so the dashboard stays current
|
||||
|
||||
~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
|
||||
### `bot_v3.py` — Auto-Cycle + Forecast Monitoring (current)
|
||||
|
||||
Everything in v2, plus:
|
||||
|
||||
- **Auto-cycle** — scans every hour, synchronized to the clock (:00, :01, :02...)
|
||||
- **Forecast monitor** — checks every 60 seconds, closes positions if forecast changes or EV goes negative
|
||||
- **Real station data** — NWS hourly observations + Visual Crossing for today's actual readings
|
||||
- **Correct airport coordinates** — each city mapped to the exact station Polymarket resolves on
|
||||
- **Liquidity-aware sizing** — reduces position size for low-volume markets, hard cap at $20 for markets under $1k volume
|
||||
- **Slippage simulation** — entry price reflects real market impact
|
||||
- **16 cities** — 6 US cities via NWS, 10 international via Open-Meteo
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
Polymarket runs markets like "Will the highest temperature in Chicago be between 46–47°F on March 7?" These markets are often mispriced — the forecast says 78% likely but the market is trading at 8 cents.
|
||||
|
||||
The bot:
|
||||
1. Fetches 4-day forecasts from **Open-Meteo** (free, no API key)
|
||||
2. Finds the matching temperature bucket on Polymarket
|
||||
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
|
||||
|
||||
1. Fetches forecasts from NWS (US cities) and Open-Meteo (international) using airport coordinates
|
||||
2. Combines real station observations with hourly forecast to get the true daily maximum
|
||||
3. Finds the matching temperature bucket on Polymarket
|
||||
4. Calculates Expected Value — skips the trade if EV is below threshold
|
||||
5. Calculates Kelly Criterion — sizes position based on edge strength
|
||||
6. Adjusts position size for market liquidity and simulates slippage
|
||||
7. Monitors all open positions every 60 seconds — closes if forecast shifts
|
||||
|
||||
---
|
||||
|
||||
## 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 3–8°F. On markets with 1–2°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 |
|
||||
|
||||
---
|
||||
|
||||
@@ -56,7 +86,7 @@ EV = (our_probability × net_payout) − (1 − our_probability)
|
||||
Kelly % = (p × b − q) / b
|
||||
```
|
||||
|
||||
We use fractional Kelly (25%) and cap each position at 10% of balance.
|
||||
We use fractional Kelly (25%) and cap each position at 5% of balance.
|
||||
|
||||
---
|
||||
|
||||
@@ -65,7 +95,7 @@ We use fractional Kelly (25%) and cap each position at 10% of balance.
|
||||
```bash
|
||||
git clone https://github.com/alteregoeth-ai/weatherbot
|
||||
cd weatherbot
|
||||
pip install requests
|
||||
pip install requests pytz
|
||||
```
|
||||
|
||||
Add your settings to `config.json`:
|
||||
@@ -74,7 +104,8 @@ Add your settings to `config.json`:
|
||||
{
|
||||
"entry_threshold": 0.15,
|
||||
"exit_threshold": 0.45,
|
||||
"locations": "NYC,Chicago,Seattle,Atlanta,Dallas,Miami",
|
||||
"max_position_pct": 0.05,
|
||||
"locations": "nyc,chicago,miami,dallas,seattle,atlanta",
|
||||
"max_trades_per_run": 5,
|
||||
"min_hours_to_resolution": 2
|
||||
}
|
||||
@@ -85,27 +116,19 @@ Add your settings to `config.json`:
|
||||
## Usage
|
||||
|
||||
### bot_v1.py
|
||||
|
||||
```bash
|
||||
# Scan markets and show signals
|
||||
python bot_v1.py
|
||||
python bot_v1.py # paper mode — shows signals, no trades
|
||||
python bot_v1.py --live # simulates trades with $1,000 balance
|
||||
python bot_v1.py --reset # reset balance back to $1,000
|
||||
```
|
||||
|
||||
### bot_v2.py
|
||||
### bot_v3.py
|
||||
|
||||
```bash
|
||||
# Paper mode — shows signals + Kelly/EV analysis, no trades
|
||||
python bot_v2.py
|
||||
|
||||
# Simulation mode — executes trades, updates virtual $1,000 balance
|
||||
python bot_v2.py --live
|
||||
|
||||
# Live monitor — updates dashboard every 10s
|
||||
python bot_v2.py --monitor
|
||||
|
||||
# Show open positions and PnL
|
||||
python bot_v2.py --positions
|
||||
|
||||
# Reset simulation back to $1,000
|
||||
python bot_v2.py --reset
|
||||
python bot_v3.py --live # run bot (entry scanner + forecast monitor)
|
||||
python bot_v3.py --positions # show open positions and PnL
|
||||
python bot_v3.py --reset # reset simulation back to $1,000
|
||||
```
|
||||
|
||||
---
|
||||
@@ -118,12 +141,12 @@ Run a local server in the bot folder:
|
||||
python -m http.server 8000
|
||||
```
|
||||
|
||||
Then open `http://localhost:8000/sim_dashboard.html` in your browser.
|
||||
Then open `http://localhost:8000/sim_dashboard_repost.html` in your browser.
|
||||
|
||||
- Balance chart with floating +/- labels on each trade
|
||||
- Open positions with Kelly %, EV, and price progress bar
|
||||
- Full trade history with W/L tracking
|
||||
- Refreshes every 10 seconds automatically
|
||||
- Balance chart with history
|
||||
- Open positions with Kelly %, EV, and current PnL
|
||||
- Full trade history with ENTRY/SELL labels
|
||||
- Refreshes automatically every 10 seconds
|
||||
|
||||
---
|
||||
|
||||
@@ -133,12 +156,25 @@ Then open `http://localhost:8000/sim_dashboard.html` in your browser.
|
||||
|-----------|---------|-------------|
|
||||
| `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 |
|
||||
| `max_position_pct` | `0.05` | Max position size as % of balance |
|
||||
| `locations` | `nyc,...` | Cities to scan (comma separated) |
|
||||
| `max_trades_per_run` | `5` | Max new trades per scan |
|
||||
| `min_hours_to_resolution` | `2` | Skip if resolves too soon |
|
||||
|
||||
---
|
||||
|
||||
## APIs Used
|
||||
|
||||
| API | Auth | Purpose |
|
||||
|-----|------|---------|
|
||||
| NWS (api.weather.gov) | None | US city forecasts + station observations |
|
||||
| Open-Meteo | None | International city forecasts |
|
||||
| Visual Crossing | Free key | Today's actual hourly readings by station |
|
||||
| Polymarket Gamma | None | Market data |
|
||||
| Polymarket CLOB | Wallet key | Live trading (optional) |
|
||||
|
||||
---
|
||||
|
||||
## Live Trading
|
||||
|
||||
The bot runs in simulation mode by default. To execute real trades, add Polymarket CLOB integration:
|
||||
@@ -147,17 +183,7 @@ The bot runs in simulation mode by default. To execute real trades, add Polymark
|
||||
pip install py-clob-client
|
||||
```
|
||||
|
||||
Then replace the paper mode block in `bot_v2.py` with your CLOB buy function. Full guide in the article linked below.
|
||||
|
||||
---
|
||||
|
||||
## APIs Used
|
||||
|
||||
| API | Auth | Purpose |
|
||||
|-----|------|---------|
|
||||
| Open-Meteo | None | Weather forecasts |
|
||||
| Polymarket Gamma | None | Market data |
|
||||
| Polymarket CLOB | Wallet key | Live trading (optional) |
|
||||
Then replace the paper mode block in `bot_v3.py` with your CLOB buy function. Full guide in the article linked below.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user