Skip to content

kalshi-py

A modern, type-safe Python client library for the Kalshi Trade API, built daily from Kalshi OpenAPI spec.

Installation

pip install kalshi-py

For more installation options, see Installation Guide.

Quick Start

Get up and running in minutes:

from kalshi_py import create_client
from kalshi_py.api.portfolio import get_balance

# Uses "KALSHI_API_KEY_ID" and "KALSHI_PY_PRIVATE_KEY_PEM" env vars, see Authenticate for more options
client = create_client()
balance = get_balance.sync(client=client)
print(f"Account balance: ${balance.balance}")

Overview

Features

  • Type Safety: Full type hints and validation
  • Async Support: Both synchronous and asynchronous APIs
  • Authentication: Built-in RSA-PSS signature authentication
  • Auto-generated: Generated from OpenAPI specification
  • Modern: Built with httpx and attrs

Documentation Sections

API Modules

The client is organized into logical modules:

  • Market API - Market data, events, order books
  • Portfolio API - Account balance, positions, orders
  • Communications API - Announcements and communications
  • Collections API - Event collections
  • Milestones API - Milestone tracking
  • Structured Targets API - Structured targets
  • API Keys API - API key management

Support