Prediction Markets CLI · Powered by Octagon

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
21 Octagon endpoints wired in
5 Risk gates before each fill
1 Command to build a basket
What it does

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.

Live commands

From "I have an idea" to a filled order in four lines.

01

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
02

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
03

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%
04

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
How it connects

A thin terminal in front of a deep intelligence pipeline.

You
Your terminal
Bun runtime · macOS, Linux, WSL
CLI
kalshi-trading-bot-cli
AI agent loop · slash commands
Octagon
Octagon Research API
21 typed endpoints · model probabilities
Exchange
Kalshi
Order entry · positions · fills

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
Setup in 60 seconds

No clone. No install. Just bunx.

01

Install Bun

Bun ≥ 1.1 is required — the CLI uses bun:sqlite and runs .tsx directly.

curl -fsSL https://bun.com/install | bash
02

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.

03

Optional: Octagon key

An Octagon key unlocks AI edge analysis, semantic search, clusters, and basket construction.

04

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 edgeRank 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 --behavioralBehavioral 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 NMarkets closing in the next N days, grouped by week

Baskets & portfolio

correlate <t1> <t2> …Pairwise Pearson correlation matrix
basket buildDiversified basket with cluster + correlation caps
basket sizeFractional Kelly sizing for picked legs
basket backtestTotal return / Sharpe / max DD on a basket
basket validateCluster overlap · pairwise corr · calendar clashes
themes report25-theme dashboard with SEO + liquidity
themes auditFlag 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
portfolioPositions, P&L, risk snapshot
backtestModel accuracy scorecard + live edge scanner
setup / init / clear-cacheWizard, fresh install, cache reset
Install

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
Build your own

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.