get_spot_l4_orderbook_history
Retrieve periodic full order-level orderbook snapshots for a Hyperliquid Spot symbol over a time range to reconstruct the L4 orderbook history.
Instructions
Get Hyperliquid Spot L4 orderbook checkpoints (Build+ tier). Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns periodic full order-level orderbook snapshots over a time range for reconstruction. Live from 2026-05-05.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Hyperliquid Spot dashed canonical pair symbol (e.g. 'HYPE-USDC', 'PURR-USDC'). 294 pairs available. The server resolves the dashed form to Hyperliquid's wire format ('PURR/USDC', '@107') internally. Use get_spot_pairs to list all. | |
| start | No | Start timestamp (Unix ms or ISO). Defaults to 24h ago. | |
| end | No | End timestamp (Unix ms or ISO). Defaults to now. | |
| limit | No | Max records to return (default 100, max 1000) | |
| cursor | No | Pagination cursor from previous response's nextCursor |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| records | Yes | Array of result records | |
| count | Yes | Total number of records in the full result set | |
| nextCursor | No | Cursor for next page, if more results available |
Implementation Reference
- src/index.ts:1427-1435 (registration)Registration of the 'get_spot_l4_orderbook_history' tool using registerHistoryTool, which calls api().spot.l4Orderbook.history(coin, params).
// Spot L4 Orderbook History / Checkpoints (Build+) registerHistoryTool( "get_spot_l4_orderbook_history", "Get Hyperliquid Spot L4 orderbook checkpoints (Build+ tier). Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns periodic full order-level orderbook snapshots over a time range for reconstruction. Live from 2026-05-05.", (coin, params) => api().spot.l4Orderbook.history(coin, params as any), SpotCoinParam, normalizeSpotCoin ); - src/index.ts:77-81 (schema)SpotCoinParam schema — validates the coin parameter for spot tools (dashed canonical pair symbols like 'HYPE-USDC').
const SpotCoinParam = z .string() .describe( "Hyperliquid Spot dashed canonical pair symbol (e.g. 'HYPE-USDC', 'PURR-USDC'). 294 pairs available. The server resolves the dashed form to Hyperliquid's wire format ('PURR/USDC', '@107') internally. Use get_spot_pairs to list all." ); - src/index.ts:320-322 (helper)normalizeSpotCoin helper — uppercase normalization for spot coin symbols.
function normalizeSpotCoin(coin: string): string { return coin.toUpperCase(); } - src/index.ts:407-438 (helper)registerHistoryTool — the generic registration helper that sets up cursor-paginated history tools with coin, time range, limit, cursor, and extra params. This is what get_spot_l4_orderbook_history uses.
// Pattern 4: History with cursor pagination (coin + time range) function registerHistoryTool( name: string, description: string, sdkCall: (coin: string, params: Record<string, unknown>) => Promise<{ data: unknown; nextCursor?: string }>, coinSchema: z.ZodString, normFn: (coin: string) => string, extraSchema?: ZodRawShape ): void { const schema: ZodRawShape = { coin: coinSchema, ...HistoryParams }; if (extraSchema) Object.assign(schema, extraSchema); registerTool(name, description, schema, ListOutputSchema, async (params) => { const { coin, start, end, limit, cursor, ...extra } = params; const timeRange = resolveTimeRange(start, end); const sdkParams: Record<string, unknown> = { ...timeRange, limit: resolveLimit(limit), }; if (cursor) sdkParams.cursor = cursor; // Pass through extra params (interval, side, etc.) for (const [k, v] of Object.entries(extra)) { if (v !== undefined) sdkParams[k] = v; } const result = await sdkCall(normFn(coin), sdkParams); return formatCursorResponse(result); }); } - src/index.ts:282-290 (helper)formatCursorResponse — formats paginated cursor responses, used by registerHistoryTool handler.
function formatCursorResponse(result: { data: unknown; nextCursor?: string; }): McpContent { return formatResponse(result.data, { nextCursor: result.nextCursor, paginated: true, }); }