Overview
The Limitless Exchange Go SDK (limitless-exchange-go-sdk) is a fully typed Go client for interacting with both CLOB and NegRisk prediction markets. It provides:
- Strongly typed structs for all API requests and responses
- Automatic venue caching for EIP-712 order signing
- Built-in retry logic with exponential backoff (using Go generics)
- WebSocket streaming with auto-reconnect
- Functional options pattern for flexible configuration
The SDK requires Go 1.22+. All I/O methods accept a
context.Context as the first parameter and return error as the last return value, following standard Go conventions.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 option
Set the
LIMITLESS_API_KEY environment variable. The HttpClient loads it automatically:With
WithHMACCredentials(...) 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 (markets, portfolio, orders, API tokens, partner accounts, delegated orders):
HttpClient Options
TheHttpClient uses the functional options pattern. Pass any combination of options to NewHttpClient() or NewClient():
| Option | Type | Default | Description |
|---|---|---|---|
WithBaseURL(url) | string | https://api.limitless.exchange | API base URL |
WithAPIKey(key) | string | Reads LIMITLESS_API_KEY env | Legacy API key authentication |
WithHMACCredentials(creds) | HMACCredentials | — | HMAC credentials for scoped API token auth (see Programmatic API) |
WithTimeout(d) | time.Duration | 30s | HTTP request timeout |
WithMaxIdleConns(n) | int | 50 | Maximum idle connections in the pool |
WithIdleConnTimeout(d) | time.Duration | 60s | How long idle connections remain in the pool |
WithTransport(t) | http.RoundTripper | Default transport | Custom HTTP transport |
WithAdditionalHeaders(h) | map[string]string | nil | Extra headers merged into every request |
WithLogger(l) | Logger | NoOpLogger | Logger for request/response tracing |
Logging
The SDK provides a pluggableLogger interface with a built-in ConsoleLogger:
| Level | Description |
|---|---|
LogLevelDebug | Verbose output including headers, venue cache operations, and raw payloads |
LogLevelInfo | General operational messages |
LogLevelWarn | Warnings about potential issues |
LogLevelError | Errors only |
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-go-sdk
Disclaimer
Next Steps
Markets
Discover markets, fetch orderbooks, and understand venue caching.
Market Pages
Browse markets by category with navigation, filters, and pagination.
Trading & Orders
Place GTC and FOK orders, cancel orders, and manage token approvals.
Portfolio & Positions
Track your open positions and trading history.
API Tokens
Derive, list, and revoke scoped HMAC tokens for partner integrations.
Partner Accounts
Create sub-accounts with server wallets or EOA verification.
Delegated Orders
Place orders on behalf of sub-accounts with server-side signing.
WebSocket Streaming
Subscribe to real-time orderbook and price updates.
Error Handling & Retry
Retry logic, error types, and debugging strategies.
Server Wallet Redemption and Withdrawal
For partner server-wallet sub-accounts, the SDK now provides helper methods for payout settlement and treasury movement (v1.0.6+):POST /portfolio/redeem— claim resolved positionsPOST /portfolio/withdraw— transfer ERC20 funds from managed sub-accounts
apiToken auth: trading for redeem and withdrawal for withdraw.
See the full flow and scope guidance in Programmatic API.