openpx 0.1.4

Unified SDK for prediction markets — Kalshi, Polymarket, Opinion and more
Documentation

openpx

Crates.io Documentation License: MIT

Unified Rust SDK for prediction markets — Kalshi, Polymarket, Opinion and more.

Installation

[dependencies]
openpx = "0.1"

Quick Start

use openpx::{Exchange, ExchangeInner};
use serde_json::json;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Connect to Kalshi (public API)
    let exchange = ExchangeInner::new("kalshi", json!({}))?;
    let (markets, _) = exchange.fetch_markets(&Default::default()).await?;

    for market in markets.iter().take(5) {
        println!("{}: {:?}", market.question, market.prices);
    }

    Ok(())
}

Supported Exchanges

  • Kalshi — US-regulated event contracts
  • Polymarket — Crypto-native prediction markets
  • Opinion — Opinion exchange markets

Features

Everything you need in a single crate:

  • Unified Exchange trait across all prediction markets
  • Core types: Market, Order, Position, Orderbook, Trade
  • Enum dispatch (no vtable overhead)
  • Real-time WebSocket streaming
  • Crypto price feeds (CryptoPriceWebSocket)
  • Sports score feeds (SportsWebSocket)