get_spot_orderbook
Get the current Hyperliquid Spot L2 orderbook snapshot for a pair, returning bids, asks, mid price, and spread. Optionally set depth per side.
Instructions
Get the current Hyperliquid Spot L2 orderbook snapshot for a pair. Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns bids, asks, mid price, and spread. Optionally specify depth (price levels per side). Live from 2026-05-05. Pro+ tier required for full depth.
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. | |
| depth | No | Orderbook depth — number of price levels per side |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Result data object |
Implementation Reference
- src/index.ts:1332-1338 (registration)Registration of the 'get_spot_orderbook' tool using the registerOrderbookTool helper. Passes the coin to api().spot.orderbook.get() with optional depth. Uses SpotCoinParam schema and normalizeSpotCoin normalizer.
registerOrderbookTool( "get_spot_orderbook", "Get the current Hyperliquid Spot L2 orderbook snapshot for a pair. Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns bids, asks, mid price, and spread. Optionally specify depth (price levels per side). Live from 2026-05-05. Pro+ tier required for full depth.", (coin, params) => api().spot.orderbook.get(coin, params), SpotCoinParam, normalizeSpotCoin ); - src/index.ts:77-81 (schema)Input schema for the coin parameter, which accepts dashed canonical spot 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:98-101 (schema)Input schema for the optional depth parameter (number of price levels per side).
const DepthParam = z .number() .optional() .describe("Orderbook depth — number of price levels per side"); - src/index.ts:387-405 (helper)Helper function that handles the common pattern for registering an orderbook tool. Normalizes the coin, passes optional depth to the SDK call, and wraps the response via formatResponse.
function registerOrderbookTool( name: string, description: string, sdkCall: (coin: string, params?: { depth?: number }) => Promise<unknown>, coinSchema: z.ZodString, normFn: (coin: string) => string ): void { registerTool( name, description, { coin: coinSchema, depth: DepthParam }, ObjectOutputSchema, async (params) => { const sdkParams = params.depth ? { depth: params.depth } : undefined; const data = await sdkCall(normFn(params.coin), sdkParams); return formatResponse(data); } ); } - src/index.ts:320-322 (helper)Normalization helper that uppercases the spot coin symbol before passing it to the SDK.
function normalizeSpotCoin(coin: string): string { return coin.toUpperCase(); }