orderbook_getBookRange - Historical Order Book Range
Retrieve paginated historical Hyperliquid l2Book or l4Book state for a market and block range from the Dwellir Hyperliquid Index.
Use orderbook_getBookRange for historical backfills. It returns paginated book objects over a bounded Hyperliquid block range, billed by the number of book objects returned.
Endpoints
REST:
GET https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook/rangeJSON-RPC:
POST https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpcParameters
| Field | Type | Required | Description |
|---|---|---|---|
type | string | yes | l2Book for aggregated levels or l4Book for order-level data. |
coin | string | yes | Trading pair symbol, for example BTC, ETH, xyz:MSTR, @150, or #31. |
startBlock | number | yes | Inclusive first Hyperliquid block. |
endBlock | number | yes | Inclusive final Hyperliquid block. |
pageSize | number | no | Returned book objects per page. Defaults to 20, max 100. |
cursor | string | no | Cursor returned by the previous page. |
nSigFigs | number | no | L2 price aggregation significant figures. Applies only to l2Book. |
nLevels | number | no | L2 levels per side. Use 1 for BBO. Applies only to l2Book. |
l4Book returns the full reconstructed order-level book and does not accept nLevels, nSigFigs, mantissa, or limit. Orderbook range pagination uses pageSize; limit is not accepted as an orderbook depth or page-size parameter.
REST Example
curl "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook/range?type=l2Book&coin=BTC&startBlock=985450000&endBlock=985480000&pageSize=100&nSigFigs=5&nLevels=20"Follow-up page:
curl "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/v1/orderbook/range?type=l2Book&coin=BTC&startBlock=985450000&endBlock=985480000&pageSize=100&nSigFigs=5&nLevels=20&cursor=985451000"JSON-RPC Example
curl -X POST "https://api-hyperliquid-index.n.dwellir.com/YOUR_API_KEY/jsonrpc" \
-H "content-type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "orderbook_getBookRange",
"params": {
"type": "l2Book",
"coin": "BTC",
"startBlock": 985450000,
"endBlock": 985480000,
"pageSize": 100,
"nSigFigs": 5,
"nLevels": 20
}
}'Response
The first page includes the reconstructed book at startBlock, then subsequent reconstructed books at changed blocks through endBlock. Follow-up pages pass cursor=nextCursor and return changed blocks strictly after that cursor.
{
"data": [
{
"type": "l2Book",
"coin": "BTC",
"blockNumber": 985450000,
"bids": [{ "px": "81016", "sz": "1.2", "n": 3 }],
"asks": [{ "px": "81017", "sz": "0.8", "n": 2 }]
}
],
"nextCursor": "985451000",
"hasMore": true
}Each object in data is the same book object returned by orderbook_getBook.
Billing
Range pages bill by the number of book objects in data, not as one flat request. A page with 100 books bills as 100 responses/API credits. Empty successful pages and error responses are not charged.