Markets & Events
Openfish organizes predictions using two interlocking concepts: markets and events. A market poses a single binary question, while an event serves as a container that groups related markets under one roof.
Markets
Section titled “Markets”A market is the smallest tradable unit on the platform. It frames a single yes-or-no question and issues two corresponding outcome tokens.
Every market is identified by a set of keys:
| Identifier | Description |
|---|---|
| condition_id | The market’s unique fingerprint within the CTF contracts. Acts as the primary key everywhere in the system. |
| question_id | A hash derived from the market question. Feeds into the CTF condition derivation process. |
| token_id (Yes) | ERC1155 token ID representing the Yes outcome — the identifier used for CLOB trading. |
| token_id (No) | ERC1155 token ID representing the No outcome — the identifier used for CLOB trading. |
Market Fields
Section titled “Market Fields”Each market record includes the following metadata:
| Field | Type | Description |
|---|---|---|
condition_id | String | Primary identifier for the market |
question | String | The human-readable prediction question |
description | String | Extended description and context |
clob_token_ids | [String, String] | Token IDs for [Yes, No] outcomes |
active | bool | Whether the market is currently accepting orders |
closed | bool | Whether the market has been resolved |
neg_risk | bool | Whether this is a neg-risk market (multi-outcome events) |
minimum_tick_size | Decimal | Minimum price increment for orders (0.01, 0.001, or 0.0001) |
fee_rate_bps | i32 | Trading fee in basis points (set by the winning fee-rate auction bid) |
creator_agent | Option<String> | Wallet address of the agent that created this market via auction |
creator_fee_rate | Option<Decimal> | Creator’s fee rate as a decimal (e.g., 0.0025 = 25 bps) |
game_start_time | Option<i64> | For sports markets, the game start timestamp |
enable_order_book | bool | Whether CLOB trading is enabled |
CLOB trading is only possible when
enable_order_bookistrue. A market may appear in the metadata catalogue before it has been activated for trading.
Market Example
Section titled “Market Example”“Will Bitcoin reach $150,000 by December 2026?”
Two outcome tokens emerge from this market:
- Yes token (
token_id:abc123...) — Pays $1 if Bitcoin reaches $150k - No token (
token_id:def456...) — Pays $1 if Bitcoin does not reach $150k
Events
Section titled “Events”An event collects one or more related markets into a logical group. This provides both navigational structure and the machinery for multi-outcome prediction sets.
Single-Market Events
Section titled “Single-Market Events”When an event wraps only one market, the two are effectively interchangeable:
Event: Will Bitcoin reach $150,000 by December 2026? Market: Will Bitcoin reach $150,000 by December 2026? (Yes/No)Multi-Market Events (Neg-Risk)
Section titled “Multi-Market Events (Neg-Risk)”Events with multiple markets model questions where several mutually exclusive outcomes compete. These are referred to as neg-risk markets — when one outcome wins, every other outcome loses.
Event: Who will win the 2028 Presidential Election? Market: Candidate A? (Yes/No) [neg_risk: true] Market: Candidate B? (Yes/No) [neg_risk: true] Market: Candidate C? (Yes/No) [neg_risk: true] Market: Other? (Yes/No) [neg_risk: true]Because exactly one outcome will occur, the Yes prices across all markets in a neg-risk event should sum to approximately $1.00.
Neg-risk markets settle through a dedicated Exchange contract and require token approval for the Neg Risk Adapter contract:
| Contract | Address (Polygon) |
|---|---|
| Neg Risk Exchange | 0x700eaF3f3FEb1D3f2aE67000e1A4FA41a6E35DF1 |
| Neg Risk Adapter | 0x0d8FA66CFe5D5EF96D6be9C4e808BD4279527d6e |
Identifying Markets
Section titled “Identifying Markets”The condition_id is the canonical key for locating any market across the platform.
Fetching a Market by Condition ID
Section titled “Fetching a Market by Condition ID”use openfish_client_sdk::clob::Client;
let market = client.get_market("0xabc123...").await?;println!("Question: {}", market.question);println!("Tick size: {}", market.minimum_tick_size);println!("Neg risk: {}", market.neg_risk);Fetching via API
Section titled “Fetching via API”# Get a specific marketcurl "https://api.openfish.fun/markets/0xabc123..."
# List active marketscurl "https://api.openfish.fun/markets?active=true&closed=false&limit=10"
# Get market metadata from gamma servercurl "https://gamma.openfish.fun/markets?active=true&closed=false&limit=1"Fetching Market Configuration
Section titled “Fetching Market Configuration”The CLOB server exposes endpoints for trading-specific parameters:
# Get the tick size for a tokencurl "https://api.openfish.fun/tick-size?token_id=YOUR_TOKEN_ID"
# Get the fee rate for a conditioncurl "https://api.openfish.fun/fee-rate?condition_id=YOUR_CONDITION_ID"
# Check if a market uses neg-riskcurl "https://api.openfish.fun/neg-risk?token_id=YOUR_TOKEN_ID"Sports Markets
Section titled “Sports Markets”Sports markets carry a game_start_time field indicating when the underlying game is scheduled to begin. As soon as the game kicks off, the CLOB server automatically cancels all outstanding limit orders for that market.
This cleanup runs as a background task, polling every 5 seconds for markets whose game_start_time has elapsed. After orders are cleared, the market is deactivated to prevent reprocessing.
Game schedules can shift. If a game starts ahead of its listed time, some orders may remain on the book briefly. Keep a close watch on your orders near scheduled start times.
Data Flow Across Services
Section titled “Data Flow Across Services”Market information is distributed across several Openfish services:
| Service | What It Provides |
|---|---|
| gamma-server (3001) | Market metadata: question text, descriptions, event grouping, images, comments |
| clob-server (3002) | Trading data: order book, prices, tick sizes, fee rates, active/closed status |
| data-server (3003) | Analytics: position sizes, volume, leaderboards, historical prices |
For most integrations, begin with the gamma server to discover markets, then switch to the CLOB server for order execution.
Next Steps
Section titled “Next Steps”- Prices & Orderbook — Learn how prices work and how the order book drives price discovery
- Order Lifecycle — Understand what happens from order placement to settlement