Kalshi Python SDK¶
A professional, spec-first Python SDK for the Kalshi prediction markets API.
- Full REST coverage — 85 endpoints across 19 resources (OpenAPI v3.18.0), every kwarg drift-tested against the spec.
- V2 event-market orders — new
create_v2/amend_v2/decrease_v2/cancel_v2family on/portfolio/events/orders/*. Legacy/portfolio/orderskeeps working; deprecation no earlier than May 6, 2026. - Funding + cost introspection —
portfolio.deposits(),portfolio.withdrawals(),account.endpoint_costs(). - Full WebSocket coverage — 13 channels with sequence-gap detection, automatic reconnection, backpressure strategies, and an in-memory orderbook builder.
- Sync and async parity —
KalshiClientandAsyncKalshiClientshare one transport implementation; method names, kwargs, return types, and error behavior are identical. - Typed end-to-end — Pydantic v2 models,
Literaltypes for enums,mypy --strictclean. Request bodies useextra="forbid"so phantom kwargs fail fast. - Money safety — prices are
Decimalvia a customDollarDecimaltype. No floats anywhere on the price path.
Install¶
Requires Python 3.12+. Optional DataFrame extras:
pip install 'kalshi-sdk[pandas]' # pandas
pip install 'kalshi-sdk[polars]' # polars
pip install 'kalshi-sdk[all]' # both
Hello, markets¶
from kalshi import KalshiClient
with KalshiClient(demo=True) as client:
for market in client.markets.list_all(status="open"):
print(market.ticker, market.yes_bid, market.yes_ask)
No credentials needed for most market data. To place orders, see Authentication.
Where to go next¶
| If you want to… | Read |
|---|---|
| Place your first authenticated request | Quickstart |
| Understand RFQs, milestones, subaccounts, etc. | Concepts |
| Tune timeouts, retries, HTTP/2 | Configuration |
| Walk pages or convert to DataFrames | Pagination · DataFrames |
| Build a live-data app | WebSocket |
| Catch the right exception | Errors · Retries & idempotency |
| Find every method on a resource | Resources |
| Test your code without hitting the API | Testing |