Documentation Index
Fetch the complete documentation index at: https://limitless-docs-ws-settlement-events.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before placing orders, initialize the required clients:OrderClient Constructor
| Option | Type | Required | Description |
|---|---|---|---|
httpClient | HttpClient | Yes | Authenticated HTTP client |
wallet | ethers.Wallet | Yes | Wallet for EIP-712 signing |
marketFetcher | MarketFetcher | No | Enables automatic venue caching. If omitted, venue data is fetched on each order. |
The
OrderClient automatically fetches your user profile data (including ownerId) from the API on the first order. You do not need to supply it manually.Token Approvals
Before trading, your wallet must approve the relevant venue contracts to spend USDC and conditional tokens. This is a one-time setup per venue.Approval Requirements
| Market Type | USDC Approval | Conditional Token Approval |
|---|---|---|
| CLOB | Venue exchange contract | Venue exchange contract |
| NegRisk | NegRisk exchange contract | NegRisk exchange contract |
Manual Approval with ethers
GTC Orders (Good-Til-Cancelled)
GTC orders remain on the orderbook until filled, cancelled, or the market resolves. Specifyprice (probability between 0 and 1) and size (number of shares).
Buy YES shares
Post-only GTC order
UsepostOnly: true to ensure your order is never filled immediately as a taker. If the order would cross the spread (i.e., match against existing orders), it is rejected instead. This guarantees you always receive maker fees.
Sell NO shares
GTC Parameter Reference
| Parameter | Type | Description |
|---|---|---|
marketSlug | string | Market slug identifier |
tokenId | string | YES or NO token ID from market.positionIds |
side | Side | Side.BUY (0) or Side.SELL (1) |
price | number | Price between 0 and 1 (exclusive), tick-aligned |
size | number | Number of shares (positive, step-aligned) |
orderType | OrderType | OrderType.GTC |
postOnly | boolean | Optional. When true, rejects the order if it would immediately match. Default false. |
FAK Orders (Fill-And-Kill)
FAK orders use the sameprice and size inputs as GTC, but they only consume immediately available liquidity and cancel any unmatched remainder.
postOnly is not supported for FAK orders.
Buy with FAK
Sell with FAK
FAK Parameter Reference
| Parameter | Type | Description |
|---|---|---|
marketSlug | string | Market slug identifier |
tokenId | string | YES or NO token ID from market.positionIds |
side | Side | Side.BUY (0) or Side.SELL (1) |
price | number | Price between 0 and 1 (exclusive), tick-aligned |
size | number | Number of shares (positive, step-aligned) |
orderType | OrderType | OrderType.FAK |
FOK Orders (Fill-Or-Kill)
FOK orders execute immediately against the existing orderbook or are rejected entirely. Instead ofprice and size, specify makerAmount which represents the total value to trade.
Buy with FOK
For a BUY FOK order,makerAmount is the amount of USDC you are willing to spend:
Sell with FOK
For a SELL FOK order,makerAmount is the number of shares you want to sell:
FOK Parameter Reference
| Parameter | Type | Description |
|---|---|---|
marketSlug | string | Market slug identifier |
tokenId | string | YES or NO token ID from market.positionIds |
side | Side | Side.BUY (0) or Side.SELL (1) |
makerAmount | number | BUY: USDC to spend. SELL: shares to sell. Max 6 decimals. |
orderType | OrderType | OrderType.FOK |
NegRisk Orders
When trading NegRisk markets, always use the submarket slug — not the group slug. Fetch the group to discover submarkets, then fetch the specific submarket to get its token IDs.Cancel Orders
Cancel an open order by its ID:Order States
| State | Description |
|---|---|
OPEN | Order is live on the orderbook |
PARTIALLY_FILLED | Some shares have been matched |
FILLED | Order fully matched |
CANCELLED | Order cancelled by user or system |
REJECTED | Order rejected (insufficient funds, invalid params, etc.) |
Error Handling
The SDK throwsApiError for HTTP-level failures. Inspect status and message for details.
Validation Rules
Price validation
Price validation
Prices must be between 0 and 1 (exclusive). A price of
0.65 means you value the outcome at 65%. Prices outside this range will be rejected by the API.Size validation
Size validation
Size must be a positive number. Fractional sizes are allowed if they align to the shares step (0.001). Max 3 decimal places.