Hyperliquid Data Feeds for Developers
TL;DR
- - Hyperliquid provides REST and WebSocket APIs for market data, orderbook, and trades
- - The Info API is read-only and requires no authentication
- - WebSocket subscriptions provide real-time L2 orderbook, trades, and candle data
Hyperliquid is a high-performance perpetual futures exchange. Developers access its data through a REST API for queries and a WebSocket API for real-time streaming. The read-only Info API requires no authentication.
API overview
| Endpoint | Purpose | Auth |
|---|---|---|
https://api.hyperliquid.xyz/info | Market data, user state, trade history | No |
wss://api.hyperliquid.xyz/ws | Real-time orderbook, trades, candles | No |
https://api.hyperliquid.xyz/exchange | Order placement, cancellation | Yes (wallet signature) |
Market data
All market metadata
const response = await fetch("https://api.hyperliquid.xyz/info", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ type: "meta" }),
});
const meta = await response.json();
for (const asset of meta.universe) {
console.log(`${asset.name}: ${asset.szDecimals} decimals`);
}
Mid prices
const response = await fetch("https://api.hyperliquid.xyz/info", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ type: "allMids" }),
});
const mids = await response.json();
console.log("BTC mid:", mids["BTC"]);
Real-time data via WebSocket
Orderbook (L2)
const ws = new WebSocket("wss://api.hyperliquid.xyz/ws");
ws.onopen = () => {
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "l2Book", coin: "BTC" },
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.channel === "l2Book") {
const { bids, asks } = data.data.levels;
console.log("Best bid:", bids[0], "Best ask:", asks[0]);
}
};
Trades
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "trades", coin: "BTC" },
}));
Candles
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "candle", coin: "BTC", interval: "1m" },
}));
Available intervals: 1m, 5m, 15m, 1h, 4h, 1d.
Historical data
User trade history
const response = await fetch("https://api.hyperliquid.xyz/info", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "userFills",
user: "0x...",
}),
});
const fills = await response.json();
Funding rate history
const response = await fetch("https://api.hyperliquid.xyz/info", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "fundingHistory",
coin: "BTC",
startTime: Date.now() - 7 * 24 * 3600 * 1000,
}),
});
const fundingHistory = await response.json();
Building a data pipeline
For continuous data collection:
class HyperliquidCollector {
private ws: WebSocket;
private db: Database;
start() {
this.ws = new WebSocket("wss://api.hyperliquid.xyz/ws");
this.ws.onopen = () => {
// Subscribe to all traded coins
for (const coin of this.coins) {
this.ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "trades", coin },
}));
}
};
this.ws.onmessage = async (event) => {
const data = JSON.parse(event.data);
if (data.channel === "trades") {
for (const trade of data.data) {
await this.db.insertTrade({
coin: trade.coin,
side: trade.side,
price: parseFloat(trade.px),
size: parseFloat(trade.sz),
timestamp: trade.time,
});
}
}
};
}
}
Rate limits
- Info API: moderate rate limits, suitable for periodic polling.
- WebSocket: connection limits apply; subscribe to only the channels you need.
- Bulk historical requests should include appropriate delays.
Cache responses for data that does not change frequently (market metadata, asset list).
FAQ
Is Hyperliquid on Solana? Hyperliquid runs its own L1 chain, not on Solana. It is included here because many Solana developers and traders also build on Hyperliquid, and the data access patterns are relevant.
Do I need an API key for reading data? No. The Info API and WebSocket subscriptions are public. Authentication (via EIP-712 wallet signature) is only required for trading operations.
How real-time is the WebSocket data? WebSocket updates are near-real-time, typically sub-second latency from the exchange engine. This is suitable for trading bots and live dashboards.
Can I get historical candle data?
Yes. Use the candleSnapshot Info API request with a time range and interval.
Updated: