Documentation Index
Fetch the complete documentation index at: https://docs.limitless.exchange/llms.txt
Use this file to discover all available pages before exploring further.
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
Clientcomposition 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
Quick Start
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
- Environment variable (recommended)
- HMAC (partner/programmatic)
- Explicit API key
Set
LIMITLESS_API_KEY and let Client::new() or HttpClientBuilder load it automatically: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.Root Client
The recommended entrypoint is the rootClient, which composes all domain services:
OrderClient from the root client:
WebSocketClient from the root client:
HttpClient Builder Options
The SDK uses a builder pattern onClient::builder():
| Method | Type | Default | Description |
|---|---|---|---|
base_url(url) | String | https://api.limitless.exchange | API base URL |
timeout(duration) | Duration | 30s | HTTP request timeout |
api_key(key) | String | Reads LIMITLESS_API_KEY env | Legacy API key authentication |
hmac_credentials(creds) | HmacCredentials | — | HMAC credentials for scoped API-token auth |
additional_headers(map) | HashMap<String, String> | empty | Extra headers merged into every request |
logger(logger) | SharedLogger | NoopLogger | Logger for request/response tracing |
Logging
The SDK provides a pluggableLogger trait with a built-in ConsoleLogger:
| Level | Description |
|---|---|
LogLevel::Debug | Verbose request/response output, venue cache behavior, and WebSocket lifecycle |
LogLevel::Info | General operational messages |
LogLevel::Warn | Warnings about missing auth, cache misses, or retry behavior |
LogLevel::Error | Errors only |
Server Wallet Redemption and Withdrawal
For partner server-wallet sub-accounts, the SDK provides helper methods for payout settlement and treasury movement:POST /portfolio/redeem— claim resolved positionsPOST /portfolio/withdraw— transfer ERC20 funds from managed sub-accountsPOST /portfolio/withdrawal-addresses— allowlist an explicit treasury destination with Privy identity authDELETE /portfolio/withdrawal-addresses/:address— remove an allowlisted destination with Privy identity auth
apiToken auth: trading for redeem and withdrawal for withdraw. Allowlist add/delete calls use a Privy identity token instead of API-token/HMAC auth.
on_behalf_of when withdrawing from a child server-wallet profile. destination is optional for child withdrawals; when omitted, the API defaults to the authenticated partner smart wallet when present, otherwise the authenticated partner account. You can omit on_behalf_of only when withdrawing the authenticated caller’s own server wallet to an explicit destination.
See the full flow and scope guidance in Programmatic API.
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