Verified working on live data in paper mode, Nov 13, 2026. Ran live in paper mode on Miami (Kalshi KXHIGHMIA and Polymarket US) on the morning of Nov 13, when Kalshi listed only same-day markets and every next-day Polymarket US book was wider than 10¢, so the bot made no paper trades on its own; fills, fees and limits were checked with the margin and spread limits turned off, and settle.py against already-settled Nov 11 and Nov 12 markets. No orders were placed anywhere.
Short answer:Kalshi and Polymarket US temperature markets settle on official sources: Polymarket US uses the NWS Daily Climate Report from the local forecast office, and each Kalshi market names its source in rules_primary. This recipe builds a paper-mode bot that pulls the free NWS API plus Kalshi's public weather index and logs what your rule would do, measured against the settlement source.
Polymarket US temperature contracts settle on the official NWS Daily Climate Report (CLI) from the local forecast office, e.g. New York City = KNYC (Central Park), Chicago = KMDW (Midway). Settlement is 8:00 AM ET the next day (may slip to 11:00 AM ET for review).
Kalshi production REST: https://external-api.kalshi.com/trade-api/v2, with https://api.elections.kalshi.com/trade-api/v2 documented as also supported. On Oct 25 and again on Nov 13, 2026 the first answered 403 from our server and the second worked, so the bot falls back once.
Kalshi publishes a weather index behind its hourly temperature markets: GET /live_data/weather/{city} (e.g. miami), minute-resolution, °F rounded to 0.01. Public, no auth.
Kalshi market rules (rules_primary on GET /markets/{ticker}) name each market's exact source. Read them; don't assume they match Polymarket's.
Free forecast data: the US National Weather Service API at https://api.weather.gov (requires a User-Agent header identifying your app).
The two venues can settle the same city on different sources. When we checked on Oct 22, 2026, Kalshi's Miami daily-high markets (KXHIGHMIA) named The Weather Company (CLIMIA) in rules_primary, while Polymarket US's Miami high markets named the NWS Climatological Report for KMIA.
Kalshi's >86° means 87° or above and <79° means 78° or below; 83-84° includes both ends. The market's strike_type, floor_strike and cap_strike fields let you cross-check the title.
Both venues post new buckets each day and the edges move (Miami Oct 24: 80–81, 82–83…; Oct 26: 79–80, 81–82…). Parse every market, every day.
Taker fees: Kalshi 0.07 × C × P × (1−P) rounded up to the cent. Polymarket US Θ × C × p × (1−p), banker's rounding to the cent. From Nov 21 to Dec 31, 2026, taker trades placed through the API pay Θ 0.0695 at any volume, with 70% of those fees rebated by Polymarket. In the app, Θ is tiered by your trailing 30-day taker volume: 0.11 under $10,000, 0.10 to $50,000, 0.09 to $250,000, 0.0695 above (and 0.0695 in a new account's first 7 days); these app tiers were raised at 9:45 PM ET on Nov 25, 2026. Every Miami market we read on Nov 13 returned feeCoefficient: 0.095, the app base tier at the time.
Paper mode: a local ledger for both venues, filled against the real order book. Kalshi demo orders are optional and off by default.
DifficultyIntermediate
Time3 hours
Cost$0
Works withClaude Code, Cursor, ChatGPT / Codex, Grok
What will you build?
A paper-mode bot that tracks temperature markets for a city, pulls the relevant forecast and observations, and logs what your rule would do, measured against the official settlement source.
Who is it for?
Data-minded builders. Weather markets have public, official settlement data, which makes them great for learning to test a bot honestly.
Not for:Anyone who thinks a free forecast is an edge. Everyone else can read it too.
What happened when we rebuilt it from this prompt
On Nov 13, 2026 we built the bot again from the previous version of this prompt, in a clean folder, and ran it on Miami (Kalshi KXHIGHMIA and Polymarket US's daily-high markets) from 9:01 to 9:08 AM ET. The Oct 25 fixes held: the 403 fallback, the same-day skip, the running max, one position per market and the KILL file all worked. Five things didn't:
The Polymarket US fee was stale. The prompt said 0.0695. Polymarket US now charges takers by tier, and 0.0695 is the top tier (or a new account's first week). All 18 Miami markets returned feeCoefficient: 0.095. On a paper fill of 8 contracts at $0.31 that's $0.16, not the $0.12 the old ledger charged.
settle.py scored unsettled markets. At 9 AM ET the Nov 12 Polymarket US markets were closed but showed outcomePrices: ["0","0"]: not resolved yet. The old settle.py read that as "No won" and scored our test entries. It now waits for ["1","0"] or ["0","1"]. (Kalshi had already finalized Nov 12 at 87.00°.)
It treated books that weren't prices as prices. Every Nov 15 bucket had a YES ask of $0.59 and most had a NO ask of $0.99. The old build took the midpoint as "the market's probability" and used it for the Brier baseline. The bot now skips any market wider than max_spread (10¢) and logs "wide spread".
Kalshi only had today's markets. At 9 AM ET all 6 open KXHIGHMIA markets were for Nov 13, so with trade_same_day = false nothing on Kalshi could trade. The bot now says so in one line instead of leaving you to wonder.
Errors weren't handled. One 429 or dropped connection on Kalshi lost the whole venue for the cycle, with no retry and no look at Retry-After. An HTML page came back as Expecting value: line 1 column 1 (char 0), and a missing config key crashed the bot partway through the cycle. Now there's one HTTP helper with retries, a one-line error for anything that isn't JSON, and a config check before any network call.
Update, Nov 23, 2026: the fee finding above was right on Nov 13. Since 12:01 AM ET on Nov 21, 2026 (through Dec 31, 2026), Polymarket US charges every taker trade placed through the API Θ = 0.0695 at any volume and rebates 70% of those fees on straight trades (fee docs). The tiers still apply to trades placed in the app. The prompts below now default to 0.0695 for API orders; the Nov 13 output is unchanged.
Update, Nov 27, 2026: Polymarket US raised its app and website taker tiers at 9:45 PM ET on Wednesday, Nov 25, 2026: Θ is now 0.11 under $10,000 of trailing 30-day taker volume, 0.10 to $50,000, 0.09 to $250,000 and 0.0695 above (it was 0.095, 0.085, 0.075 and 0.0695) (fee docs). The API rate is unchanged: 0.0695 at any volume with 70% rebated, through Dec 31, 2026. The prompts below use the new tiers. The Nov 13 finding above is unchanged and used the old 0.095 tier; at 0.11, 8 contracts at $0.31 in the app would pay $0.19.
What a cycle looks like now, at 9:06 AM ET on Nov 13 (rebuilt from the prompt below, 14 tests pass):
note: external-api.kalshi.com returned 403; using api.elections.kalshi.com
2026-11-13 09:06 local std climate day 2026-11-13 observed max so far: Kalshi index 74.84, KMIA 75.2 (ASOS 5-min values are whole °C)
kalshi: 0 of 6 markets on a date that hasn't started (only today's markets are listed on kalshi right now)
pmus: 12 of 18 markets on a date that hasn't started
kalshi KXHIGHMIA-26NOV13-B82.5 (82, 83) The Weat ya=0.52 na=0.49 fc=82 p=None mid=0.515 SKIP same day
pmus high-2026-11-15-gte79lt80f (79, 80) NWS CLI ya=0.59 na=0.79 fc=79 p=None mid=None SKIP wide spread 0.38
pmus high-2026-11-14-gte72lt73f (72, 73) NWS CLI ya=0.59 na=0.74 fc=72 p=None mid=None SKIP wide spread 0.33
That morning the honest answer was "nothing to trade". In a drill where Kalshi answered every call with 429 and Retry-After: 5, it now waits the 5 seconds twice, logs one line and carries on with Polymarket US:
retry: HTTP 429, waiting 5s
retry: HTTP 429, waiting 5s
error: Kalshi: HTTP 429 after 3 tries: '{"error":{"code":"too_many_requests","message":"too many requests"}}'
kalshi: 0 of 0 markets on a date that hasn't started
Built this before Nov 13? Paste this follow-up into the same project:
Update the weather bot with these fixes. Stay in paper mode; no real
orders.
1. Polymarket US fees (docs.polymarket.us/fees): from Nov 21 to Dec 31,
2026, taker trades placed through the API pay coefficient 0.0695 at
any volume, and Polymarket rebates 70% of those fees (log the rebate
separately; don't net it at the fill). App trades are tiered: 0.11
below $10k of trailing 30-day taker volume, 0.10 to $50k, 0.09 to
$250k, 0.0695 above. Set pmus_taker_coef in config.toml, default
0.0695 (API). Each market also returns feeCoefficient (the app base
tier); log it and warn if it differs from my config.
2. One HTTP helper for Kalshi, Polymarket US and NWS: timeout 10 s,
retry up to 2 times on 429, 5xx, timeouts and dropped connections,
wait Retry-After when sent (cap 30 s) else 1 then 2 s. A non-JSON
body is a one-line error with the status and the first 80 characters.
A failed book or market call skips that market only, not the venue.
3. Check config.toml and limits.json at startup, before any network
call: every key present with the right type. Otherwise print
"config problem: <key>" and exit 2.
4. settle.py, Polymarket US: a market is settled only when
outcomePrices is exactly ["1","0"] or ["0","1"]. Closed with
["0","0"] means not resolved yet, so leave it open. On open markets
outcomePrices holds bid/ask prices, never a result.
5. Add max_spread = 0.10 to config.toml. If yes_ask + no_ask - 1 is
wider than that, SKIP "wide spread": no trade, and the mid is not
used as the market's probability.
6. Each cycle, print how many markets per venue are on a date that
hasn't started yet. If a venue has none (Kalshi often lists only
today's markets in the morning), say so in one line.
7. Tests for each of the above.
What we found on Oct 25 (fixed since): the default Kalshi host answered 403 and crashed the whole cycle; at 3:15 PM ET the bot paper-bought "below 81° today" at $0.01 while the index had already hit 80.96° and 81–82° was bid at $0.99; it logged the last index reading instead of the day's high so far; it re-bought markets it already held; Kalshi fills ignored book size; and nothing charged fees or compared our Brier score with the market's. The placeholder model is still a normal curve around the NWS forecast, and it's too wide: on Oct 26 it gave 12% to "87° or above" where both venues priced about 2%. On Oct 24 both venues settled Miami at 84° even though they name different sources. Built this before Oct 25? Paste this first, then the Nov 13 one above:
Update the weather bot with these fixes. Stay in paper mode; no real
orders.
1. Kalshi host: if external-api.kalshi.com answers 403, retry once on
https://api.elections.kalshi.com/trade-api/v2 and print a one-line
note. KALSHI_BASE_URL still overrides both.
2. Wrap every data call. One failing source (Kalshi, Polymarket US or
NWS) logs an error and is skipped; the rest of the cycle still runs.
Exit non-zero at the end if anything failed.
3. Add trade_same_day = false to config.toml. Skip any market whose
date is today or earlier in the station's local standard time and
log it as SKIP "same day".
4. Pick the forecast high for a date as the daytime NWS period whose
startTime date matches. No match = no forecast = skip.
5. Replace "latest observed index value" with the running max since
local standard midnight, from the Kalshi index and from
/stations/{station}/observations. Note that ASOS 5-minute values are
whole °C.
6. One paper position per market: if the ledger already holds it, HOLD.
Rank each cycle's signals by edge before spending the daily cap and
log every signal the cap blocked.
7. Kalshi paper fills: use GET /markets/{ticker}/orderbook (bids only;
YES asks = 1 - NO bids) and fill whole contracts limited by size, the
same as Polymarket US.
8. Taker fees in the ledger, from config: Kalshi 0.07 x C x P x (1-P)
rounded up to the cent, Polymarket US pmus_taker_coef x C x p x (1-p)
to the nearest cent (check both fee pages; they change).
9. Store each market's settlement source parsed from the rules text, and
the market's mid price at entry.
10. settle.py: fetch results automatically (Kalshi finalized/settled +
result, Polymarket US closed + outcomePrices), report PnL after fees,
my Brier score and the market's Brier score on the same decisions,
and say plainly when mine is not lower.
11. Tests for each of the above.
What prompt do you paste into your AI coding tool?
Works in Claude Code, Cursor, Codex/ChatGPT, Grok or any agent that can write files. Paste it into an empty folder. Read what it builds before you run anything.
Build a PAPER-MODE weather market tracker/bot in Python for one city.
Use only documented endpoints; ask me if unsure. No real orders, ever.
config.toml: city id, Kalshi series_ticker (e.g. KXHIGHMIA), Polymarket
US search query, settlement station lat/lon, NWS User-Agent (app name +
email), sigma, margin, order size, trade_same_day = false,
max_spread = 0.10, kalshi_taker_coef = 0.07, pmus_taker_coef = 0.0695.
Check config.toml and limits.json at startup, before any network call:
every key present with the right type, else print "config problem:
<key>" and exit 2.
Data sources (one module, one function per call; every call can fail on
its own without killing the cycle: log the error, skip that source,
carry on, and exit non-zero at the end if anything failed). Use one HTTP
helper for all three: timeout 10 s, retry up to 2 times on 429, 5xx,
timeouts and dropped connections, waiting Retry-After when sent (cap
30 s) else 1 then 2 s. A non-JSON body is a one-line error with the
status and the first 80 characters. A failed book or market call skips
that market only, not the whole venue:
- Kalshi (public): base https://external-api.kalshi.com/trade-api/v2. If
it answers 403, retry once on the documented also-supported host
https://api.elections.kalshi.com/trade-api/v2 and print a one-line
note. KALSHI_BASE_URL overrides both.
GET /markets?series_ticker=...&status=open, GET /markets/{ticker}
(rules_primary, yes_bid/ask_dollars, no_bid/ask_dollars,
yes_ask_size_fp, result, expiration_value),
GET /markets/{ticker}/orderbook (bids only: YES ask = 1 - best NO bid,
NO ask = 1 - best YES bid; sizes are on the opposite side),
GET /live_data/weather/{city}?last_sec=N (Kalshi weather index, °F).
- Polymarket US (public): GET https://gateway.polymarket.us/v1/search
?query=<city> temperature, GET /v1/market/slug/{slug} (description has
the range; closed + outcomePrices once settled), GET
/v1/markets/{slug}/book (offers = YES asks with qty; NO ask = 1 - best
bid, size from the bid), and
GET /v1/events/slug/{event-slug} for a past day's event. Pace about 3
requests a second. Each market also returns feeCoefficient.
- NWS: https://api.weather.gov with the User-Agent header. /points/
{lat},{lon} -> properties.forecast. Pick the forecast high for a market
date as the DAYTIME period whose startTime date equals that date; never
just the first period (after 6 PM it is "Tonight", a low). No match =
no forecast = skip. Also GET /stations/{station}/observations?start=
<local midnight> for today's observed temperatures.
Logic:
- For each market store: id, venue, market date, range parsed from the
text (whole degrees, both ends included: ">86°" = 87 or above, "<79°" =
78 or below, "83-84°" = 83 to 84, "between 79F and 80F" = 79 to 80,
"less than or equal to 78F", "greater than or equal to 87F"). Kalshi
titles often have no F after the degree sign. Cross-check Kalshi against
strike_type / floor_strike / cap_strike; for Polymarket US read the
description, not the slug. Bucket edges change from day to day, so
parse every day. Any disagreement = "needs review", never traded.
Each cycle, print how many markets per venue are on a date that hasn't
started yet; if a venue has none (Kalshi often lists only today's
markets in the morning), say so in one line.
Write a parse test per format.
- Store each venue's settlement source from the rules text (Kalshi
rules_primary, Polymarket US description). They can differ for the
same city, so never treat a Kalshi and a Polymarket US bucket as the
same bet.
- Same-day markets: by default do not trade a market whose day has
already started in the station's local time. A morning forecast says
nothing about a high that has already happened. Log them as SKIP
"same day". Log the running max of the Kalshi index and of the NWS
observations for today as "observed max so far" (not the latest
reading), with a note that ASOS 5-minute values are whole °C.
- strategy.py: MY placeholder rule. P(bucket) from a normal around the
forecast high with my sigma, then buy the side whose ask is below my
probability by more than the margin. Keep it explainable. Also log the
market's own implied probability (mid) next to mine. If yes_ask +
no_ask - 1 is wider than max_spread, SKIP "wide spread": no trade and
no mid (a 59c/99c book is not a price).
- risk.py: limits.json + KILL file, same as the BotCookery Safety Pack.
One paper position per market: if I already hold it, HOLD. Rank the
cycle's signals by edge before spending the daily cap, and log every
signal the cap blocked.
- Paper execution: local ledger for both venues, filled at the ask and
limited by displayed size (Kalshi orderbook, Polymarket US offers).
Kalshi demo orders (https://external-api.demo.kalshi.co/trade-api/v2,
demo keys from env) are optional and off by default.
- settle.py: after settlement, fetch each market's result (Kalshi
status finalized/settled + result; Polymarket US only when
outcomePrices is exactly ["1","0"] or ["0","1"]: closed with ["0","0"]
is not resolved yet, and on open markets outcomePrices holds bid/ask
prices) or take one I enter by hand, then report paper PnL after
taker fees (Kalshi 0.07 x C x P x (1-P) rounded up to the cent;
Polymarket US theta x C x p x (1-p), banker's rounding to the cent,
where theta is 0.0695 for taker trades placed through the API from
Nov 21 to Dec 31, 2026 at any volume, with 70% of those fees rebated by
Polymarket (report it separately); in the app theta is tiered by MY
trailing 30-day taker volume: 0.11 under $10k, 0.10 to $50k, 0.09
to $250k, 0.0695 above; default 0.0695 (API); log each market's
feeCoefficient and warn if it differs from config; check both fee
pages, they change), my
Brier score AND the market's Brier score at entry (mid price) on the
same decisions. If mine is not lower, say so plainly.
- Log everything to logs/ (JSON lines). Tests for parsing, forecast
period choice, same-day skip, one-position-per-market, fills limited
by size, scoring, config check, HTTP retries, wide-spread skip and
unresolved Polymarket US results.
Show the plan first.
How do you build it, step by step?
Pick one city that both venues list (check Polymarket US's Weather FAQ table and Kalshi's markets). Note each venue's settlement source for it.
Read the rules. For each market, read rules_primary (Kalshi) and the market description (Polymarket US). Write down the station, the report, the time window and how ties are handled.
Paste the prompt in a fresh folder with the Safety Pack. Set your NWS User-Agent (app name + email) in config.
Check the parser against the live markets, not just the tests: print each market's text next to the parsed range. The bot must correctly read each market's threshold. Kalshi titles look like Will the maximum temperature be >67° on Oct 19, 2026?, often with no F after the degree sign, so make sure there's a test for that form. >86° means 87° or above. Polymarket US slugs such as gte79lt80f cover 79 to 80, so read the description instead. Anything it isn't sure about is "needs review" and never traded, even on paper.
Run daily for 2–4 weeks in paper mode, a few times a day. Leave trade_same_day = false: once a day has started, the high is partly in and a forecast can't compete with the people watching the station. Run settle.py each morning after settlement (8:00 AM ET, sometimes 11:00 AM ET on Polymarket US). A Polymarket US market can be closed for a while before it resolves; settle.py leaves those open.
Compare your Brier score with the market's. settle.py prints both on the same decisions, plus paper PnL after fees. If yours isn't lower, you have your answer, whatever the PnL says over a few trades.
How do you test it in paper or demo mode first?
Both venues: a local paper ledger, filled at the asks and limited by displayed size, skipping books wider than max_spread (Kalshi's order book is bids only, so its asks are 1 minus the other side's bids), with each venue's taker fee charged.
Kalshi demo (optional, off by default): mock funds, separate keys. Weather markets on demo may not mirror production prices, so score your estimates against real outcomes rather than trusting demo PnL.
Scoring: log every probability you estimate and compute a Brier score against outcomes. That's the honest test of whether the model behind your rule is any good.
What safety checks does it need before real money?
Tick every box before the bot touches real money. The full rules file, .gitignore and pre-commit hook are in the Safety Pack.
Key handling: API keys and private-key files live in environment variables or a secrets manager. Never in code, prompts, chat logs, screenshots or git. .env and *.pem are in .gitignore, and your AI tool is blocked from reading them (see the Safety Pack).
Position limits: hard caps in config (max contracts per order, max total exposure, max daily loss). The bot refuses any order above them, and the caps are checked in code, not just in the prompt.
Kill switch: one command or one file (touch KILL) stops new orders immediately, and a second command cancels every resting order through the venue's cancel-all endpoint.
Paper first: paper or demo mode is the default. Live trading needs an explicit --live flag and a typed confirmation, and you only flip it after days of clean paper logs.
Never trade a market whose threshold or settlement source your code couldn't parse with confidence.
Send a proper User-Agent to api.weather.gov and keep polling modest; it's a free public service.
Weather markets resolve on specific stations and reports. A city-wide forecast isn't the same thing as the settlement station's reading.
Don't trade a day that has already started. In our first build, the bot paper-bought "below 81°" at 3:15 PM on a day the index had already hit 80.96° and the market had 81–82° at 99¢.
One position per market, a daily cap and a KILL file. Without the position check, the same signals fire every cycle.
Endpoints and rules were checked against these pages on Nov 27, 2026. APIs change, so if something here disagrees with the official docs, trust the docs and tell us.
Frequently asked questions
How are Polymarket US weather markets settled?
According to Polymarket US's Weather FAQ, temperature contracts settle on the official NWS Daily Climate Report (CLI) from the local Weather Forecast Office, for a named station (for example KNYC Central Park for New York City). Settlement happens at 8:00 AM ET the next day, possibly delayed to 11:00 AM ET for review.
Does Kalshi have a weather API?
Kalshi's API includes a weather index endpoint, GET /live_data/weather/{city}, that returns the minute-resolution temperature index behind its hourly temperature markets, in Fahrenheit. Check each market's rules for its exact settlement source.
Do Kalshi and Polymarket US settle a city on the same source?
Not necessarily. On Oct 22, 2026, Kalshi's Miami daily-high markets named The Weather Company (CLIMIA) in their rules, while Polymarket US's Miami high markets named the NWS Climatological Report for Miami International Airport (KMIA). Read both rules before comparing prices across venues.
Why does the bot skip today's markets?
By the afternoon most of the day's high has already been recorded, and the market prices that in from live station data. A forecast issued that morning knows less than the market does. In our Oct 25 test the old build bought "below 81°" at 1¢ at 3:15 PM, while the same market had 81–82° bid at 99¢. Keep trade_same_day = false unless you add a real intraday model.
Is a weather bot profitable?
We don't know, and nobody can promise it. Forecasts are public, so markets often price them in. A paper-mode bot with honest scoring is how you find out for yourself without risking money.
Get new recipes by email
When we publish a new bot recipe, we'll send it to you. Free. No picks, no signals, ever.
Build a read-only Kalshi API client and CLI with an AI coding tool: live markets, order books with implied asks and spreads, recent trades, a multi-cycle watch command, and correctly signed RSA-PSS or Ed25519 requests. Rebuilt and run against live data on Nov 4, 2026.
A copy-paste AI prompt and step-by-step guide to the Polymarket US API: public market data with no key, then authenticated reads. Includes the international Gamma API, read-only, with a geoblock check.
Build a personal Telegram bot that pings you when a Polymarket US market crosses your price levels or moves fast. Public data only, no API key, no trading, no wallet.
Step-by-step: use Claude Code to build a Polymarket US trading bot that runs in paper mode by default, with a local paper ledger, order preview, hard position limits and a kill switch.