Skip to main content
Kalshi is a CFTC-regulated US event-contract exchange. OpenPX talks to its REST API (api.elections.kalshi.com) and authenticated WebSocket.

Config fields

Pass these in the second argument of Exchange.new:
FieldTypeRequiredDescription
api_key_idstringfor authAPI key identifier from your Kalshi account
private_key_pemstringfor authRSA private key contents (PEM)
private_key_pathstringalt. to PEMFilesystem path to a .pem file
api_urlstringoptionalOverride the API base URL
demobooloptionalUse the demo environment
verbosebooloptionalVerbose logging
Public read-only methods (markets, orderbooks, trades) work without credentials. Orders, balances, and WebSocket require auth.

Environment variables

The CLI and recorder read these by default:
  • KALSHI_API_KEY_ID
  • KALSHI_PRIVATE_KEY_PEM or KALSHI_PRIVATE_KEY_PATH

Identifiers

  • Market.id is the Kalshi ticker, e.g. KXBTC-25MAR14-T20000.
  • WebSocket subscribe target is the same ticker.
  • Outcomes are "Yes" / "No" for binary markets.

Capabilities

MethodAvailable
fetch_markets / fetch_marketYes
fetch_orderbookYes
fetch_tradesYes
fetch_price_historyYes
create_order / cancel_order / fetch_open_ordersAuth
fetch_positions / fetch_balance / fetch_fillsAuth
WebSocketAuth
Inspect ex.describe() at runtime for the source of truth.

Rate limits

Defined in the manifest at engine/core/src/exchange/manifests/kalshi.rs:
  • Default: 20 req/sec, burst 5
  • Write endpoints (orders): 10 req/sec, burst 3
  • Bulk endpoints: 10 req/sec, burst 3