The Events Adapter (Documentation Index
Fetch the complete documentation index at: https://docs.outcome.xyz/llms.txt
Use this file to discover all available pages before exploring further.
adapter.events) is your entry point for discovering what is tradeable on HIP-4. It maps raw Hyperliquid outcome metadata into structured PredictionEvent objects and typed HIP4Market objects, enriching each with live midpoint prices. Results are cached for 30 seconds, so repeated calls within that window return immediately without hitting the API.
fetchEvents(params?)
Returns a paginated, optionally filtered list of prediction events. Internally, the adapter fetches outcomeMeta and allMids in parallel, builds events from the metadata, and enriches outcome prices from the mids response.
Parameters
Filter events by category slug. Pass
"custom" or "recurring". Passing "all" is treated as no filter.When
true, only events with status === "active" are returned.Maximum number of events to return.
Pagination offset. Applied after category, active, and query filters.
Case-insensitive search string matched against event
title and description.Return type
Promise<PredictionEvent[]>
Event identifier. Prefix
q for question-based events (e.g. "q5"); prefix o for standalone outcome events (e.g. "o1338").Human-readable event title.
Event description text.
Category slug:
"custom" or "recurring".Markets belonging to this event. Each market corresponds to one HIP-4 outcome.
"active" | "pending_resolution" | "resolved" | "cancelled"Expiry date string. Populated for recurring markets; empty string otherwise.
Cumulative volume across all markets. Always
"0" in the current implementation.Example
fetchEvent(eventId)
Fetches a single event by its ID. Loads the full event list via the cache and finds the match. Throws if the event is not found.
Parameters
The event ID to look up. Use
q{n} for question-based events or o{n} for standalone outcome events.Return type
Promise<PredictionEvent> - same shape as each element returned by fetchEvents.
Throws "HIP-4 event not found: {eventId}" if the ID does not match any event.
Example
fetchCategories()
Returns the list of available event categories. This call is synchronous under the hood - no API request is made.
Return type
Promise<PredictionCategory[]>
The response always contains exactly two entries:
id | name | slug |
|---|---|---|
custom | Custom | custom |
recurring | Recurring | recurring |
Example
fetchMarkets(params?)
Returns typed HIP4Market objects for all HIP-4 outcomes. Each market is classified into one of four types based on the outcome’s metadata, and carries pre-computed side coin identifiers ready for order placement.
The return type changes depending on whether you pass groupBy:
groupBy value | Return type |
|---|---|
| (none) | HIP4Market[] |
"type" | MarketsByType |
"question" | MarketsByQuestion |
Parameters
Filter to a single market type. One of
"defaultBinary", "labelledBinary", "multiOutcome", "priceBucket".Sort order.
"newest" | "volume" | "expiry".Group the results.
"type" returns a MarketsByType object keyed by market type. "question" returns a MarketsByQuestion object keyed by question ID (or "standalone" for unattached outcomes).Maximum number of markets to return (applied after filtering).
Pagination offset.
Market types
All four types extend a sharedBaseMarket with these fields:
| Field | Type | Description |
|---|---|---|
type | MarketType | Discriminant: "defaultBinary" | "labelledBinary" | "multiOutcome" | "priceBucket" |
outcomeId | number | Hyperliquid outcome ID |
name | string | Human-readable name |
description | string | Description text |
sides | [MarketSide, MarketSide] | Both tradeable sides with pre-computed identifiers |
raw | HLOutcome | Raw Hyperliquid API response for escape-hatch access |
MarketSide exposes:
| Field | Type | Description |
|---|---|---|
name | string | Human-readable side name (e.g. "Yes", "No") |
coinNum | number | outcomeId * 10 + sideIndex |
coin | string | Coin string for API calls (e.g. "#5160") |
asset | number | Order asset ID (100_000_000 + coinNum) |
Examples
When using
groupBy, limit and offset apply to the flat list before grouping. The resulting grouped object may therefore contain fewer items than limit if the outcomes span multiple groups.