kalshi_rs/
lib.rs

1//! Kalshi Rust SDK
2//!
3//! Unofficial Rust SDK for interacting with the Kalshi trading API.
4//! Provides authentication, market data retrieval, portfolio management, and trading functionality.
5//!
6//! # Quick Start
7//!
8//! ```no_run
9//! use kalshi_rs::{Account, KalshiClient};
10//! use kalshi_rs::markets::models::MarketsQuery;
11//!
12//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
13//! // 1. Load your API credentials
14//! let account = Account::from_file("kalshi_private.pem", "your-api-key-id")?;
15//!
16//! // 2. Create a client
17//! let client = KalshiClient::new(account);
18//!
19//! // 3. Use the client to call API endpoints
20//! let markets = client.get_all_markets(&MarketsQuery {
21//!     limit: Some(10),
22//!     status: Some("open".to_string()),
23//!     ..Default::default()
24//! }).await?;
25//!
26//! println!("Found {} markets", markets.markets.len());
27//! # Ok(())
28//! # }
29//! ```
30//!
31//! # Main Components
32//!
33//! - [`KalshiClient`] - Main client with all API endpoint methods
34//! - [`Account`] - Authentication credentials
35//!
36//! # API Endpoint Modules
37//!
38//! - [`markets`] - Market data, orderbooks, candlesticks, trades
39//! - [`portfolio`] - Orders, positions, fills, balance
40//! - [`exchange`] - Exchange status and schedule
41//! - [`events`] - Event information
42//! - [`series`] - Series data
43//!
44//! # Finding Endpoint Methods
45//!
46//! All API endpoint methods are implemented on [`KalshiClient`].
47//! Navigate to the [`KalshiClient`] documentation to see all available methods organized by category.
48
49
50// Core modules
51pub mod auth;           // Authentication and credential management
52pub mod client;         // Main HTTP client
53pub mod ws_client;         // Main Websocket client
54pub mod errors;         // Error types
55pub(crate) mod helpers; // Internal HTTP helpers
56
57
58// API endpoint modules
59pub mod api_keys;                   // API key management
60pub mod communications;             // Announcements and communications
61pub mod events;                     // Event data and queries
62pub mod exchange;                   // Exchange status and schedule
63pub mod markets;                    // Market data and trading
64pub mod milestones;                 // Milestone tracking
65pub mod multivariate_collections;   // Multivariate event collections
66pub mod portfolio;                  // Portfolio and position management
67pub mod series;                     // Series data
68pub mod structured_targets;         // Structured target markets
69pub mod websocket;                  // Websocket trades and orderbook updates
70
71
72// Re-exports for convenient access
73pub use auth::Account;
74pub use client::KalshiClient;
75pub use ws_client::KalshiWebsocketClient;