Skip to main content

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:

  1. API Key ID
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kalshi_simple_ws_orderbook-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kalshi_simple_ws_orderbook-1.0.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file kalshi_simple_ws_orderbook-1.0.0.tar.gz.

File metadata

File hashes

Hashes for kalshi_simple_ws_orderbook-1.0.0.tar.gz
Algorithm Hash digest
SHA256 875cdf78ee0e402df417f482c0cf206b7d4a49b0c3b5be1417c556a512124ec1
MD5 dd958b464a7002304779be7aeab48916
BLAKE2b-256 f5d8ecf78017178ffaac23c77d56b1e1ec1a6a207e1b3af13b73770cbf7f23ce

See more details on using hashes here.

File details

Details for the file kalshi_simple_ws_orderbook-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kalshi_simple_ws_orderbook-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80a680911cc7c068862ed5cee51c1275576a2be2c7712e48cd5c10753c648659
MD5 fa48928db4a15295e6e8dc87bc1b81e2
BLAKE2b-256 e67d48ea1099d68763cf3748299059624149fb4d4d151e66af60b25f76dea650

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page