Skip to content

Hyperliquid Data Source

Hyperliquid is the source of truth for the tradable asset universe and the main asset-level market context.

The backend stores all supported Hyperliquid assets, including perps and spot-style markets. Generic HIP-3 category exposure is intentionally out of scope for the product picker.

Hyperliquid ingestion flow

What We Store

ChannelTableOriginCadence / granularityPurpose
Mid priceshyperliquid_mid_pricesSourceallMids stream bucketed at 5sShort-horizon price context
OHLC candleshyperliquid_candlesSourcecandle WebSocket at 1mReal OHLC rows for chart/context reads
OHLC rollupshyperliquid_candlesDerived1h from 1m candlesLarger windows without extra source subscriptions
Liquidity profilehyperliquid_liquidity_profilesSource-derived from L2 snapshots5mSpread, depth, and imbalance
Funding pressurehyperliquid_funding_pressureSource-derived from perp context5mFunding, open interest, crowding
Volatility profilehyperliquid_volatility_profilesDerived5mRealized volatility and jumpiness
Positioning pressurehyperliquid_positioning_pressureDerived5mComposite direction/crowding signal

Price Policy

Use two price paths:

text
allMids stream
  -> 5-second midpoint buckets
  -> hyperliquid_mid_prices

1m candle WebSocket subscriptions
  -> real OHLC rows
  -> hyperliquid_candles
  -> local 1h rollups

This avoids the REST candleSnapshot rate-limit problem for the full asset universe. Larger chart intervals should be derived locally from 1-minute candles instead of subscribing to every interval.

How We Fetch Data

Configured endpoints:

ConfigDefault
HYPERLIQUID_WS_URLwss://api.hyperliquid.xyz/ws
HYPERLIQUID_INFO_URLhttps://api.hyperliquid.xyz/info

Streaming price data uses one WebSocket connection:

json
{
  "method": "subscribe",
  "subscription": { "type": "allMids" }
}

That message returns all midpoint prices in one stream payload. We parse channel: "allMids" messages and store compact 5-second buckets in hyperliquid_mid_prices.

For OHLC, we subscribe to 1-minute candle streams per active supported symbol:

json
{
  "method": "subscribe",
  "subscription": {
    "type": "candle",
    "coin": "BTC",
    "interval": "1m"
  }
}

We parse channel: "candle" messages and store 1-minute rows in hyperliquid_candles. Larger intervals are derived locally from those rows.

Registry and feature inputs use HTTP POST to HYPERLIQUID_INFO_URL:

Request bodyUsed for
{ "type": "meta" }Perp universe and symbols
{ "type": "spotMeta" }Spot-style universe, display names, search terms
{ "type": "metaAndAssetCtxs" }Perp contexts, active status, open interest inputs
{ "type": "predictedFundings" }Predicted funding rows
{ "type": "l2Book", "coin": "BTC" }L2 book snapshot for liquidity profile

The client still has a candleSnapshot helper for probes/backfills, but the runtime price ingestor should not use it for the full universe because it becomes request-heavy.

Current hot retention:

DataRetention
5s mid-price buckets30 minutes
1m OHLC source candles24 hours
1h OHLC rollups7 days
5m feature profiles7 days

Asset Registry

hyperliquid_assets stores the supported-market registry:

  • Exchange symbol.
  • Display name and search terms.
  • Asset kind: perp, spot, or unknown.
  • Category/subcategory metadata for the picker.
  • Coverage flags for prices, candles, profiles, and trading.

Runtime ingestion refreshes the registry from Hyperliquid metadata and stream-discovered symbols. Product selection should read this registry instead of inferring support from observation rows.

Trading Context

Trading prompts can request Hyperliquid context per enabled asset:

  • Recent mids for the freshest short-horizon move.
  • OHLC candles for chart structure.
  • Liquidity profile for tradability and slippage risk.
  • Funding pressure for crowded perp positioning.
  • Volatility profile for regime and sizing.
  • Positioning pressure for composite market state.

Local Commands

bash
cd services/market-backend
npm run hyperliquid:assets
npm run hyperliquid:candles -- --duration-ms=70000
npm run hyperliquid:features
npm run hyperliquid:maintain