Update README.md

This commit is contained in:
alteregoeth-ai
2026-03-04 00:40:52 -06:00
committed by GitHub
parent c7322acfc0
commit 560c5d02cb
+65 -20
View File
@@ -1,8 +1,31 @@
# 🌤 Weather Trading Bot — Polymarket # 🌤 Weather Trading Bot — Polymarket
Automated weather market trading bot for Polymarket. Finds mispriced temperature outcomes using Open-Meteo forecasts, filters trades with **Expected Value** analysis, and sizes positions with the **Kelly Criterion**. Automated weather market trading bot for Polymarket. Finds mispriced temperature outcomes using Open-Meteo forecasts.
No SDK. No black box. ~400 lines of pure Python. 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
--- ---
@@ -11,26 +34,29 @@ No SDK. No black box. ~400 lines of pure Python.
Polymarket runs markets like *"Will the highest temperature in NYC be between 4041°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 NYC be between 4041°F on March 4?"* These markets are often mispriced — the forecast says 78% likely, but the market is trading at 8 cents.
The bot: The bot:
1. Fetches 4-day forecasts from [Open-Meteo](https://open-meteo.com) (free, no API key) 1. Fetches 4-day forecasts from **Open-Meteo** (free, no API key)
2. Finds the matching temperature bucket on Polymarket 2. Finds the matching temperature bucket on Polymarket
3. Calculates **Expected Value** — skips the trade if EV is negative 3. Calculates Expected Value — skips the trade if EV is negative
4. Calculates **Kelly Criterion** — sizes the position based on edge strength 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 5. Runs a full $1,000 simulation against real market prices before you risk anything
--- ---
## Kelly + EV Logic ## Kelly + EV Logic
**Expected Value** — is this trade mathematically profitable? **Expected Value** — is this trade mathematically profitable?
``` ```
EV = (our_probability × net_payout) (1 our_probability) EV = (our_probability × net_payout) (1 our_probability)
``` ```
**Kelly Criterion** — how much of the balance to bet? **Kelly Criterion** — how much of the balance to bet?
``` ```
Kelly % = (p × b q) / b 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 10% of balance.
--- ---
@@ -43,11 +69,14 @@ pip install requests
``` ```
Add your settings to `config.json`: Add your settings to `config.json`:
```json ```json
{ {
"entry_threshold": 0.15, "entry_threshold": 0.15,
"exit_threshold": 0.45, "exit_threshold": 0.45,
"locations": "NYC,Chicago,Seattle,Atlanta,Dallas,Miami" "locations": "NYC,Chicago,Seattle,Atlanta,Dallas,Miami",
"max_trades_per_run": 5,
"min_hours_to_resolution": 2
} }
``` ```
@@ -55,37 +84,53 @@ Add your settings to `config.json`:
## Usage ## Usage
### bot_v1.py
```bash
# Scan markets and show signals
python bot_v1.py
```
### bot_v2.py
```bash ```bash
# Paper mode — shows signals + Kelly/EV analysis, no trades # Paper mode — shows signals + Kelly/EV analysis, no trades
python weather_bot_v2.py python bot_v2.py
# Simulation mode — executes trades, updates virtual $1,000 balance # Simulation mode — executes trades, updates virtual $1,000 balance
python weather_bot_v2.py --live python bot_v2.py --live
# Live monitor — updates dashboard every 10s
python bot_v2.py --monitor
# Show open positions and PnL # Show open positions and PnL
python weather_bot_v2.py --positions python bot_v2.py --positions
# Reset simulation back to $1,000 # Reset simulation back to $1,000
python weather_bot_v2.py --reset python bot_v2.py --reset
``` ```
--- ---
## Dashboard ## Dashboard
Open `sim_dashboard.html` in any browser to see the simulation in real time: 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.
- Balance chart with floating +/- labels on each trade - Balance chart with floating +/- labels on each trade
- Open positions with Kelly %, EV, and price progress bar - Open positions with Kelly %, EV, and price progress bar
- Full trade history with W/L tracking - Full trade history with W/L tracking
- No server needed — pure HTML/JS - Refreshes every 10 seconds automatically
--- ---
## Configuration ## Configuration
| Parameter | Default | Description | | Parameter | Default | Description |
|---|---|---| |-----------|---------|-------------|
| `entry_threshold` | `0.15` | Buy below this price | | `entry_threshold` | `0.15` | Buy below this price |
| `exit_threshold` | `0.45` | Sell above this price | | `exit_threshold` | `0.45` | Sell above this price |
| `locations` | `NYC,...` | Cities to scan | | `locations` | `NYC,...` | Cities to scan |
@@ -102,17 +147,17 @@ The bot runs in simulation mode by default. To execute real trades, add Polymark
pip install py-clob-client pip install py-clob-client
``` ```
Then replace the paper mode line in `weather_bot_v2.py` with your CLOB buy function. Full guide in the article linked below. Then replace the paper mode block in `bot_v2.py` with your CLOB buy function. Full guide in the article linked below.
--- ---
## APIs Used ## APIs Used
| API | Auth | Purpose | | API | Auth | Purpose |
|---|---|---| |-----|------|---------|
| [Open-Meteo](https://open-meteo.com) | None | Weather forecasts | | Open-Meteo | None | Weather forecasts |
| [Polymarket Gamma](https://gamma-api.polymarket.com) | None | Market data | | Polymarket Gamma | None | Market data |
| [Polymarket CLOB](https://clob.polymarket.com) | Wallet key | Live trading (optional) | | Polymarket CLOB | Wallet key | Live trading (optional) |
--- ---