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:
Level Size and MinSize are in raw 6-decimal units (1 share = 1,000,000); MinSize is a decimal string. Price is not scaled.

Fetching user orders

Use GetUserOrders() to retrieve your open orders on a market (requires authentication):
Sizes and amounts are decimal strings in raw 6-decimal units; divide by 1e6 for shares or USDC. Go SDK v1.1.0 cannot decode a non-empty user-orders response; these fields exist on the SDK after v1.1.0.

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:
Call GetMarket(slug) before placing orders on a market so the venue is cached. Otherwise the OrderClient fetches the market on the first order (logging a warning) and pays one extra round-trip.

Debugging venue cache

Enable LogLevelDebug logging to see venue cache operations:

Complete example