Market Data Overview
All market data on Openfish is open to everyone. No API key, no authentication, no wallet required. Data is served from the CLOB server on port 3002 and the Gamma API server.
Base URLs
Section titled “Base URLs”| Service | Base URL | Description |
|---|---|---|
| CLOB Server | https://api.openfish.fun (port 3002) | Prices, order books, WebSocket feeds |
| Gamma API | https://gamma.openfish.fun | Events, markets, metadata, search |
Data Model
Section titled “Data Model”Openfish structures prediction market data around two primary entities:
- Event — A top-level question or topic (e.g., “Will Bitcoin reach $100k by year end?”). An event groups one or more markets.
- Market — An individual tradable binary outcome within an event. Each market maps to a pair of CLOB token IDs, a condition ID, and a market address.
Single-Market vs Multi-Market Events
Section titled “Single-Market vs Multi-Market Events”| Type | Example |
|---|---|
| Single-market event | ”Will BTC hit $100k?” — one market (Yes/No) |
| Multi-market event | ”Who will win the election?” — separate markets per candidate |
Outcomes and Prices
Section titled “Outcomes and Prices”Each market carries outcomes and outcomePrices arrays in a one-to-one correspondence. Prices reflect implied probabilities:
{ "outcomes": ["Yes", "No"], "outcomePrices": ["0.35", "0.65"]}Here, the market prices in a 35% chance of Yes.
Available Endpoints
Section titled “Available Endpoints”Gamma API — Events and Market Discovery
Section titled “Gamma API — Events and Market Discovery”| Endpoint | Description |
|---|---|
GET /events | List events with filtering and pagination |
GET /events/{id} | Get a single event by ID |
GET /markets | List markets with filtering and pagination |
GET /markets/{id} | Get a single market by ID |
GET /public-search | Search across events and markets |
GET /tags | List ranked tags and categories |
GET /sports | Sports metadata |
CLOB Server — Prices and Order Books
Section titled “CLOB Server — Prices and Order Books”| Endpoint | Description |
|---|---|
GET /price | Current price for a single token |
GET /prices | Prices for multiple tokens |
GET /book | Full order book for a token |
GET /prices-history | Historical price series for a token |
GET /midpoint | Midpoint price for a token |
GET /spread | Current spread for a token |
CLOB Server — WebSocket Feeds
Section titled “CLOB Server — WebSocket Feeds”| Endpoint | Description |
|---|---|
GET /ws/market | Real-time order book and trade events |
GET /ws/user | Authenticated order and trade updates |
GET /ws/rtds | Real-time price data streaming |
GET /ws/sports | Live sports score updates |
Gamma Server — Comment WebSocket
Section titled “Gamma Server — Comment WebSocket”| Endpoint | Description |
|---|---|
GET /ws/comments | Real-time comment stream for events |
Quick Start
Section titled “Quick Start”Pull the five highest-volume active events:
curl "https://gamma.openfish.fun/events?active=true&closed=false&order=volume_24hr&ascending=false&limit=5"Grab the order book for a specific token:
curl "https://api.openfish.fun/book?token_id=71321045679252212594626385532706912750332728571942532289631379312455583992563"Rust SDK Example
Section titled “Rust SDK Example”use openfish_client_sdk::GammaClient;
#[tokio::main]async fn main() -> anyhow::Result<()> { let gamma = GammaClient::new("https://gamma.openfish.fun");
// Fetch active events sorted by 24h volume let events = gamma .events() .active(true) .closed(false) .order("volume_24hr") .limit(10) .send() .await?;
for event in &events { println!("{}: {} markets", event.title, event.markets.len()); for market in &event.markets { println!(" {} -- {:?}", market.question, market.outcome_prices); } }
Ok(())}Next Steps
Section titled “Next Steps”- Fetching Markets — Three strategies for discovering and querying markets.
- WebSocket Overview — Real-time streaming feeds.