1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! # Roshi β Kalshi SDK for Rust
//!
//! **Roshi** is a fully asynchronous, type-safe, and ergonomic SDK for interacting with the [Kalshi](https://kalshi.com/) prediction market exchange.
//!
//! This crate wraps both Kalshiβs **REST** and **WebSocket** APIs.
//!
//! ---
//!
//! ## Features
//!
//! - β
Full support for [Kalshi's REST API](https://docs.kalshi.com/api-reference/)
//! - π‘ Real-time market data over Kalshi's WebSocket feeds
//! - π API key authentication and request signing
//! - π§ Typed models for events, markets, orders, and more
//! - π¦ Built on `reqwest`, `tokio`, `serde`, and `tokio-tungstenite`
//!
//! ---
//!
//! ## Quick Start
//!
//! ### REST Client Example
//!
//! ```rust
//! use 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(())
//! }
//! ```
//!
//! ### WebSocket Client Example
//!
//! ```rust
//! 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(())
//! }
//! ```
//!
//! ---
//!
//! ## Modules
//!
//! - [`client`] β REST and WebSocket API support
//! - [`constants`] β API Endpoints
//! - [`types`] β Typed data structures for markets, events, orders, etc.
//! - [`utils`] β Utility functions for signing, formatting, etc.
//!
//! ---
//!
//! ## Crate Features
//!
//! Enable optional features in your `Cargo.toml`:
//!
//! ```toml
//! [dependencies.roshi]
//! version = "0.1"
//! features = ["rest_client", "ws_client", "debug"]
//! ```
//!
//! ---
//!
//! ## License
//!
//! Licensed under the MIT License.
//!
pub use HttpClient;
pub use WebSocketClient;
pub use endpoints;
pub use *;
pub use format_endpoint;