kalshi-rs
Overview
kalshi-rs is a Rust client that mirrors the structure and behavior of the
official Kalshi Python SDK
https://docs.kalshi.com/sdks/python/quickstart
This means:
- method names match the Python SDK whenever possible
- request/response structures follow the same shape
- authentication and request signing work exactly like the official version
- examples from the Python docs can be translated to Rust easily
If you’ve used Kalshi’s Python SDK, the Rust version will feel immediately familiar.
The crate supports:
- authentication using your Kalshi API key & PEM private key
- listing and querying markets
- retrieving orderbooks, trades, candlesticks
- creating, canceling, and managing orders
- fetching portfolio and positions
- error handling consistent with Kalshi’s API responses
The best way to get started is to look at the examples below, the examples in the examples directory and in the quickstart guide and for contirbutions and understanding how the repo is structured the /src readme
Installation
Add the crate to your project:
Quickstart Example
use ;
use MarketsQuery;
async
Placing and Canceling an Order
use CreateOrderRequest;
let order = CreateOrderRequest ;
let placed = client.create_order.await?;
println!;
client.cancel_order.await?;
println!;
Running Tests
Several tests interact with the real Kalshi API. You must set your environment variables:
You can generate these keys from the Kalshi dashboard:
API Keys Setup: API keys setup
Then run:
Tests involving trading endpoints will make real requests, so be mindful of costs.
Design Philosophy
kalshi-rs intentionally follows the official Python SDK’s structure and naming to make the transition between languages seamless. If the Python docs say:
You can expect the Rust version to expose an equivalent:
client.get_all_markets
The goal is clarity, reliability, and easy adoption — not reinvention.
Contributing
Contributions are welcome!
- create a branch
- add your features / improvements
- open a pull request
If you're implementing newly released Kalshi endpoints, improving error handling, or adding examples, all PRs are appreciated.
License
This project is licensed under the MIT License.
See LICENSE for details.