Skip to content

Fetching Markets

Openfish offers multiple ways to retrieve market data, each suited to different integration patterns. All list endpoints support pagination through limit and offset parameters.

The most direct method. Query the Gamma API for events or markets, applying filters and pagination as needed.

The public app starts from the CLOB Browse API because it includes current Openfish volume, trade counts, creator data, outcome prices, and localization:

Terminal window
curl "https://api.openfish.me/browse/markets?status=LIVE&limit=50"

Use the World Cup topic when you need a game-first view instead of a flat market list:

Terminal window
curl "https://api.openfish.me/browse/topics/world-cup/games?view=list"

The lightweight list view preserves full match rollups but includes only match-result markets, so list pages can subscribe only to winner/draw/away prices. Fetch one full match on demand with eventSlug when the user expands a game.

Terminal window
curl "https://gamma.openfish.me/events?active=true&closed=false&order=volume_24hr&ascending=false&limit=50"

Extract the slug from the Openfish frontend URL:

https://openfish.me/event/btc-100k-by-december
^
Slug: btc-100k-by-december
Terminal window
curl "https://gamma.openfish.me/events?slug=btc-100k-by-december"
Terminal window
# Discover available tags
curl "https://gamma.openfish.me/tags"
# Filter events by tag
curl "https://gamma.openfish.me/events?tag_id=100381&active=true&closed=false&limit=20"
ParameterDescription
activeFilter by active status (true for live tradable events)
closedFilter by closed status (false to exclude resolved markets)
orderSort field: volume_24hr, volume, liquidity, start_date, end_date
ascendingSort direction (true or false, default false)
limitResults per page
offsetNumber of results to skip for pagination
tag_idFilter by category tag
slugLook up by URL slug

Strategy 2: Gamma API Metadata for Rich Context

Section titled “Strategy 2: Gamma API Metadata for Rich Context”

The Gamma API returns full event objects that embed their market arrays. This removes the need for separate market lookups and gives you metadata like descriptions, tags, resolution sources, and token IDs in a single response.

Terminal window
# Single request returns the event and all its markets
curl "https://gamma.openfish.me/events/125819"

Each market object nested inside an event contains:

  • outcomes and outcomePrices arrays
  • tokens array with CLOB token IDs
  • conditionId for market lookup and order routing
  • enableOrderBook flag indicating CLOB availability
use openfish_client_sdk::GammaClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let gamma = GammaClient::new("https://gamma.openfish.me");
// Fetch event with all nested markets
let event = gamma.event_by_id("125819").await?;
println!("Event: {}", event.title);
for market in &event.markets {
println!(" Market: {}", market.question);
println!(" Condition ID: {}", market.condition_id);
println!(" Prices: {:?}", market.outcome_prices);
println!(" Order book enabled: {}", market.enable_order_book);
}
Ok(())
}

For integrations that demand real-time data, connect to the market WebSocket. It delivers price-level deltas, top-of-book updates, trade events, and new-market notifications with no polling involved.

const ws = new WebSocket("wss://api.openfish.me/ws/market");
ws.addEventListener("open", () => {
ws.send(JSON.stringify({
type: "subscribe",
assets_ids: [
"71321045679252212594626385532706912750332728571942532289631379312455583992563",
],
level: 2,
initial_dump: false,
}));
});
ws.addEventListener("message", (message) => {
if (message.data === "PING") {
ws.send("PONG");
return;
}
const event = JSON.parse(message.data);
if (event.type === "price_change" || event.type === "best_bid_ask") {
console.log(event.asset_id, event.best_bid, event.best_ask);
}
});

All list endpoints paginate with limit and offset:

Terminal window
# Page 1
curl "https://gamma.openfish.me/events?active=true&closed=false&limit=50&offset=0"
# Page 2
curl "https://gamma.openfish.me/events?active=true&closed=false&limit=50&offset=50"
# Page 3
curl "https://gamma.openfish.me/events?active=true&closed=false&limit=50&offset=100"

Keep incrementing offset by limit until the response returns fewer items than limit.

StrategyBest ForLatencyComplexity
REST pollingPeriodic snapshots, simple integrationsSecondsLow
Gamma API metadataRich context, event-level viewsSecondsLow
World Cup topicGame-first World Cup viewsCached secondsLow
WebSocket streamingReal-time dashboards, trading botsMillisecondsMedium
  1. Default to active=true&closed=false unless you specifically need resolved or historical markets.
  2. Prefer /browse/markets for Openfish-native app and agent market cards.
  3. Use /browse/topics/world-cup/games when the user experience starts from World Cup dates and games.
  4. Use Gamma events when you need rich imported metadata and event-level context.
  5. For trading bots, load an initial snapshot via REST, then switch to WebSocket streaming for live updates.
  6. Cache Gamma API responses and refresh on a schedule rather than hitting the API on every user interaction.