| Crates.io | roshi |
| lib.rs | roshi |
| version | 0.0.1 |
| created_at | 2025-08-02 18:33:55.552748+00 |
| updated_at | 2025-08-02 18:33:55.552748+00 |
| description | A Rust client for the Kalshi API |
| homepage | |
| repository | https://github.com/ElijahElrod/roshi |
| max_upload_size | |
| id | 1779043 |
| size | 93,033 |
Roshi is a fully asynchronous, type-safe, and ergonomic SDK for interacting with the Kalshi prediction market exchange.
This crate wraps both Kalshiβs REST and WebSocket APIs, providing a modern, Rust-native interface for trading, market data, and more.
reqwest, tokio, serde, and tokio-tungsteniteuse roshi::HttpClient;
use roshi::mode::Mode;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = HttpClient::new(Mode::Demo, Some("your-api-key".to_string()), None);
let markets = client.get_markets().await?;
for market in markets.markets.unwrap_or_default() {
println!("{} - {}", market.ticker.unwrap_or_default(), market.title.unwrap_or_default());
}
Ok(())
}
use roshi::WebSocketClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut ws = WebSocketClient::connect().await?;
ws.subscribe_market("INFLATION2024").await?;
while let Some(event) = ws.next_event().await {
match event {
roshi::WebSocketEvent::MarketUpdate(update) => println!("{:#?}", update),
roshi::WebSocketEvent::Error(e) => eprintln!("WebSocket error: {:?}", e),
_ => {}
}
}
Ok(())
}
client] β REST and WebSocket API supportconstants] β API Endpointstypes] β Typed data structures for markets, events, orders, etc.utils] β Utility functions for signing, formatting, etc.Enable optional features in your Cargo.toml:
[dependencies.roshi]
version = "0.1"
features = ["rest_client", "ws_client", "debug"]
Licensed