get_orderbook
Retrieve real-time order book depth data for a specified trading symbol on Bybit, providing bid and ask price levels with quantities to analyze market liquidity and price discovery.
Instructions
Get the order book depth for a trading symbol
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| limit | No |
Implementation Reference
- src/client.ts:35-46 (handler)Core handler function that executes the logic for fetching the order book from Bybit API using RestClientV5.async getOrderBook(symbol: string, limit: number = 25) { try { const response = await this.client.getOrderbook({ category: 'spot', symbol: symbol, limit: limit }); return response; } catch (error) { throw new Error(`Failed to get order book for ${symbol}: ${error instanceof Error ? error.message : JSON.stringify(error)}`); } }
- src/server.ts:62-67 (handler)MCP server dispatch handler for 'get_orderbook' tool call, delegating to BybitClient.getOrderBook.case 'get_orderbook': result = await this.client.getOrderBook( args.symbol as string, args.limit as number ); break;
- src/tools.ts:24-32 (registration)Registration of the 'get_orderbook' tool in the MCP tools array, including name, description, and input schema.{ name: 'get_orderbook', description: 'Get the order book depth for a trading symbol', inputSchema: { type: 'object', properties: OrderBookSchema.shape, required: ['symbol'] } },
- src/types.ts:30-33 (schema)Zod schema definition for input validation of the get_orderbook tool (symbol and optional limit).export const OrderBookSchema = z.object({ symbol: z.string().describe('Trading symbol (e.g., BTCUSDT)'), limit: z.number().min(1).max(500).optional().describe('Number of entries to return (default: 25)') });