← Protocols
Kalshi
Prediction Market·Multi-chain (USD-only off-chain)

Kalshi

01Description

CFTC-regulated event contract exchange in the US. Trades binary YES/NO contracts on macro, politics, weather, crypto and sports events with REST + websocket APIs and USD settlement (no crypto rails).

02Best for
  • 01US-compliant prediction market frontends
  • 02event-driven trading bots
  • 03macro/economic data dashboards
  • 04sports and politics odds widgets
  • 05market-making and arbitrage strategies
03Install
  • pip install kalshi-python
  • pnpm add kalshi-typescript-sdk
04Environment variables
VariableScopeDescription
KALSHI_API_KEY_IDServerAPI key ID from your Kalshi dashboard (used as the `KALSHI-ACCESS-KEY` header).
KALSHI_PRIVATE_KEYServerRSA private key (PEM) tied to the API key ID. Used to sign each request — server-only, never ship to the browser.
KALSHI_API_BASE_URLServerBase URL — `https://api.elections.kalshi.com/trade-api/v2` for production or `https://demo-api.kalshi.co/trade-api/v2` for the demo sandbox.
05Prompt snippet
Use Kalshi for regulated US prediction markets. Auth uses RSA-PSS request signing: send `KALSHI-ACCESS-KEY`, `KALSHI-ACCESS-TIMESTAMP` (ms), and `KALSHI-ACCESS-SIGNATURE` (base64 RSA-PSS-SHA256 over `timestamp + METHOD + path`) on every request. Discover markets with `GET /trade-api/v2/markets?status=open&limit=...` and `/events`, place orders via `POST /trade-api/v2/portfolio/orders` with `{ ticker, side: 'yes'|'no', action: 'buy'|'sell', count, type: 'limit', yes_price }` (prices in cents 1–99). Stream live data over the websocket at `wss://api.elections.kalshi.com/trade-api/ws/v2` with the same signed headers, then `subscribe` to channels like `orderbook_delta`, `ticker`, `trade`, and `fill`. Test against the demo sandbox first — it uses a different host and play-money keys.
06Gotchas
  • Kalshi is US-only and requires KYC — non-US users cannot fund or trade. If your app has a global audience you must geofence non-US visitors away from order entry, or whitelist a Kalshi-approved partner flow.
  • Auth is RSA request signing, not bearer tokens. Sign `timestamp + METHOD + path` with RSA-PSS-SHA256 (mgf1 SHA256, salt length = digest length) — HMAC or plain RSA-PKCS1 will silently 401.
  • Prices are integer cents 1–99 (not dollars or basis points). Crossing the book or off-by-one rounding errors are the #1 source of rejected orders.
  • Settlement is USD via ACH/wire only — there is no crypto deposit rail and no on-chain component. Don't promise users wallet-based onboarding.
  • Rate limits are tier-based (Basic / Pro / Premier) and apply per-endpoint; bulk discovery should hit `/markets` with `cursor` pagination and live data should ride the websocket, not polling.
  • Sports markets are gated to states where Kalshi has regulatory clearance. Always read `market.rules_primary` and `market.cap_strike` for resolution criteria — disputes go through CFTC processes, not onchain oracles.
07Alternatives