Trade prediction markets from your terminal.
An AI agent that researches every Kalshi market, finds edge against the live order book, and executes trades — all behind a single CLI. Half-Kelly sizing. Five-gate risk engine. Diversified basket construction in one call.
bunx kalshi-trading-bot-cli@latest A research analyst, risk manager, and order router — in one binary.
AI agent loop
Natural-language queries trigger up to 10 tool-use iterations across Kalshi and Octagon endpoints. Bring your own LLM key — OpenAI, Anthropic, Google, xAI, OpenRouter, or local Ollama.
Edge detection
Octagon's model probability minus the live order book = edge. Surfaced per market, ranked across the universe, and sized with half-Kelly behind five risk gates before a dollar is risked.
Diversified baskets
One-call basket construction with thematic-cluster caps and pairwise correlation caps. Backtest a theme, Kelly-size it, validate cluster overlap — all server-side.
From "I have an idea" to a filled order in four lines.
Discover
Server-side full-text + semantic search across the Kalshi universe.
> search "bitcoin price" --category crypto --min-volume 10000 Ticker Title Last Volume
KXBTC-26APR-B95000 Bitcoin above $95k by Apr 30 $0.58 12,841
KXBTC-26APR-B100000 Bitcoin above $100k by Apr 30 $0.31 8,203
KXETH-26APR-B2000 Ethereum above $2k by Apr 30 $0.72 5,419
3 markets found Analyze
Per-event research report with model probability, drivers, and Kelly sizing.
> analyze KXBTC-26APR-B95000 Octagon Research Report — KXBTC-26APR-B95000
────────────────────────────────────────
Model Probability 72%
Market Price 58%
Edge +14.0% (very_high confidence)
Top Drivers
1. Bitcoin ETF inflows accelerating impact: high
2. Halving cycle momentum impact: high
3. Macro risk-on sentiment impact: moderate
Kelly Sizing: 3 contracts YES at $0.58
Risk gates: ✓ Kelly ✓ Liquidity ✓ Corr ✓ Concentration ✓ Drawdown Build a diversified basket
One call: candidate universe → cluster caps → correlation caps → Kelly sizing.
> basket build --label fed,cpi,fomc,gdp,jobs -n 5 --max-corr 0.4 Basket built · 5 legs · max pairwise corr 0.32
────────────────────────────────────────
KXFEDDECISION-MAR YES $0.61 Kelly $122 cluster: fed-policy
KXCPIYOY-FEB NO $0.44 Kelly $98 cluster: inflation
KXFOMC-DOTS-25Q4 YES $0.55 Kelly $87 cluster: fed-policy
KXU3-MAR NO $0.39 Kelly $76 cluster: labor
KXGDPNOW-Q1 YES $0.52 Kelly $64 cluster: growth
Total exposure: $447 · expected return: +18.6% Execute
Confirm with one keystroke. Limit price in cents, side defaults to YES.
> buy KXBTC-26APR-B95000 3 58 Confirm order? [y/n] y
✓ Order placed: BUY 3 YES @ $0.58
Order ID: abc-123-def
Cash: $487.26 · Exposure: $1.74 · Open positions: 1 A thin terminal in front of a deep intelligence pipeline.
Which command hits which endpoint
search · search edge → /kalshi/markets · /markets-with-edge similar · peers → /kalshi/markets/similar · /cluster-peers clusters → /kalshi/clusters · /behavioral-clusters correlate → /kalshi/markets/correlations basket build · size · backtest → /kalshi/baskets/* (5 endpoints) events · analyze → /prediction-markets/events No clone. No install. Just bunx.
Install Bun
Bun ≥ 1.1 is required — the CLI uses bun:sqlite and runs .tsx directly.
curl -fsSL https://bun.com/install | bash Get a Kalshi API key
From kalshi.com — you'll need an API key plus an RSA private key. Use demo mode for paper trading.
Optional: Octagon key
An Octagon key unlocks AI edge analysis, semantic search, clusters, and basket construction.
Run the CLI
The setup wizard handles the rest — keys land in ~/.kalshi-bot/.env.
bunx kalshi-trading-bot-cli@latest Full command reference Click to expand · 40+ slash commands
Discovery
search [query] | Full-text or semantic search across markets |
search edge | Rank markets by model edge from Octagon's latest run |
similar <ticker|"text"> | Semantic neighbors via embeddings |
clusters [--label X] | Browse thematic K-means clusters |
clusters --behavioral | Behavioral clusters by 30-day return vectors |
peers <ticker> | Markets in the same cluster as a ticker |
events / events <ticker> | Octagon events list + outcome ladder |
catalysts upcoming --days N | Markets closing in the next N days, grouped by week |
Baskets & portfolio
correlate <t1> <t2> … | Pairwise Pearson correlation matrix |
basket build | Diversified basket with cluster + correlation caps |
basket size | Fractional Kelly sizing for picked legs |
basket backtest | Total return / Sharpe / max DD on a basket |
basket validate | Cluster overlap · pairwise corr · calendar clashes |
themes report | 25-theme dashboard with SEO + liquidity |
themes audit | Flag dead themes (high SEO, zero volume) |
Trading & account
analyze <ticker> | Deep analysis: edge, drivers, Kelly sizing |
watch <ticker> | Live price and orderbook feed |
buy / sell <ticker> <n> [price] | Place a confirmed order in cents |
cancel <order_id> | Cancel a resting order |
portfolio | Positions, P&L, risk snapshot |
backtest | Model accuracy scorecard + live edge scanner |
setup / init / clear-cache | Wizard, fresh install, cache reset |
Try it now — zero install
No clone, no setup. The wizard prompts you for keys on first launch and writes them locally to ~/.kalshi-bot/.env.
bunx kalshi-trading-bot-cli@latest Or wire the API into your own stack
Our CLI runs entirely on the public Octagon REST API. 21 typed endpoints — search, clusters, correlations, baskets, edge. Bring your own runtime.