Skip to main content

Overview

The MarketFetcher class 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 get_active_markets() to retrieve a paginated list of all active markets:
Use pagination parameters to avoid large responses. Start with a small limit and increment page as needed.

Fetching a Single Market

Use get_market(slug) to retrieve full details for a specific market:
The returned Market object is a Pydantic model with the following key fields:
Token IDs are returned as strings. Pass them directly to OrderClient.create_order() as token_id.

Fetching the Orderbook

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

Venue Caching

Every call to get_market() 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 get_market(slug) retrieves and caches the venue:
2

Place an order

The OrderClient automatically looks up the cached venue when you pass market_slug:
You must call get_market(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 DEBUG logging to see venue cache operations:

Complete Example