# "Building a GPT-6 Kalshi AI Trading Bot From Scratch (full guide)"
<!--
ref: @content/youtube/all-about-ai/building-a-gpt-6-kalshi-ai-trading-bot-from-scratch-full-guide
tags: [prediction markets, Kalshi, trading bots, GPT-6 Astra, Codex, weather forecasting, backtesting, AWS VPS]
version: 2
updated_at: 2026-11-22T12:57:25.531Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=-tMyq-wQZBU)**

# Building a GPT-6 Kalshi AI Trading Bot From Scratch (full guide)

*Synthesized from All About AI, 2026-09-08; speakers are not named in the source.*

A single presenter walks through building, testing and deploying a bot for Kalshi's New York daily-high-temperature markets using GPT-6 Astra inside Codex and Google DeepMind's Weather Next 3 forecasts. The transcript is a rough machine translation, so some product names are garbled.

## Core Thesis
The presenter argues that a current frontier model driving a coding agent is enough to stand up a data-driven trading bot end to end: wire in a forecast source, backtest it honestly against historical market data, encode a strict entry rule, then deploy it to a cheap always-on server. He is explicit that the demo is a tutorial on the workflow, not proof the model has an edge.

## Key Insights
- **Target market.** Kalshi's "highest temperature in New York" event, which opens a fresh set of temperature-range baskets daily. The new event was expected to open at 4:00 PM Oslo time on September 9th, and the aim is to buy the predicted range at a good price right after opening.
- **Setup.** A new project directory, then Codex launched in YOLO mode with GPT-6 Astra at high reasoning. Claude Code is mentioned as an alternative.
- **Data access.** Weather Next 3 is requested through an open data request form (the page says up to 7 days; he got access in about a day or two). It is served through BigQuery and Earth Engine, so the BigQuery API and Earth Engine API are enabled in Google Cloud, an OAuth 2.0 client is created, and authentication runs through the Google CLI.
- **Settlement station matters.** He has the agent confirm which station Kalshi uses to resolve the contract (Central Park in Manhattan, not an airport such as Kennedy), because stations can differ by several degrees. He also pastes the market rules into the agent.
- **Kalshi credentials.** An API key plus a downloadable private key are generated in the account settings and stored in a `.env` file; a balance call (the account held $100) verifies they work before any trading logic is built.
- **Backtest prompt.** His standard request asks the model to act as a rigorous quantitative researcher: build a reproducible backtest of Weather Next 3 forecasts against historical Kalshi temperature events, check whether the forecast adds information beyond market prices, and survive realistic fee and execution assumptions. It must verify the target, use point-in-time data, evaluate separate forecast horizons and avoid data leakage.
- **Backtest result.** It took about 40 minutes. Entering one minute after the open looked best, scoring 64 against 74 for the market baseline (lower is better, about 13% better); he also compared 2, 5, 10, 15 and 30 minutes. The agent itself said the sample was too small to establish an edge. A Miami version of the test was weaker than New York.
- **Entry rule.** Freeze the model's probabilities about 15 minutes before the decision time (3:46 PM, decision at 4:01 PM), require enough liquidity to avoid slippage, and only enter if a contract shows at least a 5 cent advantage after fees and a safety buffer. Worked example: a cautious 65% win probability at 50 cents, 2 cents commission and a 1 cent buffer leaves 12 cents of advantage. The bot starts in demo mode.
- **Deployment.** An AWS EC2 T3 micro in the US East 2 (Ohio) region, provisioned by the agent from CLI credentials in the `.env` file. He notes the instance costs roughly $16 per month, which belongs in any profit calculation along with fees.
- **Live outcome.** The frozen forecast gave about 67% to the "83 or below" range and about 30% to 84-85. The bot did not trade because a stress test replaced the 67% estimate with 37%, derived from a scenario one degree Fahrenheit warmer. He placed a manual "yes" at about 51 cents for $17 to test it and flagged the stress-test logic as a bug to fix. A prior-day manual test was bought near 56 and sat at 63 cents, about 12% up.
- **Portfolio mindset.** He runs several automated bots on VPS machines, checks them about once a day, turns off the ones that stop working, and says some lose money.

## Actionable Takeaways
1. Confirm exactly how the market settles (station, rules text) before modelling, and give the rules to the agent.
2. Run a leakage-aware backtest across several entry delays before building any execution code.
3. Freeze model probabilities shortly before the decision time and require a minimum net edge, 5 cents in his example, after commission and a buffer.
4. Keep the bot in demo mode until local and server tests pass, then switch to live.
5. Price the server (about $16 per month for a T3 micro) and fees into the expected return.
6. Treat an agent's own statement that the sample is too small as a stop sign, not a formality.

## Notable Quotes
> "Of course, you need to put some thought into the ideas you want to implement." — All About AI

> "Does this mean that our model is correct? No, not at all." — All About AI

---

*Related: `@content/youtube/david-ondrej/tailscale-clearly-explained-beginners-guide` · `@content/youtube/every-inc/we-tested-claude-opus-5-its-frustrating-with-flashes-of-brilliance` · `@content/youtube/cole-medin/omnigent-the-new-meta-harness-for-every-coding-agent-claude-code-codex-pi-more` · `@content/youtube/nate-herk/i-gave-gpt-6-astra-10-000-to-trade-stocks-and-this-happened` · `@content/youtube/every-inc/why-opus-4-8-pulled-me-back-to-claude`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*