market_orderbook
Retrieve the order book bid and ask depth for any trading pair on Hyperliquid. Analyze liquidity, spread, and support/resistance levels.
Instructions
Get the order book (bid/ask depth) for any trading pair on Hyperliquid. Shows price levels and sizes on both sides. Essential for understanding liquidity, spread, and potential support/resistance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| useToonFormat | No | Return data in compact toon format (default: true). Set to false for standard JSON. | |
| symbol | Yes | Trading pair symbol (e.g. BTC, ETH, SOL). For builder dex markets use prefix:COIN format (e.g. xyz:SILVER, km:OIL, cash:TSLA) | |
| depth | No | Number of price levels on each side |
Implementation Reference
- src/index.ts:30-51 (registration)Free-tier tool registration: market_orderbook is listed as a free tool (no API key needed)
const FREE_TIER_TOOLS = new Set([ 'pulse_global_stats', 'pulse_market_overview', 'list_markets', 'market_price', 'market_orderbook', 'pulse_most_traded_coins', 'live_long_short_ratio', ]); const TOTAL_TOOL_COUNT = 43; if (!API_KEY) { console.error( `WARNING: COINVERSAA_API_KEY not set. Only free-tier tools will be available (${FREE_TIER_TOOLS.size} of ${TOTAL_TOOL_COUNT}). Get a key at https://coinversa.ai/developers` ); } function shouldRegister(toolName: string): boolean { if (API_KEY) return true; return FREE_TIER_TOOLS.has(toolName); } - src/index.ts:770-779 (schema)Tool schema/registration: defines input schema (useToonFormat, symbol, depth) for market_orderbook
if (shouldRegister("market_orderbook")) server.registerTool( "market_orderbook", { description: "Get the order book (bid/ask depth) for any trading pair on Hyperliquid. Shows price levels and sizes on both sides. Essential for understanding liquidity, spread, and potential support/resistance.", inputSchema: { useToonFormat: useToonFormatSchema, symbol: z.string().min(1).max(20).describe("Trading pair symbol (e.g. BTC, ETH, SOL). For builder dex markets use prefix:COIN format (e.g. xyz:SILVER, km:OIL, cash:TSLA)"), depth: z.number().min(1).max(50).default(10).describe("Number of price levels on each side"), }, }, - src/index.ts:780-782 (handler)Handler function: calls API endpoint /market/orderbook/{normalized_symbol} with depth parameter, returns toolResult
async ({ useToonFormat, symbol, depth }) => toolResult(await callAPI(useToonFormat, `/market/orderbook/${normalizeCoin(symbol)}`, { depth: String(depth) })) ); - src/index.ts:84-93 (helper)Helper function: normalizes coin/symbol string used by market_orderbook handler (e.g. 'btc' → 'BTC', 'xyz:silver' → 'xyz:SILVER')
function normalizeCoin(raw: string): string { const idx = raw.indexOf(':'); if (idx !== -1) { // Builder dex format — keep prefix lowercase, uppercase the coin return raw.slice(0, idx).toLowerCase() + ':' + raw.slice(idx + 1).toUpperCase(); } return raw.toUpperCase(); } // ─── API Helper (with timeout + retries + friendly errors) ─