Node.js / TypeScript trading automation for Polymarket daily temperature markets. The bot combines National Weather Service (NWS) forecast data with Polymarket CLOB pricing: it maps a city’s forecast max temperature to a market bucket, then supports read-only signals, paper trading in a local JSON ledger, or live orders.
The bot scans configured cities, finds the matching temperature range for the forecast, compares the YES price to entry and exit thresholds, and either prints signals, updates simulation.json, or posts real CLOB orders depending on the selected npm script. Runtime configuration is driven by .env (not config.json at execution time for the main flows described here).
weather-video-1.mp4
weather-video-2.mp4
- NWS-driven: Uses NWS observations and forecast data to estimate daily max temperature.
- Bucket matching: Picks the Polymarket outcome range that contains the forecast temperature.
- Three execution modes: Signal-only, paper (simulated PnL in
simulation.json), and live CLOB trading. - Proxy wallet support: MetaMask signer with Polymarket proxy funder when
USE_PROXY_WALLETandSIGNATURE_TYPE=2are set. - Recurring runs: Optional
--intervalfor scheduled live execution (seenpm run trade).
- Runtime: Node.js, TypeScript
- Chain: Polygon
- Execution: Polymarket CLOB V2 via
@polymarket/clob-client-v2 - Data: NWS APIs for location-specific weather (see
src/nws.tsand related modules) - Config:
.envfor secrets and strategy parameters;config.jsonis not used for runtime config in the primary flows documented below
NWS forecast + city list → Polymarket event for date
→ Map temp to bucket → Compare YES to ENTRY_THRESHOLD / EXIT_THRESHOLD
→ Signal | Update simulation | Place order
- Node.js 18+ and npm
- A wallet with USDC on Polymarket for live mode, with keys from environment only
- NWS and Polymarket API reachability
-
Clone the repository and enter the directory
git clone <repository-url> cd Polymarket-Weather-Bot
-
Install dependencies
npm install
-
Configure environment
cp .env.sample .env
Edit
.env. Example:POLYMARKET_PRIVATE_KEY=0xYOUR_METAMASK_PRIVATE_KEY POLYMARKET_PROXY_WALLET_ADDRESS=0xYOUR_POLYMARKET_PROXY_WALLET USE_PROXY_WALLET=true SIGNATURE_TYPE=2 ENTRY_THRESHOLD=0.15 EXIT_THRESHOLD=0.45 MAX_TRADES_PER_RUN=5 MIN_HOURS_TO_RESOLUTION=2 LOCATIONS="nyc,chicago,miami,dallas,seattle,atlanta"
-
Credentials
For live trading, confirm the private key, proxy address, USDC balance, and Polymarket trading allowance. Test with
signalandpaperbeforeexecute/trade.
| Variable | Type | Default | Description |
|---|---|---|---|
POLYMARKET_PRIVATE_KEY |
string | required for live | MetaMask (or EOA) private key |
POLYMARKET_PROXY_WALLET_ADDRESS |
string | required for live with proxy | Polymarket proxy funder from account settings |
USE_PROXY_WALLET |
boolean | false (see code) |
When true, use proxy; typically pair with SIGNATURE_TYPE=2 |
SIGNATURE_TYPE |
0 | 1 | 2 |
derived | 0 EOA, 1 Polymarket proxy, 2 Gnosis Safe / browser flow |
ENTRY_THRESHOLD |
number | 0.15 |
Buy when matching bucket YES is below this |
EXIT_THRESHOLD |
number | 0.45 |
Exit when held YES is above this |
MAX_TRADES_PER_RUN |
number | 5 |
Cap entries per run |
MIN_HOURS_TO_RESOLUTION |
number | 2 |
Skip markets resolving sooner than this |
LOCATIONS |
string | multi-city | Comma-separated city keys to scan |
nyc, chicago, miami, dallas, seattle, atlanta (see LOCATIONS and source for the authoritative list).
| Mode | Command | Real orders? |
|---|---|---|
| Signal | npm run signal |
No |
| Paper | npm run paper |
No (writes simulation.json) |
| One-shot live | npm run execute |
Yes |
| Live on interval | npm run trade |
Yes (30-minute interval) |
npm run signal
npm run paper
npm run execute
npm run tradenpm run positions # list open (paper) positions
npm run reset # reset simulation state- Load forecast max temperature for each configured city and resolution window.
- Find the Polymarket market whose temperature bucket contains that value.
- If YES is below
ENTRY_THRESHOLDand other guards pass (horizon, max trades, existing position), open. - If already holding, exit when YES reaches
EXIT_THRESHOLD(or per implementation insrc/strategy.ts).
- Paper / simulation:
simulation.jsontracks virtual balance and open legs (file is gitignored).
Polymarket-Weather-Bot/
├── public/
│ ├── weather.png # README / demo still (add asset)
│ └── weather.mp4 # optional local demo
├── src/
│ ├── index.ts
│ ├── config.ts
│ ├── nws.ts
│ ├── polymarket.ts
│ ├── clob.ts
│ ├── strategy.ts
│ ├── simState.ts
│ ├── walletBalance.ts
│ ├── parsing.ts
│ ├── time.ts
│ └── colors.ts
├── dist/ # tsc output
├── simulation.json # local paper state (gitignored)
├── package.json
├── tsconfig.json
├── .env.sample
└── README.md
Orders use @polymarket/clob-client-v2 with the configured signer and, when used, the Polymarket proxy as funder.
Forecast and related endpoints are accessed from src/nws.ts and supporting modules; respect NWS terms of use and rate limits.
- Console output with chalk styling for readability.
- Paper mode: inspect
simulation.jsonandnpm run positions.
Worth tracking for this project:
- Mode gating: Always validate
signal→paper→executebefore scaling size. - simulation state: Regenerated locally; not suitable for commit.
- Forecast error: NWS data can disagree with the resolution source Polymarket uses.
- Liquidity and slippage: YES/NO books may be thin.
- Time to resolution: Short horizons increase sensitivity to price moves.
- Live credentials: A mistake in
POLYMARKET_*or allowance can still move real funds.
Operational suggestions: Run signal and paper first, use small size in execute, and monitor until you trust the end-to-end path.
npm run build
npm run signalUse repository issues for bugs and feature requests. For CLOB and proxy wallet behavior, refer to Polymarket’s official documentation.
Disclaimer: This software is provided as-is, without warranty. Prediction markets and digital assets involve substantial risk of loss. Use only capital you can afford to lose and comply with applicable laws in your jurisdiction.
Version: 1.0.0
Last updated: April 2026
