polyte 0.2.4

Unified Rust client for Polymarket APIs (CLOB, Gamma and Data)
Documentation

Polyte

Rust client for Polymarket APIs.

More information about this crate can be found in the crate documentation.

Crates

Crate Description
polyte Unified client for Polymarket APIs (CLOB, Gamma, Data)
polyte-cli CLI tool for querying Polymarket APIs
polyte-clob Client library for Polymarket CLOB (order book) API
polyte-core Core utilities and shared types
polyte-data Client library for Polymarket Data API
polyte-gamma Client library for Polymarket Gamma (market data) API

Installation

cargo add polyte

Or install individual APIs:

# Market data only
cargo add polyte --no-default-features --features gamma

# Trading only
cargo add polyte --no-default-features --features clob

# Data API only
cargo add polyte --no-default-features --features data

Usage

use polyte::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let credentials = Credentials {
        key: "api_key".to_string(),
        secret: "secret".to_string(),
        passphrase: "passphrase".to_string(),
    };

    let client = Polymarket::builder("0x...", credentials)
        .chain(Chain::PolygonMainnet)
        .build()?;

    // Get markets
    let markets = client.gamma.markets().list().send().await?;

    // Get balance
    let balance = client.clob.balance_allowance().await?;

    Ok(())
}

License

This project is licensed under the MIT License.