Skip to content

v3.21.0

Latest

Choose a tag to compare

@0237h 0237h released this 18 Jun 14:00
· 1 commit to main since this release
4734c32

Adds the HIP-4 outcome market family on Hyperliquid, normalizes the response shape across the new /outcomes/* endpoints, and tightens a few existing surfaces.

Breaking changes

/v1/hyperliquid/markets — volume / count semantics

buy_volume_24h / sell_volume_24h now report taker-aggressor notional only (previously combined taker + maker on the matched side). volume_24h is the true matched total and trades_24h is the true match count.

Field Before After
buy_volume_24h bid-side notional taker buys (aggressor on the ask)
sell_volume_24h ask-side notional taker sells (aggressor on the bid)
volume_24h sum of both sides (≈ 2× true) true matched volume
trades_24h row count (≈ 2× true) true match count

/v1/hyperliquid/markets/ohlc, /markets/liquidations/ohlc, /platform

Same taker-derived swap as /markets, applied to the equivalent fields on each. The redundant buys / sells columns are removed from the response — after the fix both equalled the match count, so they carried no information.

/v1/hyperliquid/markets — nullable funding fields for spot rows

open_interest, funding_rate, and funding_snapshot_time now return null for spot markets (which have no funding data), instead of the sentinels 0 / 0 / 1970-01-01 00:00:00. Perp markets are unchanged.

// before
{ "coin": "@107", "dex": "spot", "open_interest": 0, "funding_rate": 0, "funding_snapshot_time": "1970-01-01 00:00:00" }
// after
{ "coin": "@107", "dex": "spot", "open_interest": null, "funding_rate": null, "funding_snapshot_time": null }

New endpoints

Six new HIP-4 outcome endpoints under /v1/hyperliquid/outcomes/*:

Endpoint Description
GET /v1/hyperliquid/outcomes Outcome universe with per-leg price, 24h volume, and 24h price change
GET /v1/hyperliquid/outcomes/ohlc Per-leg OHLCV candles
GET /v1/hyperliquid/outcomes/trades Taker fills feed (BUY/SELL + optional composition events)
GET /v1/hyperliquid/outcomes/users Per-user-per-outcome P&L and volume rollup; leaderboard mode when filtered by outcome/question
GET /v1/hyperliquid/outcomes/users/positions Current share holdings per (user, leg) — open balances only
GET /v1/hyperliquid/outcomes/users/activity Composition-event feed (SPLIT_OUTCOME, MERGE_OUTCOME, MERGE_QUESTION, NEGATE_OUTCOME, SETTLEMENT)

Outcome coins use the #<outcome_id*10 + side_index> encoding (e.g. #1720 = outcome 172, Yes leg; #1721 = outcome 172, No leg). Outcome coins and dex=outcome are rejected on the regular /markets/* and /users/* endpoints — use the dedicated /outcomes/* family.

Response shape on /outcomes/*

Every /outcomes/* response (except /outcomes itself, which remains the canonical full-metadata source) embeds a compact outcome context object:

  • OutcomeContext on /outcomes/users (aggregates collapse legs): outcome_id, outcome_name, question_id, question_name, status, settle_fraction.
  • OutcomeLegContext on per-leg endpoints (/outcomes/ohlc, /outcomes/trades, /outcomes/users/positions, /outcomes/users/activity): the above plus coin, side_index, side_label.

settle_fraction follows the HIP-4 spec — a value in [0, 1] representing the Yes share's payout at settlement. null until status='settled'.

Additive filters and modes (non-breaking)

  • ?direction=… (CSV) on /outcomes/trades, /markets/activity, and /markets/liquidations, each with an endpoint-specific enum.
  • ?sort_by=… on /outcomes (volume_24h, last_trade, outcome_id) and /outcomes/users (total_volume, transactions, realized_pnl).
  • ?include_fallback=true on /outcomes exposes each multi-outcome question's catch-all leg (off by default).
  • ?coin is a valid scope on /outcomes/users/positions and /outcomes/users/activity, in line with outcome_id and question_id.
  • ?user is optional on /outcomes/users — when omitted, the response is a leaderboard for the given ?outcome_id / ?question_id scope, sorted by sort_by desc.

🤖 Generated with Claude Code