Skip to main content

An async-native, fully type-hinted Python client for Kalshi

aiokalshi provides a friendly interface into Kalshi's REST API (websocket support is in development). The library offers the benefits of asynchronous code, editor autocomplete, and parity with Kalshi's API while being easy to use and not requiring authentication.

Installation

uv add aiokalshi
pip install aiokalshi

Usage

aiokalshi uses the same structure as Kalshi's documented RESTful API. Every query parameter available is provided in a typed fashion, meaning you get autocomplete when customizing your queries.

Every response includes all of the available data and makes use of Pydantic.

from httpx import AsyncClient
from aiokalshi import Kalshi

async def main():
    async with AsyncClient(follow_redirects=True) as client:
        # Make a client
        kalshi = Kalshi(client)

        # Get markets
        # Convention: list for grabbing paginated things, get for grabbing one-off queries
        markets = await kalshi.markets.list()
        markets_one = await kalshi.markets.list(limit=1)

        # Get one market
        market = await kalshi.markets.get(markets_one.markets[0].ticker)

        # Get the orderbook for a market
        orderbook = await kalshi.markets.orderbook.get(market.ticker, depth=5)

        # Get trades for a market
        trades = await kalshi.markets.trades.list(market.ticker, limit=10)

        # Get candlestick data for a market
        candlesticks = await kalshi.markets.candlesticks.get(
            series_ticker="SERIES-TICKER",
            market_ticker=market.ticker,
            start_ts=1700000000,
            end_ts=1700086400,
            period_interval=60  # 1 hour intervals
        )

        # Get events
        events = await kalshi.events.list(status="open", limit=10)

        # Get a specific event
        event = await kalshi.events.get(events.events[0].event_ticker)

        # Get event metadata
        metadata = await kalshi.events.metadata.list(event.event.event_ticker)

        # Get series by category
        series_list = await kalshi.series.list(category="Science and Technology")

        # Get a specific series
        if series_list.series:
            series = await kalshi.series.get(series_list.series[0].ticker)

Status

This project is under rapid development. Expect breaking changes.

Release files for aiokalshi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiokalshi 0.1.0
File Size Uploaded
aiokalshi-0.1.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiokalshi 0.1.0
File Interpreter ABI Platform
aiokalshi-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / aiokalshi-0.1.0.tar.gz

Download URL aiokalshi-0.1.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d837bb7a33ee0dc1fd152e7efb4afd041e7e069821b80ab728b91bbb8a0c0a89
BLAKE2b-256 checksum
How to use checksums
af08128a9a196a2ee9c90ca609a91fc08afcdeb09bb69bf622be0a42c3e87054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.19

Release files / aiokalshi-0.1.0-py3-none-any.whl

Download URL aiokalshi-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd0e193a3de3b4e799da939c5e7e44e3f6b43ff46893f3b1f8da95da0ac9198a
BLAKE2b-256 checksum
How to use checksums
f84850a843a39dd65263a4484ad8093c31c7d7e67237cfea667a805ebb514b77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.19

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page