Skip to main content

Overview

The Limitless Exchange Python SDK (limitless-sdk) is an async-first Python client built on top of aiohttp. It provides:
  • Fully asynchronous HTTP and WebSocket clients
  • Pydantic models for type-safe request and response handling
  • Automatic venue caching for EIP-712 order signing
  • Built-in retry logic for transient API failures
  • WebSocket streaming with auto-reconnect
The SDK requires Python 3.9+ and uses async/await throughout. All network calls must be awaited inside an asyncio event loop.

Installation

pip install limitless-sdk

Quick Start

1

Initialize the HTTP client

import asyncio
from limitless_sdk.api import HttpClient

http_client = HttpClient()  # loads LIMITLESS_API_KEY from env
2

Fetch active markets

from limitless_sdk.markets import MarketFetcher

async def main():
    market_fetcher = MarketFetcher(http_client)
    markets = await market_fetcher.get_active_markets()

    for market in markets["data"]:
        print(market["title"], market["slug"])

    await http_client.close()

asyncio.run(main())
3

Check your positions

from limitless_sdk.portfolio import PortfolioFetcher

async def main():
    portfolio = PortfolioFetcher(http_client)
    positions = await portfolio.get_positions()

    for pos in positions.get("clob", []):
        print(pos["market"]["title"], pos["size"])

    await http_client.close()

asyncio.run(main())

Authentication

The SDK authenticates using an API key passed via the X-API-Key header.
Never hardcode API keys in source code or commit them to version control. Use environment variables or a secrets manager.

Client constructor

The recommended entrypoint is the root Client class, which composes all domain services (markets, portfolio, orders, API tokens, partner accounts, delegated orders):
from limitless_sdk import Client

client = Client(base_url="https://api.limitless.exchange")
For partner integrations using HMAC authentication:
from limitless_sdk import Client, HMACCredentials

client = Client(
    base_url="https://api.limitless.exchange",
    hmac_credentials=HMACCredentials(
        token_id="your-token-id",
        secret="your-base64-secret",
    ),
)
ParameterTypeDefaultDescription
base_urlstrhttps://api.limitless.exchangeAPI base URL
api_keystr | NoneNone (reads LIMITLESS_API_KEY env)API key for authentication
hmac_credentialsHMACCredentials | NoneNoneHMAC credentials for scoped API token auth (see Programmatic API)
additional_headersdict | NoneNoneExtra headers merged into every request

HttpClient (lower-level)

You can also use HttpClient directly for more control:
from limitless_sdk.api import HttpClient

http_client = HttpClient(
    base_url="https://api.limitless.exchange",
    api_key="lmts_your_key_here",
)
Always call await http_client.close() when you are finished to cleanly shut down the underlying aiohttp session.

Logging

The SDK provides a ConsoleLogger with configurable log levels for debugging:
from limitless_sdk.types import ConsoleLogger, LogLevel

logger = ConsoleLogger(level=LogLevel.DEBUG)
LevelDescription
LogLevel.DEBUGVerbose output including headers, venue cache operations, and raw payloads
LogLevel.INFOGeneral operational messages
LogLevel.WARNWarnings about potential issues
LogLevel.ERRORErrors only
Set LogLevel.DEBUG during development to see request headers, venue cache hits/misses, and full API responses. 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-sdk

Disclaimer

USE AT YOUR OWN RISK. This SDK is provided as-is with no guarantees. You are solely responsible for any trading activity conducted through this software. Limitless Exchange is not available to users in the United States or other restricted jurisdictions. By using this SDK, you confirm compliance with all applicable local laws and regulations.

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.