Skip to main content
The events adapter gives you structured access to every HIP-4 prediction market on Hyperliquid. Markets are returned as typed objects with pre-computed coin identifiers so you can go straight from discovery to trading without any manual ID mapping.

Fetch all markets

hip4.events.fetchMarkets() returns a flat HIP4Market[] array covering every outcome in Hyperliquid’s outcomeMeta catalog.

Filter by type

Pass a type filter to narrow results to a specific market category.

Group by type

Use groupBy: "type" to receive a MarketsByType object with one key per market category.

Group multi-outcome markets by question

Multi-outcome markets share a parent question. Grouping by question returns a MarketsByQuestion object keyed by question ID (or "standalone" for outcomes that don’t belong to a multi-outcome question).

Paginate results

Use limit and offset to page through large result sets. Without limit, you get every matching market.
limit and offset apply only to the flat list. When you pass groupBy, the result contains every matching market.

Sort results

Control the order of returned markets with sortBy. When you omit it, markets stay in Hyperliquid’s catalog order (the order of outcomeMeta).
sortBy takes effect from SDK 1.3.0-beta.0. Earlier versions accept the parameter but ignore it.

Template market names

Many markets are created from Hyperliquid’s template registry (outcomeTemplates). Their name, sides[].name, and questionName are the names Hyperliquid sends, such as "template:priceTouch". From SDK 1.3.0, parsedName, sides[].parsedName, and parsedQuestionName carry the names rendered from the registry. Use them for display.
A template question’s fallback outcome has the parsedName "Other". Other markets repeat their name. If the registry can’t be fetched, the parsed names keep the wire names, except that the template: prefix is removed from plain names such as "template:Yes". The original outcome is always available on market.raw. Events, prices, and positions carry the same names: parsedTitle, parsedQuestion, and outcomes[].parsedName from fetchEvents and fetchEvent, outcomes[].parsedName from fetchPrice, and parsedEventTitle, parsedMarketQuestion, and parsedOutcomeName from fetchPositions. Refreshing the market or event cache makes one extra outcomeTemplates request, cached for 30 seconds.

Access typed fields on DefaultBinaryMarket

Each market type exposes fields specific to its category. DefaultBinaryMarket includes the parsed description fields you need for display and filtering.

Fetch events and categories

Markets belong to events. You can query at the event level when you need the event title, description, status, and markets list together.
Event and outcome metadata is cached for 30 seconds. Subsequent calls within that window return the cached result without hitting the network.