Skip to main content

Overview

The MarketFetcher handles market discovery, individual market lookups, and orderbook retrieval. It also automatically caches venue contract addresses needed for order signing.

Setup

Fetching Active Markets

Use GetActiveMarkets() to retrieve a paginated list of all active markets:

Sort Options

Use pagination parameters to avoid large responses. Start with a small Limit and increment Page as needed.

Fetching a Single Market

Use GetMarket() to retrieve full details for a specific market:
The returned Market struct has the following key fields:
Token IDs are returned as strings. Pass them directly to OrderClient.CreateOrder() via FOKOrderArgs or GTCOrderArgs.

Fetching the Orderbook

Use GetOrderBook() to retrieve current bids and asks for a market:

Fetching User Orders

Use GetUserOrders() to retrieve your open orders on a market (requires authentication):

Venue Caching

Every call to GetMarket() automatically caches the venue contract addresses (exchange and adapter) for that market. The OrderClient reads from this cache when signing orders, so you do not need to manage venues manually.
1

Fetch the market

Calling GetMarket() retrieves and caches the venue:
2

Check the cache

You can also access the venue cache directly:
3

Place an order

The OrderClient automatically looks up the cached venue when you pass MarketSlug:
You must call GetMarket(slug) at least once before placing orders on that market. Without a cached venue, the OrderClient cannot determine the correct verifyingContract for EIP-712 signing.

Debugging Venue Cache

Enable LogLevelDebug logging to see venue cache operations:

Complete Example