High-performance Kalshi orderbook engine with async + threaded support
Project description
Kalshi Simple WebSocket Orderbook
High-performance Python library for consuming live Kalshi orderbook data with async + threaded support.
This library allows you to track markets, process snapshots and deltas, and query the orderbook safely from synchronous code.
Features
- Async-first orderbook feed
- Thread-safe
OrderbookManager - Background thread support for synchronous applications
- Calculates best prices, liquidity, and top N levels
- Lightweight and dependency-minimal
- Designed for live trading and backtesting
Installation
pip install kalshi-simple-ws-orderbook
Setup
You will need:
- API Key ID
- API Key file, (I use a .pem file)
Log in to your Kalshi account (demo or production) Navigate to Account & security → API Keys Click Create Key Save both: Private Key: Downloaded as a .key file API Key ID: Displayed on screen (looks like a952bcbe-ec3b-4b5b-b8f9-11dae589608c)
https://docs.kalshi.com/getting_started/quick_start_authenticated_requests
Usage
See demo.py for examples on using the library, aside form getting the most recent orderbook there are several function to measure liquidity and get the current best price
Orderbook Notes
Kalshi order book is refreshed on subscription, and then updated with orderbook delta messages, if there is too much backpressure resubscribing can get current status, adding as a feature to next version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kalshi_simple_ws_orderbook-1.0.0.tar.gz.
File metadata
- Download URL: kalshi_simple_ws_orderbook-1.0.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
875cdf78ee0e402df417f482c0cf206b7d4a49b0c3b5be1417c556a512124ec1
|
|
| MD5 |
dd958b464a7002304779be7aeab48916
|
|
| BLAKE2b-256 |
f5d8ecf78017178ffaac23c77d56b1e1ec1a6a207e1b3af13b73770cbf7f23ce
|
File details
Details for the file kalshi_simple_ws_orderbook-1.0.0-py3-none-any.whl.
File metadata
- Download URL: kalshi_simple_ws_orderbook-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80a680911cc7c068862ed5cee51c1275576a2be2c7712e48cd5c10753c648659
|
|
| MD5 |
fa48928db4a15295e6e8dc87bc1b81e2
|
|
| BLAKE2b-256 |
e67d48ea1099d68763cf3748299059624149fb4d4d151e66af60b25f76dea650
|