Building Market Views
List events, open one with bootstrap, then markets, the orderbook socket, and a quote.
Live discovery and orderbook reads include active venues only. Retired venue identifiers can still appear on historical positions, activity, and claim flows.
Build the screen in this order: list events, load an event, page its markets, then subscribe to prices. See Identifiers for the IDs used at each step.
VenueEvent
└── venueMarkets[] ← this venue's markets, not the other venues
├── venueMarketOutcomes[]
└── matchedVenueMarkets[] ← the same market on the other venuesSibling venues are matchedVenueMarkets[]. They are not extra rows inside the anchor's venueMarkets[]. Field placement is Matched clusters.
List
An unfiltered list returns one row per matched cluster. The embedded venueMarkets array is a preview of up to three markets and is deprecated. Do not render counts from its length. Use marketCount, or the market list below. Prices are not on this response.
import { createAggClient, MarketStatus } from "@agg-build/sdk";
const client = createAggClient({
baseUrl: "https://api.t.sufwankhalid.com",
appId: "YOUR_APP_ID",
});
const { data: events } = await client.getVenueEvents({
status: [MarketStatus.open],
});For a price on the card, collect venueMarketId values and call getMidpoints. The client batches 75 ids. Keep each request under the URL limit on Get live midpoints. See Comparing venue prices for an example. There is no midpoint socket.
Filters on the list include aggKey, grouped, externalIdentifier, and recurrence. externalIdentifier also requires venue.
Open an event
Open the event with bootstrap. The first slice is not every market. Delivery, charts, and search choices are on Market-data API.
const view = await client.getEventBootstrap("EVENT_ID");Get the first useful event view.
Get venue event is the event without that slice. Its embedded venueMarkets array is deprecated.
Markets
The full market list is GET /venue-markets?venueEventId=. cluster=true (the default) covers the matched cluster: every venue's markets, siblings folded onto the anchor row, and matchedVenueMarkets[] still on each row. cluster=false is that one venue event. Only the strings true and false are accepted. Pass the same flag to GET /venue-events/{id} when marketCount has to match the list.
Market filters include aggKey, cluster, and externalIdentifier (venue is required with externalIdentifier). Event filters include aggKey, grouped, externalIdentifier, and recurrence. Both lists are the references above.
Order book
Subscribe with venueMarketOutcomeId using Real-time orderbook.
See Order books for the corresponding REST reads.
Quote
Price the trade from Quotes. The route id is venueMarketOutcomeId.
Deep cost estimate (deepEstimate=true)
One-time setup costs are on the quote. See Quotes.