Quick Overview
In this build-along demonstration, creator All About AI speedruns the creation of an algorithmic trading bot for Kalshi prediction markets using OpenAI Codex. The video explores how quickly quantitative research skills and LLM coding assistants can move from raw market data ingestion to live, automated execution.
Key Points
- 1.OpenAI Codex running GPT-5.6 was used alongside custom quantitative skills to research, backtest, and deploy a trading algorithm on Kalshi prediction markets in a single session.
- 2.Evaluating five market hypotheses on Kalshi 15-minute Bitcoin contracts identified volatility persistence as the only viable candidate for live testing.
- 3.The resulting strategy requires an absolute price move of at least 15.3975 basis points in the preceding fifteen-minute contract before taking a five-dollar position at minute six based on the minute-five midpoint price.
- 4.Execution code was built to interface directly with Kalshi WebSocket feeds rather than relying on REST API polling.
- 5.Over an overnight live test run, the bot achieved fourteen wins and four losses across eighteen filled trades, delivering an equity gain with a maximum realized drawdown of $12.73.
Summary
The video documents a speedrun experiment designed to test how quickly an automated trading bot can be built and deployed on Kalshi prediction markets using OpenAI Codex running GPT-5.6. Starting from an empty environment, the presenter sets up historical market data for Kalshi 15-minute Bitcoin contracts by feeding documentation endpoints directly into the Codex CLI environment.
To identify a viable edge, Codex uses a pre-configured quantitative hypothesis research skill. This workflow inspects historical contract definition endpoints, verifies timestamps, and formulates testable market hypotheses. Five specific hypotheses are evaluated: volatility persistence, weekend volatility, outcome alternation, minute-five under-dispersion, and activity cycles. Backtesting rejects outcome alternation and minute-five under-dispersion. Volatility persistence, designated as hypothesis H-001, demonstrates positive out-of-sample forecast improvements across multiple volatility thresholds, producing an estimated frequency of roughly thirty-two trade setups per day when restricted to the top third volatility filter.
Codex is then tasked with writing production execution code based on the validated volatility persistence specification. The logic requires checking the immediately preceding fifteen-minute Bitcoin contract to ensure an absolute BRTI move of at least 15.3975 basis points, or approximately 0.154 percent. If this condition passes, the algorithm evaluates the contract's YES midpoint price at minute five, choosing YES if the price is above fifty cents, NO if below fifty cents, or skipping if exactly fifty cents. After a one-minute delay, at minute six, the bot dispatches a five-dollar fill-or-kill order using Kalshi WebSocket market data rather than REST API polling.
The algorithm is deployed into a live testing environment using credentials tied to a funded Kalshi balance of approximately $125. The presenter confirms that WebSocket lifecycle messaging and order-state databases are operating cleanly before leaving the system active overnight.
The following morning, performance logs reveal eighteen completed trades consisting of fourteen wins and four losses. The final strategy profit and loss reached $15.44 with an account balance rising to $137.11, representing a 15.73 percent gain over the twenty-four hour window. Analysis of trade history indicates a maximum realized drawdown of $12.73 after trade five before recovering into positive equity.
Formulating and Backtesting Kalshi Hypotheses
Using Codex with custom quantitative research skill markdown files, historical data from Kalshi 15-minute Bitcoin contracts was ingested and audited. Five distinct hypotheses were generated and backtested: volatility persistence, weekend volatility, outcome alternation, minute-five under-dispersion, and activity cycles. While outcome alternation and minute-five under-dispersion were rejected outright, volatility persistence delivered out-of-sample forecast improvements and became the primary candidate for an automated strategy.
Strategy Architecture and Code Generation
The chosen strategy filters for the top third of historical volatility by checking if the preceding fifteen-minute contract moved at least 15.3975 basis points. When qualifying conditions are met, the bot reads the current contract's midpoint price at minute five, selecting YES if the price exceeds fifty cents or NO if it falls below fifty cents. At minute six, it submits a five-dollar fill-or-kill order over a fresh WebSocket connection rather than polling the REST API.
Overnight Deployment and Live Trading Results
The bot was deployed live with roughly $125 in starting account capital and left running overnight. By the next morning, the strategy executed eighteen trades, finishing with fourteen wins and four losses for a net strategy profit of $15.44 and an account total of $137.11. The largest realized drawdown during the trading window was $12.73.
The Bottom Line
The video establishes that an AI coding agent combined with structured quantitative skills can rapidly evaluate historical market data, produce backtested strategies, and deploy live execution bots on prediction markets. While the eighteen-trade sample achieved a strong win rate and positive return, the presenter emphasizes that overnight results do not prove long-term profitability. The session concludes by demonstrating working WebSocket execution on Kalshi and outlining plans to explore cross-platform arbitrage between Kalshi and Polymarket in subsequent tests.
FAQ
What is Kalshi and how does the AI trading bot speedrunning experiment use it?
Kalshi is a regulated prediction market exchange where participants trade event contracts, such as fifteen-minute Bitcoin price intervals. In this experiment, Codex uses Kalshi historical data and WebSocket API endpoints to autonomously research, code, and execute a directional trading strategy on these contracts.
Which OpenAI Codex model was used to write the Kalshi trading bot code?
The project used OpenAI Codex running GPT-5.6-sol set to high reasoning effort.
What specific volatility filter must be met before the bot executes a trade on Kalshi?
The preceding fifteen-minute Bitcoin contract must experience an absolute move of at least 15.3975 basis points, roughly 0.154 percent, placing it in the top third of historical volatility.
How does the trading bot determine whether to buy YES or NO contracts at minute five?
At the five-minute mark of an active contract, the bot checks the YES midpoint price. It chooses YES if the price is above fifty cents, chooses NO if the price is below fifty cents, and skips the trade if the price is exactly fifty cents.
What live trading results were achieved after running the bot overnight on Kalshi?
The bot completed eighteen filled trades, achieving fourteen wins and four losses, generating a net strategy profit of $15.44 with a maximum drawdown of $12.73.
Worth watching for
Quantitative traders, algorithmic trading developers, and AI enthusiasts interested in using autonomous coding agents to build and backtest event-contract trading strategies.
- kalshi
- algorithmic-trading
- openai-codex
- prediction-markets
- bitcoin-trading
- trading-bot