## limitless{docsify-ignore} **Kind**: global class **Extends**: Exchange * [fetchMarkets](#fetchmarkets) * [fetchEvent](#fetchevent) * [fetchTicker](#fetchticker) * [fetchTickers](#fetchtickers) * [fetchTrades](#fetchtrades) * [fetchOrderBook](#fetchorderbook) * [fetchOHLCV](#fetchohlcv) * [fetchOrders](#fetchorders) * [fetchOpenOrders](#fetchopenorders) * [fetchClosedOrders](#fetchclosedorders) * [fetchOrdersByIds](#fetchordersbyids) * [fetchOrder](#fetchorder) * [fetchAccounts](#fetchaccounts) * [createOrder](#createorder) * [approve](#approve) * [cancelOrder](#cancelorder) * [redeem](#redeem) * [cancelOrders](#cancelorders) * [cancelAllOrders](#cancelallorders) * [fetchMyTrades](#fetchmytrades) * [fetchPositions](#fetchpositions) * [fetchEvents](#fetchevents) ### fetchMarkets{docsify-ignore} fetches all active limitless markets paginated and returns one CCXT market per child market, each containing a list of outcome objects (YES/NO) **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - an array of objects representing market data **See**: https://docs.limitless.exchange/api-reference/markets/get-active-markets | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | | params.query | string | No | a single search query string to filter markets by | | params.queries | Array<string> | No | multiple search query strings (alternative to query) | | params.limit | int | No | max number of markets to collect (defaults to options.fetchMarketsLimit, 1000); caps the pages fetched | ```javascript limitless.fetchMarkets (params?) ``` ### fetchEvent{docsify-ignore} fetches a single prediction-market event by its market slug or address **Kind**: instance method of [limitless](#limitless) **Returns**: object - a [prediction event structure](https://docs.ccxt.com/#/?id=prediction-event-structure) **See**: https://docs.limitless.exchange/api-reference/markets/get-market | Param | Type | Required | Description | | --- | --- | --- | --- | | id | string | Yes | the market slug or address | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchEvent (id, params?) ``` ### fetchTicker{docsify-ignore} fetches the current price and best bid/ask for a single outcome token, combining the market detail and order book endpoints **Kind**: instance method of [limitless](#limitless) **Returns**: object - a [prediction ticker structure](https://docs.ccxt.com/#/?id=prediction-ticker-structure) **See** - https://docs.limitless.exchange/api-reference/markets/get-market - https://docs.limitless.exchange/api-reference/trading/orderbook | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | Yes | unified outcome like TRUMP_OUT_PRESIDENT_2027:YES or an outcome token id | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchTicker (outcome, params?) ``` ### fetchTickers{docsify-ignore} fetches tickers for multiple outcome tokens, grouping requested outcomes by their parent market (two requests per market: detail + order book) **Kind**: instance method of [limitless](#limitless) **Returns**: object - a dictionary of [prediction ticker structures](https://docs.ccxt.com/#/?id=prediction-ticker-structure) indexed by outcome **See** - https://docs.limitless.exchange/api-reference/markets/get-market - https://docs.limitless.exchange/api-reference/trading/orderbook | Param | Type | Required | Description | | --- | --- | --- | --- | | outcomes | Array<string> | Yes | unified outcomes or outcome token ids — required: limitless has no endpoint returning all tickers at once, so an unscoped call is not supported | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchTickers (outcomes, params?) ``` ### fetchTrades{docsify-ignore} fetches recent public trades for a single outcome token from the market events feed **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction trade structures](https://docs.ccxt.com/#/?id=prediction-trade-structure) **See**: https://docs.limitless.exchange/api-reference/trading/market-events | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | Yes | unified outcome like TRUMP_OUT_PRESIDENT_2027:YES or an outcome token id | | since | int | No | timestamp in ms of the earliest trade to fetch | | limit | int | No | the maximum number of trades to return | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchTrades (outcome, since?, limit?, params?) ``` ### fetchOrderBook{docsify-ignore} fetches the order book for a single outcome token, converting 6-decimal USDC sizes to whole units, no outcomes are quoted at 1 - price with the sides swapped **Kind**: instance method of [limitless](#limitless) **Returns**: object - a [prediction order book structure](https://docs.ccxt.com/#/?id=prediction-order-book-structure) **See**: https://docs.limitless.exchange/api-reference/trading/orderbook | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | Yes | unified outcome like TRUMP_OUT_PRESIDENT_2027:YES or an outcome token id | | limit | int | No | not used by limitless fetchOrderBook | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchOrderBook (outcome, limit?, params?) ``` ### fetchOHLCV{docsify-ignore} fetches historical prices for a single limitless market outcome and maps them to OHLCV format, uses the `interval` query parameter and selects the YES/NO series that matches the requested outcome **Kind**: instance method of [limitless](#limitless) **Returns**: Array<Array<int>> - a list of candles ordered as timestamp, open, high, low, close, volume **See**: https://docs.limitless.exchange/api-reference/trading/historical-price | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | Yes | outcome, e.g. "TRUMP_OUT:YES" | | timeframe | string | Yes | the length of time each candle represents | | since | int | No | timestamp in ms of the earliest candle to fetch | | limit | int | No | the maximum number of candles to fetch | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchOHLCV (outcome, timeframe, since?, limit?, params?) ``` ### fetchOrders{docsify-ignore} fetches orders for the authenticated user for a single outcome **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction order structures](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/orders/get-user-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | No | outcome, e.g. "TRUMP_OUT:YES" | | since | int | No | the earliest time in ms to fetch orders for | | limit | int | No | the maximum number of order structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchOrders (outcome?, since?, limit?, params?) ``` ### fetchOpenOrders{docsify-ignore} fetches open orders for the authenticated user for a single outcome **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction order structures](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/orders/get-user-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | No | outcome, e.g. "TRUMP_OUT:YES" | | since | int | No | the earliest time in ms to fetch orders for | | limit | int | No | the maximum number of order structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchOpenOrders (outcome?, since?, limit?, params?) ``` ### fetchClosedOrders{docsify-ignore} fetches closed orders for the authenticated user for a single outcome **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction order structures](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/orders/get-user-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | No | outcome, e.g. "TRUMP_OUT:YES" | | since | int | No | the earliest time in ms to fetch orders for | | limit | int | No | the maximum number of order structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchClosedOrders (outcome?, since?, limit?, params?) ``` ### fetchOrdersByIds{docsify-ignore} fetch orders by the list of order id **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction order structures](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/trading/order-status-batch | Param | Type | Required | Description | | --- | --- | --- | --- | | ids | Array<string> | Yes | list of order id | | outcome | string | No | market outcome, e.g. "TRUMP_OUT:YES" | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchOrdersByIds (ids, outcome?, params?) ``` ### fetchOrder{docsify-ignore} fetches information on an order made by the user **Kind**: instance method of [limitless](#limitless) **Returns**: object - a [prediction order structure](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/trading/order-status-batch | Param | Type | Required | Description | | --- | --- | --- | --- | | id | string | Yes | the order id | | outcome | string | No | market outcome, e.g. "TRUMP_OUT:YES" | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchOrder (id, outcome?, params?) ``` ### fetchAccounts{docsify-ignore} query for account id and info **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [account structures] **See**: https://docs.limitless.exchange/api-reference/portfolio/get-current-profile | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchAccounts (params?) ``` ### createOrder{docsify-ignore} places a limit or market order on limitless for the given outcome token **Kind**: instance method of [limitless](#limitless) **Returns**: object - a [prediction order structure](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/orders/create-order | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | Yes | outcome, e.g. "TRUMP_OUT:YES" | | type | string | Yes | 'limit' or 'market' | | side | string | Yes | 'buy' or 'sell' | | amount | float | Yes | amount of outcome tokens | | price | float | No | limit price (0–1 range) | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.createOrder (outcome, type, side, amount, price?, params?) ``` ### approve{docsify-ignore} sets the on-chain ERC20 collateral (USDC) allowance for the limitless exchange contract on Base, which is required before an EOA maker can place orders ("Insufficient collateral allowance" otherwise). Sends a real on-chain transaction signed with the privateKey and waits for the receipt **Kind**: instance method of [limitless](#limitless) **Returns**: object - the transaction receipt | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra parameters | | params.token | string | No | the collateral token address (default USDC on Base) | | params.spender | string | No | the exchange contract to approve (default the limitless CTF exchange); read from a market's venue when omitted | | params.owner | string | No | the token holder address (default this.walletAddress or the address derived from the privateKey) | | params.amount | float | No | the allowance in USDC (default: unlimited / maxUint256) | | params.rpcUrl | string | No | the Base RPC url to broadcast through | | params.gasLimit | string | No | gas limit hex for the approve tx (default '0x186a0') | ```javascript limitless.approve (params?) ``` ### cancelOrder{docsify-ignore} cancels a single open order by id **Kind**: instance method of [limitless](#limitless) **Returns**: object - a [prediction order structure](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/orders/cancel-order | Param | Type | Required | Description | | --- | --- | --- | --- | | id | string | Yes | order id | | outcome | string | No | outcome, e.g. "TRUMP_OUT:YES" | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.cancelOrder (id, outcome?, params?) ``` ### redeem{docsify-ignore} redeem a resolved winning position back to collateral (gasless — the operator settles on-chain) **Kind**: instance method of [limitless](#limitless) **Returns**: object - the raw redemption response **See**: https://docs.limitless.exchange/api-reference/portfolio/redeem | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | No | a unified outcome on the resolved market to redeem (used to resolve the market conditionId) | | params | object | No | extra parameters specific to the exchange API endpoint | | params.conditionId | string | No | the CTF condition id (bytes32 hex) to redeem directly, instead of resolving it from an outcome | ```javascript limitless.redeem (outcome?, params?) ``` ### cancelOrders{docsify-ignore} cancel multiple orders at the same time **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction order structures](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/trading/cancel-batch | Param | Type | Required | Description | | --- | --- | --- | --- | | ids | Array<string> | Yes | order ids | | outcome | string | No | unified market outcome, default is undefined | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.cancelOrders (ids, outcome?, params?) ``` ### cancelAllOrders{docsify-ignore} cancels all open orders for one market slug **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction order structures](https://docs.ccxt.com/#/?id=prediction-order-structure) **See**: https://docs.limitless.exchange/api-reference/orders/cancel-all-orders | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | No | outcome, e.g. "TRUMP_OUT:YES" | | params | object | No | extra parameters specific to the exchange API endpoint | | params.slug | string | No | the market slug to cancel all orders for | ```javascript limitless.cancelAllOrders (outcome?, params?) ``` ### fetchMyTrades{docsify-ignore} fetch all trades made by the user **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction trade structures](https://docs.ccxt.com/#/?id=prediction-trade-structure) **See**: https://docs.limitless.exchange/api-reference/trades/get-trades | Param | Type | Required | Description | | --- | --- | --- | --- | | outcome | string | No | outcome, e.g. "TRUMP_OUT:YES" | | since | int | No | the earliest time in ms to fetch trades for | | limit | int | No | the maximum number of trades structures to retrieve | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchMyTrades (outcome?, since?, limit?, params?) ``` ### fetchPositions{docsify-ignore} fetches open positions for the authenticated limitless user from the portfolio endpoint **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - a list of [prediction position structures](https://docs.ccxt.com/#/?id=prediction-position-structure) **See**: https://docs.limitless.exchange/api-reference/portfolio/get-positions | Param | Type | Required | Description | | --- | --- | --- | --- | | outcomes | Array<string> | No | filter by outcome ids or outcomes | | params | object | No | extra parameters specific to the exchange API endpoint | ```javascript limitless.fetchPositions (outcomes?, params?) ``` ### fetchEvents{docsify-ignore} fetches prediction-market events matching the given scope (query/queries/tags/eventId/slug — required) and caches their markets and outcomes on the instance **Kind**: instance method of [limitless](#limitless) **Returns**: Array<object> - an array of event structures **See**: https://docs.limitless.exchange/api-reference/markets/search | Param | Type | Required | Description | | --- | --- | --- | --- | | params | object | No | extra exchange-specific parameters | | params.query | string | No | a single search term; an eventId/slug does a direct lookup and tags resolve to limitless categories, paging only those categories' listings | | params.queries | Array<string> | No | multiple search terms (alternative to query) | | params.tags | Array<string> | No | category names to scope by (matched against GET /categories, e.g. ['crypto']) | | params.eventId | string | No | direct lookup by market address or slug | | params.limit | int | No | maximum number of markets per query, defaults to 50 | ```javascript limitless.fetchEvents (params?) ```