Skip to main content

MarketFetcher Setup

MarketFetcher provides read-only access to market data. No API key is required for public endpoints.

Active Markets

Retrieve a paginated list of currently active markets with optional sorting.

Parameters

Sort Options

Single Market

Fetch a single market by slug. The response includes venue contract addresses and token IDs needed for trading.
getMarket() automatically caches the venue data for the returned market. Subsequent calls for the same slug return the cached result. Always fetch the market before placing orders to ensure the venue is cached.

Market Response Structure

Orderbook

Fetch the current orderbook for a CLOB market. Returns bids, asks, and the current spread.

Orderbook Response Structure

Handling illiquid markets

Markets with empty or one-sided orderbooks can produce misleading midpoint prices. When there are no bids, the midpoint defaults to (0 + bestAsk) / 2, which may show 50% even though no one is actively trading. To detect these markets:

User Orders

Retrieve your open orders for a specific market using the fluent API. Requires an API key.
The getUserOrders() method is available on the market object returned by getMarket(). It requires an authenticated HttpClient (with an API key).

NegRisk Group Markets

NegRisk markets are organized into groups. Each group contains multiple submarkets (outcomes). To trade a specific outcome, fetch the group first, then access the submarket you need.
1

Fetch the NegRisk group

2

Access a submarket

3

Fetch the submarket for token IDs

You must call getMarket() on the submarket slug to get the venue and token IDs required for placing orders.
Always use the submarket slug (not the group slug) when placing orders on NegRisk markets. The group slug does not have token IDs associated with it.

Best Practices

Always call getMarket() before placing orders. The SDK caches venue data (exchange and adapter addresses) internally. This avoids redundant API calls and ensures the OrderClient has the information it needs to sign orders.
For real-time orderbook data, subscribe to WebSocket events rather than polling getOrderBook(). The WebSocket pushes orderbookUpdate events whenever the book changes, reducing latency and API usage. See the WebSocket Streaming guide.
When fetching active markets, always use limit and page parameters. Requesting unbounded result sets can cause timeouts and high memory usage.