概述
Hyperliquid provides several data streams that contain different types of blockchain and exchange events. These streams are available through both gRPC Streaming API and JSON-RPC/WebSocket APIs, allowing you to access real-time and historical data.
可用数据流
| Stream Type | 描述 | API Availability | 主要用例 |
|---|---|---|---|
| 行业 | All executed trades with price, size, and direction | gRPC + JSON-RPC/WSS | Trading analytics, price tracking |
| 订单 | Order lifecycle events (18+ status types including fills, cancellations) | gRPC + JSON-RPC/WSS | Order management, execution monitoring |
| BOOK_UPDATES | Order book changes with bid/ask prices and quantities | gRPC + JSON-RPC/WSS | Market depth analysis, liquidity monitoring |
| TWAP | TWAP execution data and algorithm progress | gRPC + JSON-RPC/WSS | Algorithmic trading, execution analytics |
| 活动 | Balance changes, transfers, deposits, withdrawals, vault operations, funding payments, and priority gas auction fees | gRPC + JSON-RPC/WSS | Fund flow analysis, account monitoring |
| WRITER_ACTIONS | HyperCore ↔ HyperEVM asset transfers and bridge data | gRPC + JSON-RPC/WSS | Cross-environment asset tracking, DeFi analytics |
| BLOCKS | Raw HyperCore blockchain data exposing replica_cmds (all transaction types), filterable by action type or user | gRPC only | Blockchain analysis, data archiving |
| StreamL2Book | Aggregated price levels - total size and order count per price, full snapshot every block | gRPC only | Market depth, spread monitoring, analytics dashboards |
| StreamL4Book | Individual order granularity - every resting order with user, oid, size, triggers, timestamps | gRPC only | HFT, quant trading, MEV, microstructure analysis |
| StreamBboBook | 委托单顶部的最佳买价/卖价,仅在BBO发生变化时输出 | gRPC only | Live prices, spread monitoring, tickers |
| StreamL2BookDiff | 基于单枚代币序列号的L2价格水平增量变化 | gRPC only | Efficient local order book maintenance |
| StreamL4BookUpdates | 按订单类型编写的添加/更新/删除差异 | gRPC only | Per-order book tracking, microstructure analysis |
| StreamTpslUpdates | 基于未平仓订单快照的触发(TP/SL)订单添加/删除更新 | gRPC only | Trigger-order heatmaps, stop monitoring, alerting |
| MEMPOOL_TXS | Pending mempool transactions before block confirmation | gRPC only | MEV detection, transaction monitoring, pre-confirmation analysis |
| ORDER_PRIORITY | Normalized priority-fee order events from mempool and confirmed block sources | gRPC only | Priority-fee order flow monitoring, fee analysis |
| GOSSIP_PRIORITY | Normalized gossip/read-priority bid events from mempool and confirmed block sources | gRPC only | Gossip-priority auction monitoring, read-priority analysis |
Stream Filtering
All Hyperliquid data streams support powerful filtering capabilities to help you receive only the data you need. Without filtering, streaming can generate massive amounts of data. Filters allow you to focus on specific trading pairs, users, event types, and more.
Key Benefits:
- Reduced bandwidth - Receive only relevant data instead of processing everything
- Focused applications - Build targeted apps without overwhelming data streams
- Real-time efficiency - Process specific events faster for alerts and decision making
Example filters (WebSocket):
{
"streamType": "trades",
"filters": {
"coin": ["BTC", "ETH"], // Only BTC and ETH trades
"side": ["B"], // Only buy orders
"user": ["0x123..."] // Only specific user's trades
}
}
Complete Filtering Guide - Detailed documentation with syntax, examples, and field references for all stream types.
Stream Structure
All data streams follow a consistent structure:
{
"local_time": "2025-12-04T17:52:45.734593237",
"block_time": "2025-12-04T17:52:45.554315846",
"block_number": 817863403,
"events": [
// Array of events specific to the stream type
]
}
Common Fields
| 字段 | 类型 | 描述 |
|---|---|---|
| local_time | 字符串 | Local server timestamp in ISO 8601 format |
| block_time | 字符串 | Blockchain block timestamp in ISO 8601 format |
| block_number | 整数 | Sequential block number on Hyperliquid chain |
| 活动 | 数组 | Array of events specific to the stream type |
Data Stream Details
Each data stream has its own unique event structure and use cases:
- Stream Filtering - Complete guide to filtering all stream types with syntax and examples
- Trades - Executed trade data with maker/taker information
- Orders - Complete order lifecycle tracking with 18+ status types
- Book Updates - Real-time order book changes for market depth analysis
- TWAP - Time-weighted average price execution tracking
- Events - Balance changes, transfers, deposits, withdrawals, and vault operations
- Writer Actions - HyperCore ↔ HyperEVM asset transfers and bridge data
- Blocks - Raw blockchain data (gRPC only)
- StreamL2Book - Aggregated price-level depth, full snapshot every block (gRPC only)
- StreamL4Book - Individual order granularity with snapshot + diffs (gRPC only)
- StreamBboBook - Top-of-book best bid/ask, emitted only on change (gRPC only)
- StreamL2BookDiff - Incremental L2 price-level changes with sequence numbers (gRPC only)
- StreamL4BookUpdates - Typed per-order add/update/remove diffs (gRPC only)
- StreamTpslUpdates - Trigger (TP/SL) order add/remove updates (gRPC only)
- MEMPOOL_TXS - Pending mempool transactions before block confirmation (gRPC only)
- ORDER_PRIORITY - Normalized priority-fee order events from mempool and confirmed block sources (gRPC only)
- GOSSIP_PRIORITY - Normalized gossip/read-priority bid events from mempool and confirmed block sources (gRPC only)
Access Methods
gRPC 流式传输 API
All streams are available via the gRPC Streaming API for high-performance, real-time data access:
// Subscribe to trades stream
subscribe: {
stream_type: 'TRADES',
filters: {
"coin": {"values": ["BTC", "ETH"]},
"user": {"values": ["0x123..."]}
}
}
JSON-RPC API
Historical data access via JSON-RPC methods:
# Get latest blocks
curl -X POST https://your-endpoint.hype-mainnet.quiknode.pro/your-token/hypercore \
-d '{"method": "hl_getLatestBlocks", "params": {"stream": "trades", "count": 10}}'
# Get specific block
curl -X POST https://your-endpoint.hype-mainnet.quiknode.pro/your-token/hypercore \
-d '{"method": "hl_getBlock", "params": ["trades", 817863403]}'
WebSocket API
Real-time subscriptions via WebSocket:
// Subscribe to trades
ws.send(JSON.stringify({
"method": "hl_subscribe",
"params": {"streamType": "trades"}
}));
// Subscribe to orders
ws.send(JSON.stringify({
"method": "hl_subscribe",
"params": {"streamType": "orders"}
}));