2026-03-11 11:18:48 +08:00
# PolyWeather Pro
2026-02-05 19:52:02 +08:00
2026-03-11 11:18:48 +08:00
Production weather-intelligence stack for temperature settlement markets.
2026-03-03 00:06:19 +08:00
2026-03-11 11:18:48 +08:00
Official dashboard: [polyweather-pro.vercel.app ](https://polyweather-pro.vercel.app/ )
2026-03-30 00:46:01 +08:00
中文说明: [README_ZH.md ](README_ZH.md )
2026-03-06 19:10:05 +08:00
2026-04-18 14:40:29 +08:00
Public docs center: `/docs/intro` on the main site (bilingual product documentation, including intraday analysis, calibrated probability, model stack, TAF, settlement sources, history, and extension).
2026-03-25 15:55:55 +08:00
2026-03-12 03:18:07 +08:00
## Product Screenshots
### Global Dashboard

### City Analysis (Ankara)

2026-04-19 03:36:26 +08:00
## Product Status (2026-04-19)
2026-03-14 10:53:53 +08:00
- Subscription live: `Pro Monthly 5 USDC` .
- Points redemption live: `500 points = 1 USDC` , max `3 USDC` off.
- Onchain checkout live: Polygon contract checkout (USDC / USDC.e).
- Auto-reconciliation live: event listener + periodic confirm loop.
2026-03-21 14:52:25 +08:00
- Ops dashboard live: `/ops` for memberships, leaderboard, manual point grants, and payment incident triage.
- Lightweight observability live: `/healthz` , `/api/system/status` , `/metrics` .
2026-04-02 23:24:38 +08:00
- Runtime state, cache, and core offline training/backfill flows now use SQLite as the primary path; legacy JSON/JSONL files remain only for migration, export, and explicit fallback input.
2026-04-19 06:11:21 +08:00
- EMOS/CRPS calibration is wired and trainable, but production should stay on `legacy` or `emos_shadow` ; `emos_primary` is only for candidates that pass local offline evaluation and manual rollout.
2026-04-18 14:40:29 +08:00
- Intraday analysis is now positioned as a professional meteorology read: headline, confidence, base/upside/downside paths, next observation point, evidence chain, failure modes, and confirmation rules.
- Intraday modal now blocks stale cached detail during refresh, so users do not briefly trade off old city/date data before full detail arrives.
2026-04-19 06:11:21 +08:00
- Calibrated model probability is now the primary probability panel. It shows the active production probability engine; EMOS/LGBM are surfaced only when evaluated or shadowed, while model consensus and market prices remain secondary references.
2026-03-24 04:03:41 +08:00
- Non-Hong Kong airport cities now ingest `TAF` and parse `FM / TEMPO / BECMG / PROB30/40` .
- Temperature chart now overlays `TAF Timing` markers near the expected peak window.
- Trade cue now combines upper-air structure, `TAF` , market crowding, and `edge_percent` .
- Browser extension now uses `DEB` for multi-day forecast and stays positioned as a lightweight lead-in to the main site.
2026-04-10 08:04:25 +08:00
- Official nearby-network layer now covers `MGM` (Turkey), `CMA/NMC` (Mainland China), `JMA AMeDAS` (Japan), `KMA` (Korea), `HKO` (Hong Kong), and `CWA` (Taiwan).
- Tokyo now ingests Haneda `JMA AMeDAS` 10-minute temperature as the official enhancement layer.
- Dashboard prewarm is now supported through a dedicated worker / cron path, with runtime status exposed in `/api/system/status` and `/ops` .
- `/ops` now exposes cache bucket counts, summary cache hit / miss rate, and prewarm runtime heartbeat.
- Intraday commentary can optionally use `Groq` as a bilingual rewrite layer, while rule-based commentary remains the fallback.
- Vercel frontend guidance now includes cost controls for analytics, eager fetches, and edge-side scanner blocking.
2026-03-14 10:53:53 +08:00
2026-03-30 00:46:01 +08:00
## License & Commercial Boundary
2026-03-14 10:53:53 +08:00
2026-03-30 00:46:01 +08:00
This repository is licensed under **GNU AGPL-3.0 only** from `2026-03-30` onward.
2026-03-14 10:53:53 +08:00
2026-03-30 00:46:01 +08:00
- Public in repo: weather aggregation, core analysis, dashboard, bot baseline, and standard payment flow.
- Not included in this repository: private production data, internal operating thresholds, commercial risk rules, pricing strategy details, and growth tooling.
- Trademark, brand, domain, production databases, and hosted-service operations are **not** granted by the code license.
2026-03-14 10:53:53 +08:00
2026-03-30 00:46:01 +08:00
See: [AGPL-3.0 & Commercial Boundary ](docs/OPEN_CORE_POLICY.md )
2026-03-14 10:53:53 +08:00
2026-03-12 12:01:29 +08:00
## Core Capabilities
2026-03-06 19:10:05 +08:00
2026-04-18 14:40:29 +08:00
- Aggregates observations and forecasts for 52 monitored cities.
2026-03-12 12:01:29 +08:00
- Uses DEB (Dynamic Error Balancing) to blend multi-model highs.
2026-04-18 14:40:29 +08:00
- Generates settlement-oriented calibrated probability buckets (`mu` + bucket distribution), with `LGBM` metadata surfaced when the calibrated engine is active.
2026-03-14 10:53:53 +08:00
- Maps weather view to Polymarket quotes for mispricing scan.
- Reuses one analysis core across web dashboard and Telegram bot.
2026-03-21 14:52:25 +08:00
- Adds payment audit trails, replay tooling, and incident visibility in ops.
2026-04-18 14:40:29 +08:00
- Adds peak-window-oriented intraday analysis with meteorology headline, path buckets, evidence chain, invalidation rules, and confirmation rules.
2026-03-24 04:03:41 +08:00
- Adds airport-side `TAF` timing overlays and airport suppression/disruption interpretation for non-Hong Kong airport cities.
2026-04-10 08:04:25 +08:00
- Adds official nearby-network enhancement layers for China, Japan, Korea, Hong Kong, Taiwan, and Turkey without replacing airport settlement anchors.
- Adds optional dashboard prewarm worker so hot cities can be refreshed before user clicks.
2026-02-07 01:21:55 +08:00
2026-03-14 10:53:53 +08:00
## Reference Architecture
2026-02-27 01:58:29 +08:00
2026-03-11 11:18:48 +08:00
```mermaid
2026-03-12 12:01:29 +08:00
flowchart LR
U["Users (Web / Telegram)"] --> FE["Next.js Frontend (Vercel)"]
U --> BOT["Telegram Bot (VPS)"]
FE --> API["FastAPI /web/app.py"]
BOT --> API
API --> WX["Weather Collector"]
WX --> METAR["Aviation Weather (METAR)"]
2026-03-24 04:03:41 +08:00
WX --> TAF["Aviation Weather (TAF)"]
2026-03-12 12:01:29 +08:00
WX --> MGM["MGM (Turkey station network)"]
WX --> OM["Open-Meteo"]
2026-04-10 08:04:25 +08:00
WX --> JMA["JMA AMeDAS (Japan)"]
WX --> KMA["KMA (Korea)"]
WX --> HKO["HKO / CWA / NOAA / Official settlement sources"]
2026-03-01 19:17:27 +08:00
2026-03-14 10:53:53 +08:00
API --> ANA["DEB + Trend + Probability + Market Scan"]
ANA --> PAY["Payment State (Intent + Event + Confirm Loop)"]
ANA --> PM["Polymarket Read-only Layer"]
2026-04-10 08:04:25 +08:00
ANA --> LLM["Optional Groq Commentary Rewrite"]
API --> PREWARM["Dashboard Prewarm API / Worker"]
2026-03-11 11:18:48 +08:00
```
2026-02-27 01:58:29 +08:00
2026-04-18 14:40:29 +08:00
## Monitored Cities (52)
2026-03-12 12:01:29 +08:00
2026-04-18 14:40:29 +08:00
- Europe / Middle East / Africa: Ankara, Istanbul, Moscow, London, Paris, Munich, Milan, Warsaw, Madrid, Tel Aviv, Amsterdam, Helsinki, Lagos, Cape Town, Jeddah
- APAC: Seoul, Busan, Hong Kong, Lau Fau Shan, Taipei, Shanghai, Beijing, Wuhan, Chengdu, Chongqing, Shenzhen, Guangzhou, Singapore, Tokyo, Kuala Lumpur, Jakarta, Manila, Wellington
- Americas: Toronto, New York, Los Angeles, San Francisco, Aurora, Austin, Houston, Chicago, Dallas, Miami, Atlanta, Seattle, Mexico City, Buenos Aires, Sao Paulo, Panama City
- South Asia: Lucknow, Karachi, Masroor Air Base
2026-03-12 12:01:29 +08:00
2026-03-11 11:18:48 +08:00
## Quick Start
2026-03-09 04:41:24 +08:00
2026-03-12 12:01:29 +08:00
### Backend + Bot (Docker)
2026-02-27 14:36:36 +08:00
2026-03-11 11:18:48 +08:00
```bash
docker compose up -d --build
2026-03-06 19:10:05 +08:00
```
2026-02-27 14:36:36 +08:00
2026-03-11 11:18:48 +08:00
### Frontend (local)
2026-02-18 09:49:40 +08:00
2026-03-06 19:16:48 +08:00
```bash
2026-03-11 11:18:48 +08:00
cd frontend
2026-04-10 08:04:25 +08:00
npm ci
2026-03-11 11:18:48 +08:00
npm run dev
2026-02-07 01:21:55 +08:00
```
2026-03-24 04:03:41 +08:00
## Recent Highlights
2026-04-18 14:40:29 +08:00
- Airport-linked contracts use the METAR / airport primary observing site as the settlement anchor. Wunderground pages are reference/history pages, not stations.
- Taipei and Shenzhen retain their explicitly configured station history pages for reconciliation, but the docs avoid describing Wunderground itself as a physical station.
2026-03-24 04:03:41 +08:00
- Hong Kong keeps `HKO` official readings in dashboard and history, without falling back to airport METAR lines.
2026-04-18 14:40:29 +08:00
- Intraday analysis now separates meteorology conclusion, evidence chain, invalidation rules, confirmation rules, calibrated probability, and market reference.
2026-03-24 04:03:41 +08:00
- `TAF` is used as an airport-side confirmation layer, not as the main temperature model.
2026-04-18 14:40:29 +08:00
- `LGBM` can power the calibrated probability panel; model vote counts remain an explanatory consensus line, not the final probability.
2026-03-24 04:03:41 +08:00
- Browser extension remains a lightweight monitoring + basic-bias product, while the site holds the full analysis experience.
2026-03-14 10:53:53 +08:00
## Runtime Data (Recommended on VPS)
2026-02-06 20:16:45 +08:00
2026-03-14 10:53:53 +08:00
Use external runtime storage to avoid SQLite/git conflicts:
```env
POLYWEATHER_RUNTIME_DATA_DIR = /var/lib/polyweather
POLYWEATHER_DB_PATH = /var/lib/polyweather/polyweather.db
2026-04-02 23:24:38 +08:00
POLYWEATHER_STATE_STORAGE_MODE = sqlite
2026-03-11 11:18:48 +08:00
```
2026-03-04 03:06:40 +08:00
2026-04-19 06:11:21 +08:00
## EMOS Local Training
Do not run full EMOS retraining on a small VPS. The VPS should collect data and load approved calibration files; training should run on a local/dev machine using a copied production SQLite database:
```powershell
scp root @38 . 54 . 27 . 70 : / var / lib / polyweather / polyweather . db E: \ web \ PolyWeather \ data \ polyweather-prod . db
$env:POLYWEATHER_DB_PATH = "E:\web\PolyWeather\data\polyweather-prod.db"
$env:POLYWEATHER_RUNTIME_DATA_DIR = "E:\web\PolyWeather\artifacts\local_runtime"
python scripts \ auto_retrain_probability_calibration . py - -verbose - -snapshot-limit 50000
```
Promote a generated `default.json` only when `auto_retrain_report.json` has `ready_for_promotion=true` , and prefer `emos_shadow` before enabling `emos_primary` .
2026-03-12 12:01:29 +08:00
## Ops Verification
2026-03-12 10:43:31 +08:00
2026-03-21 14:52:25 +08:00
### Health / system status / metrics
```bash
curl http://127.0.0.1:8000/healthz
curl http://127.0.0.1:8000/api/system/status
curl http://127.0.0.1:8000/metrics
```
2026-04-10 08:04:25 +08:00
### Dashboard prewarm worker
```bash
docker compose --profile workers up -d polyweather_prewarm
curl http://127.0.0.1:8000/api/system/status
```
Check:
- `prewarm.thread_alive`
- `prewarm.runtime.cycle_count`
- `cache.analysis.hit_rate`
- `cache.open_meteo_forecast_entries`
2026-03-14 10:53:53 +08:00
### Frontend cache headers
2026-03-12 10:43:31 +08:00
```bash
./scripts/validate_frontend_cache.sh "https://polyweather-pro.vercel.app"
```
2026-03-14 10:53:53 +08:00
### Payment auto-reconciliation logs
2026-03-12 10:43:31 +08:00
```bash
2026-03-14 10:53:53 +08:00
docker compose logs -f polyweather | egrep "payment event loop started|payment confirm loop started|payment auto-confirmed"
2026-03-12 10:43:31 +08:00
```
2026-03-21 14:52:25 +08:00
### Payment runtime
```bash
curl http://127.0.0.1:8000/api/payments/runtime
```
2026-03-14 10:53:53 +08:00
### Wallet activity logs
2026-03-12 12:01:29 +08:00
```bash
2026-03-14 10:53:53 +08:00
docker compose logs -f polyweather | egrep "polymarket wallet activity watcher started|wallet activity pushed"
2026-03-12 12:01:29 +08:00
```
2026-03-14 10:53:53 +08:00
## Telegram Commands
2026-03-12 12:01:29 +08:00
| Command | Purpose |
| :-- | :-- |
| `/city <name>` | City real-time analysis |
| `/deb <name>` | DEB historical reconciliation |
| `/top` | User leaderboard |
| `/id` | Show current chat ID |
2026-03-14 10:53:53 +08:00
| `/diag` | Startup diagnostics |
2026-03-12 12:01:29 +08:00
| `/help` | Help and usage |
2026-03-09 04:41:24 +08:00
2026-03-11 11:18:48 +08:00
## Documentation Index
2026-03-04 03:06:40 +08:00
2026-03-14 10:53:53 +08:00
- Chinese overview: [README_ZH.md ](README_ZH.md )
- Chinese API guide: [docs/API_ZH.md ](docs/API_ZH.md )
2026-03-24 04:21:23 +08:00
- TAF signal guide (ZH): [docs/TAF_SIGNAL_ZH.md ](docs/TAF_SIGNAL_ZH.md )
2026-04-18 14:40:29 +08:00
- Model stack & DEB (ZH): [docs/MODEL_STACK_AND_DEB_ZH.md ](docs/MODEL_STACK_AND_DEB_ZH.md )
- EMOS + LGBM system (ZH): [docs/EMOS_LGBM_SYSTEM_ZH.md ](docs/EMOS_LGBM_SYSTEM_ZH.md )
2026-03-14 10:53:53 +08:00
- Commercialization: [docs/COMMERCIALIZATION.md ](docs/COMMERCIALIZATION.md )
2026-03-30 00:46:01 +08:00
- AGPL-3.0 policy: [docs/OPEN_CORE_POLICY.md ](docs/OPEN_CORE_POLICY.md )
2026-03-14 10:53:53 +08:00
- Supabase setup (ZH): [docs/SUPABASE_SETUP_ZH.md ](docs/SUPABASE_SETUP_ZH.md )
2026-03-21 14:52:25 +08:00
- Configuration & secrets (ZH): [docs/CONFIGURATION_ZH.md ](docs/CONFIGURATION_ZH.md )
2026-03-29 23:29:17 +08:00
- LightGBM daily-high model (ZH): [docs/LGBM_DAILY_HIGH_ZH.md ](docs/LGBM_DAILY_HIGH_ZH.md )
2026-03-21 14:52:25 +08:00
- Frontend deployment (ZH): [docs/FRONTEND_DEPLOYMENT_ZH.md ](docs/FRONTEND_DEPLOYMENT_ZH.md )
2026-03-14 10:53:53 +08:00
- Tech debt (EN): [docs/TECH_DEBT.md ](docs/TECH_DEBT.md )
- Tech debt (ZH): [docs/TECH_DEBT_ZH.md ](docs/TECH_DEBT_ZH.md )
- Payment verification: [docs/payments/POLYGONSCAN_VERIFY.md ](docs/payments/POLYGONSCAN_VERIFY.md )
2026-03-21 14:52:25 +08:00
- Payment audit: [docs/payments/PAYMENT_AUDIT_ZH.md ](docs/payments/PAYMENT_AUDIT_ZH.md )
- Payment V2 upgrade: [docs/payments/PAYMENT_UPGRADE_V2_ZH.md ](docs/payments/PAYMENT_UPGRADE_V2_ZH.md )
- Ops admin guide: [docs/OPS_ADMIN_ZH.md ](docs/OPS_ADMIN_ZH.md )
2026-04-18 14:40:29 +08:00
- Monitoring guide (ZH): [docs/MONITORING_ZH.md ](docs/MONITORING_ZH.md )
2026-03-21 14:52:25 +08:00
- Deep research report: [docs/deep-research-report.md ](docs/deep-research-report.md )
2026-03-14 10:53:53 +08:00
- Frontend report: [FRONTEND_REDESIGN_REPORT.md ](FRONTEND_REDESIGN_REPORT.md )
2026-03-20 19:13:14 +08:00
- Release process: [RELEASE.md ](RELEASE.md )
- Changelog: [CHANGELOG.md ](CHANGELOG.md )
2026-03-08 04:35:04 +08:00
2026-03-14 10:53:53 +08:00
## Version
2026-03-08 04:35:04 +08:00
2026-04-18 14:40:29 +08:00
- Version: `v1.5.4`
2026-04-19 06:11:21 +08:00
- Last Updated: `2026-04-19`