get_spot_l4_diffs
Retrieve raw order-level changes for Hyperliquid Spot pairs including new orders, modifications, cancellations, and fills. Uses Pro+ data tier for precise market analysis.
Instructions
Get Hyperliquid Spot L4 orderbook diffs (Pro+ tier). Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns raw order-level changes (new orders, modifications, cancellations, fills) over a time range. 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:1417-1425 (registration)Registration of the 'get_spot_l4_diffs' tool via the registerHistoryTool helper. It calls api().spot.l4Orderbook.diffs(coin, params) and uses SpotCoinParam schema with normalizeSpotCoin normalization.
// Spot L4 Orderbook Diffs (Pro+) registerHistoryTool( "get_spot_l4_diffs", "Get Hyperliquid Spot L4 orderbook diffs (Pro+ tier). Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns raw order-level changes (new orders, modifications, cancellations, fills) over a time range. Live from 2026-05-05.", (coin, params) => api().spot.l4Orderbook.diffs(coin, params as any), SpotCoinParam, normalizeSpotCoin ); - src/index.ts:408-438 (helper)The registerHistoryTool helper function that powers the tool registration. It builds the input schema (coin + HistoryParams), resolves time ranges, and calls the provided SDK function with cursor pagination support.
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:77-81 (schema)Input schema for the coin parameter used by get_spot_l4_diffs (SpotCoinParam - dashed canonical pair symbol 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:129-136 (schema)Output schema used by get_spot_l4_diffs (ListOutputSchema - returns records array with count and optional cursor).
const ListOutputSchema: ZodRawShape = { records: z.array(z.record(z.unknown())).describe("Array of result records"), count: z.number().describe("Total number of records in the full result set"), nextCursor: z .string() .optional() .describe("Cursor for next page, if more results available"), }; - src/index.ts:320-322 (helper)Normalization function that uppercases the spot coin symbol before passing to the SDK.
function normalizeSpotCoin(coin: string): string { return coin.toUpperCase(); }