Skip to main content

polymarket_sdk/
lib.rs

1//! # polymarket-sdk
2//!
3//! A comprehensive Rust SDK for the [Polymarket CLOB API](https://docs.polymarket.com),
4//! enabling programmatic trading on Polymarket prediction markets.
5//!
6//! ## Features
7//!
8//! - **Feature flags**: `clob` (default), `gamma` (default), `data`, `ws`, `full`
9//! - **Type-level auth guards**: compile-time prevention of calling trading endpoints
10//!   without credentials
11//! - **Retry & rate-limit handling**: automatic exponential backoff
12//! - **WebSocket streaming** (behind `ws` feature): real-time market data
13//!
14//! ## Quick Start
15//!
16//! ```rust,no_run
17//! use polymarket_sdk::PolymarketClient;
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), polymarket_sdk::PolymarketError> {
21//!     // Public-only client (no auth required for market data)
22//!     let client = PolymarketClient::new_public(None)?;
23//!     let markets = client.get_sampling_simplified_markets(None).await?;
24//!     println!("Found {} markets", markets.len());
25//!     Ok(())
26//! }
27//! ```
28
29pub mod auth;
30pub mod client;
31pub mod constants;
32pub mod error;
33pub mod http;
34pub mod signing;
35pub mod types;
36
37#[cfg(feature = "ws")]
38pub mod stream;
39
40pub use client::{Authenticated, PolymarketClient, PolymarketClientBuilder, Public};
41pub use error::PolymarketError;
42pub use types::*;