Skip to main content

Crate polymarket_sdk

Crate polymarket_sdk 

Source
Expand description

§polymarket-sdk

A comprehensive Rust SDK for the Polymarket CLOB API, enabling programmatic trading on Polymarket prediction markets.

§Features

  • Feature flags: clob (default), gamma (default), data, ws, full
  • Type-level auth guards: compile-time prevention of calling trading endpoints without credentials
  • Retry & rate-limit handling: automatic exponential backoff
  • WebSocket streaming (behind ws feature): real-time market data

§Quick Start

use polymarket_sdk::PolymarketClient;

#[tokio::main]
async fn main() -> Result<(), polymarket_sdk::PolymarketError> {
    // Public-only client (no auth required for market data)
    let client = PolymarketClient::new_public(None)?;
    let markets = client.get_sampling_simplified_markets(None).await?;
    println!("Found {} markets", markets.len());
    Ok(())
}

Re-exports§

pub use client::Authenticated;
pub use client::PolymarketClient;
pub use client::PolymarketClientBuilder;
pub use client::Public;
pub use error::PolymarketError;
pub use types::*;

Modules§

auth
Authentication modules for the Polymarket CLOB API.
client
PolymarketClient — top-level entry point with type-level authentication guards.
constants
Network constants, contract addresses, and API URLs.
error
Error types for the Polymarket SDK.
http
HTTP transport layer with retry logic and rate-limit handling.
signing
EIP-712 order signing and order building.
types
Data models for the Polymarket CLOB and Gamma APIs.