# pykalshi

Unofficial Kalshi client with what the generated SDK leaves out - streams and retries.

*https://predictionmarkets.tools/tools/pykalshi · Trading Clients, SDKs & Bots*

## Facts

### At a glance

| Field | Value |
| --- | --- |
| Vendor | pykalshi |
| Category | Trading Clients, SDKs & Bots |
| Job | sdk |
| Website | https://github.com/arshka/pykalshi |
| Pricing model | open-source |
| Free tier | true |
| Open source | true |
| Licence | MIT |
| Self-hosted | true |
| Tested hands-on | false |
| Last updated | 2026-09-19 |

### Availability

| Field | Value |
| --- | --- |
| Jurisdictions | global |
| Open to US persons | true |
| KYC required | false |

### Markets

| Field | Value |
| --- | --- |
| Settlement | cash |
| Resolved by | none |

### Economics

| Field | Value |
| --- | --- |
| Taker fee | none |
| Maker fee | none |
| Liquidity model | clob |
| Platforms | library |
| AI features | none |

### Interfaces

| Field | Value |
| --- | --- |
| API | true |
| WebSocket | true |
| Scripting | none |
| Python | true |
| MCP server | false |
| Export | json |

### Capabilities

Yes: order_book, automation, live_trading, portfolio_tracking

No: charting, screening, backtesting, paper_trading, calibration_scoring, cross_venue, alerts, news, tax_reporting

*Verified: pricing 2026-09-19; availability 2026-09-19; capabilities 2026-09-19.*

## What it is

A third-party Python client for Kalshi, written for the case the generated official SDK does not
cover: a program that has to stay connected. It is MIT, one author, 125 stars, and it has the
three dates a reader needs - last release 2.0.0 on PyPI on 2026-07-27, last commit on `main` on
2026-07-29, repository not archived.

What it adds over a generated REST client:

- **WebSocket streaming** with typed messages - tickers, order book snapshots and deltas, trades -
  consumed as an async iterator you can pattern-match on.
- **A local order book.** `OrderbookManager` applies the deltas and hands back the current book,
  which is the piece every market-making script otherwise writes badly once.
- **Automatic retries** with exponential backoff on rate limits and transient errors, and typed
  exceptions - `InsufficientFundsError`, `RateLimitError`, `KalshiAPIError` with status and error
  code - instead of a generic HTTP failure.
- **Domain objects.** `Market`, `Order` and `Event` carry methods: `order.cancel()`,
  `order.amend(price_dollars=...)`, `order.decrease(...)`, `order.wait_until_terminal()`,
  `market.get_orderbook()`.
- **pandas and Jupyter.** `.to_dataframe()` on any list result, including candlesticks and order
  books, and rich HTML rendering of markets, orders and positions in a notebook.
- **A bundled web dashboard** behind the `[web]` extra - FastAPI and uvicorn - for browsing
  markets and watching a portfolio locally. The README presents it as a development tool and a
  reference implementation rather than a product.

Five runtime dependencies: `httpx`, `pydantic`, `cryptography`, `python-dotenv` and `websockets`.

## Availability

The package installs anywhere pip works and needs Python 3.9 or newer. Reads of public market
data need no account.

Trading needs Kalshi credentials, and who may hold a funded Kalshi account is a question about the
exchange - see [kalshi](https://predictionmarkets.tools/tools/kalshi). The library grants no access and blocks none; the flags
here describe the package.

## Pricing

Free, MIT-licensed, nothing metered and nothing to buy. Kalshi does not charge for API access
either. Trading fees are the exchange's and are on its card.

## Markets & resolution

The client resolves nothing. Orders placed through it rest on Kalshi's book and settle in dollars
against the exchange's determination.

Two data-model details this library handles explicitly, and they are the ones that catch people.
Prices are cents on the wire and the library exposes dollar-denominated fields
(`yes_price_dollars`, `price_dollars`) beside them. And direction on Kalshi has two vocabularies:
the legacy action-and-side pair, which the README notes means different things on orders than on
fills and which Kalshi has deprecated, and the `book_side` / `outcome_side` pair it prefers. Both
map onto the same wire body here, which is convenient and is also two ways to write the same bug.

## Integrations

Nothing beyond Python. No CLI, no MCP server, no bot framework - the examples directory carries a
momentum bot as a sample, not as a product. The optional extras are `[dataframe]` for pandas and
`[web]` for the local dashboard.

It speaks to [kalshi-api](https://predictionmarkets.tools/tools/kalshi-api) and nothing else.

## Limitations

**It is one person's library.** 125 stars, one open issue, and no organisation behind it. That is
not a criticism of the code, which is more carefully built than most of this category; it is the
risk you are taking, and the mitigation is that it is MIT and readable.

**Not full API coverage**, by its own admission: the comparison table in the README gives that
column to the official generated client. If you need an endpoint the author has not wrapped, you
are dropping to HTTP.

**Unofficial, so it tracks the API at one remove.** Kalshi publishes SDK releases weekly against
its OpenAPI specification; a third-party client learns about a change when something breaks.

**No paper mode.** There is no simulator: an order is a real order. Kalshi's own demo environment
is the closest thing, and wiring this client to it is your job.

**Nothing here has been run by us** against a funded account - no order placed, no stream held
open, no retry observed.

## Alternatives

[kalshi-python-sync](https://predictionmarkets.tools/tools/kalshi-python-sync) is Kalshi's current official Python SDK: complete,
released weekly, REST only, proprietary, and Python 3.13 or newer.
[kalshi-python](https://predictionmarkets.tools/tools/kalshi-python) is the deprecated package that came before it.

[ccxt](https://predictionmarkets.tools/tools/ccxt) and [pmxt](https://predictionmarkets.tools/tools/pmxt) reach Kalshi as one venue among several, if you would
rather write one integration than the best one.

[kalshi-api](https://predictionmarkets.tools/tools/kalshi-api) is the underlying API, which is plain HTTP and needs no client at
all if all you want is a price.

## FAQ

### Is pykalshi official?

No, and it says so at the foot of its own README - it is unaffiliated with Kalshi. It is published by one author, ArshKA, under MIT, and reached 2.0.0 on PyPI on 2026-07-27 after nineteen releases since February 2026.

### What does it do that Kalshi's own SDK does not?

WebSocket streaming, a local order book assembled from deltas, automatic retry and backoff on rate limits, typed exceptions, domain objects with methods like order.cancel(), pandas output and rich display in Jupyter. Its own comparison table concedes the other direction - full API coverage belongs to the generated official client.

### Where does it keep my Kalshi credentials?

On your machine. It reads KALSHI_API_KEY_ID and a path to your private key file from the environment, and signs requests in process with the cryptography package. Nothing is sent anywhere but Kalshi.

### Does it work on older Python?

Yes - the metadata asks for Python 3.9 or newer, which matters because Kalshi's current official Python packages require 3.13.

## Background

- [What running a bot does not solve](https://predictionmarkets.tools/guides/what-a-bot-cannot-fix.md) — A bot fixes speed and consistency. Rate limits, a missing rehearsal, a field that stops arriving, a partial fill and a paused market are not coding problems.

- [Where your key lives when software trades for you](https://predictionmarkets.tools/guides/where-your-key-lives.md) — Four different credentials are all called a key, and they differ in what a copy permits. What the clients in this catalogue ask for, and what to ask them back.

## Also worth comparing

- [Kalshi Python SDK (sync and async)](https://predictionmarkets.tools/tools/kalshi-python-sync.md) — Kalshi's current official Python client - weekly releases, Python 3.13 only, no source.
- [kalshi-python](https://predictionmarkets.tools/tools/kalshi-python.md) — Kalshi's own generated Python client - closed-source, and unreleased since September 2025.
- [Polymarket US Python SDK](https://predictionmarkets.tools/tools/polymarket-us-python.md) — Official SDK for Polymarket US - installs as polymarket-us, unreleased since January.
- [Polymarket US TypeScript SDK](https://predictionmarkets.tools/tools/polymarket-us-typescript.md) — Official TypeScript client for Polymarket US - npm has shipped nothing since January.
- [CCXT](https://predictionmarkets.tools/tools/ccxt.md) — One client for seven prediction venues, inside a 104-exchange crypto library.
- [limitless-sdk](https://predictionmarkets.tools/tools/limitless-sdk.md) — Limitless Exchange's own async Python SDK - CLOB and NegRisk orders, WebSocket, MIT.
