An asyncio-native Kalshi API.
Project description
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.
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 aiokalshi-0.1.0.tar.gz.
File metadata
- Download URL: aiokalshi-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d837bb7a33ee0dc1fd152e7efb4afd041e7e069821b80ab728b91bbb8a0c0a89
|
|
| MD5 |
9f03b5e4ff524fbc5b8c75806b24e189
|
|
| BLAKE2b-256 |
af08128a9a196a2ee9c90ca609a91fc08afcdeb09bb69bf622be0a42c3e87054
|
File details
Details for the file aiokalshi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aiokalshi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd0e193a3de3b4e799da939c5e7e44e3f6b43ff46893f3b1f8da95da0ac9198a
|
|
| MD5 |
00d0ae9445e0ce28dcae592b8c492ec9
|
|
| BLAKE2b-256 |
f84850a843a39dd65263a4484ad8093c31c7d7e67237cfea667a805ebb514b77
|