Skip to main content

Overview

The Limitless Exchange TypeScript SDK provides a type-safe client for interacting with both CLOB and NegRisk prediction markets. It handles authentication, EIP-712 order signing, market data fetching, portfolio tracking, and real-time WebSocket streaming out of the box.
Source code and issue tracker are available on GitHub.

Installation

npm install @limitless-exchange/sdk

Quick Start

1

Configure environment variables

Create a .env file in your project root (and add it to .gitignore):
LIMITLESS_API_KEY=lmts_your_api_key_here
PRIVATE_KEY=0xYourPrivateKeyHere
The SDK automatically reads LIMITLESS_API_KEY from the environment if no apiKey is passed to the constructor.
2

Initialize the HTTP client

import { HttpClient } from '@limitless-exchange/sdk';

const httpClient = new HttpClient({
  baseURL: 'https://api.limitless.exchange',
});
3

Fetch active markets

import { MarketFetcher } from '@limitless-exchange/sdk';

const marketFetcher = new MarketFetcher(httpClient);

const markets = await marketFetcher.getActiveMarkets({
  limit: 10,
  sortBy: 'newest',
});

for (const market of markets) {
  console.log(market.slug, market.title);
}
4

Authenticate for trading

For operations that require authentication (placing orders, fetching portfolio), supply your API key and wallet:
import { ethers } from 'ethers';

const httpClient = new HttpClient({
  baseURL: 'https://api.limitless.exchange',
  apiKey: process.env.LIMITLESS_API_KEY,
});

const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!);

Environment Variables

VariableRequiredDescription
LIMITLESS_API_KEYFor authenticated endpointsAuto-loaded by the SDK. Generate at limitless.exchange under profile menu.
PRIVATE_KEYFor order signingEthereum private key used for EIP-712 order signatures. Never commit to version control.

HttpClient Constructor

The HttpClient accepts the following options:
const httpClient = new HttpClient({
  baseURL: 'https://api.limitless.exchange',
  apiKey: 'lmts_...',         // Optional: auto-reads LIMITLESS_API_KEY from env
  timeout: 30_000,            // Optional: request timeout in ms (default: 30000)
  additionalHeaders: {        // Optional: extra headers for every request
    'X-Custom-Header': 'value',
  },
});
OptionTypeDefaultDescription
baseURLstringAPI base URL
apiKeystringprocess.env.LIMITLESS_API_KEYAPI key for authentication
timeoutnumber30000Request timeout in milliseconds
additionalHeadersRecord<string, string>{}Additional headers sent with every request

What You Can Build

Disclaimer

USE AT YOUR OWN RISK. This SDK and the Limitless Exchange protocol are provided as-is with no warranties. You are solely responsible for any funds used or lost. By using this SDK, you acknowledge that prediction markets involve financial risk. The Limitless Exchange is not available to users in the United States or other restricted jurisdictions. Ensure compliance with your local laws before trading.