FIND YOUR EDGE
ON KALSHI —
WITH AI DOING
THE RESEARCH
A step-by-step playbook for trading prediction markets using Claude AI. Includes a real live trade, documented thesis, and a 5-step repeatable system.
Scan → Critique → Score → Execute → Manage. A repeatable system you run before every trade.
Real trade placed May 7, 2026. Full thesis documented. 38.9% ROI target. Every decision explained.
How to read Kalshi prices, calculate your edge, and know when the market is wrong.
Fixes the PEM key and environment errors that block most beginners before they even place a trade.
How much to bet. When to pass. Position sizing that keeps you in the game long-term.
The 5 most common errors new Kalshi traders make — and exactly how to avoid each one.
Kalshi CLI Setup on macOS
The docs don't cover paper trading setup. Here's what the playbook does — the exact errors, the exact fixes.
mkdir -p ~/.kalshi touch ~/.kalshi/.env chmod 700 ~/.kalshi # Add to ~/.zshrc: export KALSHI_ACCESS_KEY="your-uuid-here" export KALSHI_PRIVATE_KEY_PATH="/Users/you/.kalshi/private_key.pem" export KALSHI_ENVIRONMENT="demo"
Note:KALSHI_ACCESS_KEY must be the UUID — not the key's display name. They look similar. Only the UUID works.
Copy-pasting your private key from a browser on macOS corrupts it with hidden characters. The CLI throws:
ValueError: InvalidData(InvalidByte(4, 95))
Fix with OpenSSL:
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt \ -in ~/.kalshi/private_key.pem \ -out ~/.kalshi/private_key_fixed.pem mv ~/.kalshi/private_key_fixed.pem ~/.kalshi/private_key.pem chmod 600 ~/.kalshi/private_key.pem
Some CLI builds are hardcoded to production. Demo credentials return NOT_FOUND. Patch cli.py to read your env var:
import os
KALSHI_ENV = os.getenv("KALSHI_ENVIRONMENT", "prod").lower()
if KALSHI_ENV == "demo":
BASE_URL = "https://external-api.demo.kalshi.co"
else:
BASE_URL = "https://api.elections.kalshi.com"Add aliases to ~/.zshrc:
alias kalshi-demo='export KALSHI_ENVIRONMENT=demo && echo "→ DEMO"' alias kalshi-prod='export KALSHI_ENVIRONMENT=prod && echo "→ PRODUCTION"'
Windows users: install Python 3.9+, Git, and Node.js first. Then clone both repos and set env vars via PowerShell:
# Set credentials (PowerShell — run once)
[System.Environment]::SetEnvironmentVariable("KALSHI_ACCESS_KEY", "your-uuid", "User")
[System.Environment]::SetEnvironmentVariable("KALSHI_PRIVATE_KEY_PATH", "$HOME\.kalshi\private_key.pem", "User")
[System.Environment]::SetEnvironmentVariable("KALSHI_ENVIRONMENT", "demo", "User")
# Clone the CLI and plugin
git clone https://github.com/austron24/kalshi-cli
git clone https://github.com/austron24/kalshi-trader-plugin
# Install dependencies
cd kalshi-cli && pip install -r requirements.txt
cd ../kalshi-trader-plugin && claude mcp install .InvalidByte on Windows? Install OpenSSL from slproweb.com and run the same PKCS8 conversion — same error, same fix, different shell syntax. Full Windows appendix inside the playbook.