Skip to main content

Overview

The Limitless Exchange Rust SDK (limitless-exchange-rust-sdk) is a typed async client for interacting with both CLOB and NegRisk prediction markets. It provides:
  • Strongly typed request and response models
  • Built-in EIP-712 order building and signing
  • Root Client composition for markets, portfolio, navigation, partner flows, and WebSockets
  • Pluggable logging and retry helpers
  • Async WebSocket streaming with auto-reconnect
The SDK requires Rust 1.74+ and uses async / await throughout. The examples below assume a Tokio runtime.

Installation

[dependencies]
limitless-exchange-rust-sdk = "1.0.7"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Quick Start

1

Initialize the client

use limitless_exchange_rust_sdk::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new()?;
    Ok(())
}
2

Fetch active markets

use limitless_exchange_rust_sdk::{ActiveMarketsParams, ActiveMarketsSortBy, Client};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new()?;

    let result = client
        .markets
        .get_active_markets(Some(&ActiveMarketsParams {
            limit: Some(10),
            page: Some(1),
            sort_by: Some(ActiveMarketsSortBy::Newest),
        }))
        .await?;

    for market in result.data {
        println!("{} {}", market.title, market.slug);
    }

    Ok(())
}
3

Check your positions

use limitless_exchange_rust_sdk::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new()?; // reads LIMITLESS_API_KEY from the environment if set

    let positions = client.portfolio.get_positions().await?;
    println!("CLOB positions: {}", positions.clob.len());

    Ok(())
}

Authentication

The SDK supports both authentication modes:
  • Legacy API key (X-API-Key)
  • Scoped token HMAC (lmts-api-key, lmts-timestamp, lmts-signature) for partner/programmatic integrations
With hmac_credentials(...) set, the SDK automatically generates and sends lmts-api-key, lmts-timestamp, and lmts-signature. Do not manually build HMAC headers when using the SDK client.
Never hardcode API keys, HMAC secrets, or raw wallet private keys in source code or commit them to version control. Use environment variables or a secrets manager.

Root Client

The recommended entrypoint is the root Client, which composes all domain services:
use limitless_exchange_rust_sdk::Client;

let client = Client::new()?;

// client.markets
// client.portfolio
// client.pages
// client.api_tokens
// client.partner_accounts
// client.delegated_orders
// client.server_wallets
For signing orders, create an OrderClient from the root client:
let order_client = client.new_order_client(&std::env::var("PRIVATE_KEY")?, None)?;
For streaming, create a WebSocketClient from the root client:
let ws = client.new_websocket_client(None);

HttpClient Builder Options

The SDK uses a builder pattern on Client::builder():
MethodTypeDefaultDescription
base_url(url)Stringhttps://api.limitless.exchangeAPI base URL
timeout(duration)Duration30sHTTP request timeout
api_key(key)StringReads LIMITLESS_API_KEY envLegacy API key authentication
hmac_credentials(creds)HmacCredentialsHMAC credentials for scoped API-token auth
additional_headers(map)HashMap<String, String>emptyExtra headers merged into every request
logger(logger)SharedLoggerNoopLoggerLogger for request/response tracing
use std::{collections::HashMap, sync::Arc, time::Duration};

use limitless_exchange_rust_sdk::{Client, ConsoleLogger, LogLevel};

let mut headers = HashMap::new();
headers.insert("X-Strategy-Name".to_string(), "market-maker-a".to_string());

let http = Client::builder()
    .timeout(Duration::from_secs(15))
    .additional_headers(headers)
    .logger(Arc::new(ConsoleLogger::new(LogLevel::Debug)))
    .build()?;

let client = Client::from_http_client(http)?;

Logging

The SDK provides a pluggable Logger trait with a built-in ConsoleLogger:
use std::sync::Arc;

use limitless_exchange_rust_sdk::{Client, ConsoleLogger, LogLevel};

let http = Client::builder()
    .logger(Arc::new(ConsoleLogger::new(LogLevel::Debug)))
    .build()?;

let client = Client::from_http_client(http)?;
LevelDescription
LogLevel::DebugVerbose request/response output, venue cache behavior, and WebSocket lifecycle
LogLevel::InfoGeneral operational messages
LogLevel::WarnWarnings about missing auth, cache misses, or retry behavior
LogLevel::ErrorErrors only
Use LogLevel::Debug during development when integrating signing, partner flows, or WebSockets. Switch to Info or Warn in production.

Source Code

The SDK is open source. Contributions and issue reports are welcome.

GitHub Repository

Browse the source, report issues, and contribute at github.com/limitless-labs-group/limitless-exchange-rust-sdk