get_orderbook
Retrieve real-time orderbook data for a specific cryptocurrency symbol on Bybit exchange. Specify the category (spot, linear, inverse) and symbol to access bid and ask prices with customizable depth for informed trading decisions.
Instructions
Get orderbook data for a specific symbol
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | Category (spot, linear, inverse, etc.) | |
| limit | No | Number of orderbook entries to retrieve | |
| symbol | Yes | Symbol (e.g., BTCUSDT) |
Implementation Reference
- src/bybit-service.ts:141-143 (handler)Core handler function that executes the tool logic by calling Bybit's /v5/market/orderbook API endpoint via makeBybitRequest.async getOrderbook(category: string, symbol: string, limit: number = 50): Promise<BybitResponse<OrderbookData> | { error: string }> { return this.makeBybitRequest('/v5/market/orderbook', 'GET', { category, symbol, limit }); }
- src/index.ts:66-84 (schema)Input schema definition for the get_orderbook tool, specifying parameters category, symbol (required), and optional limit.inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category (spot, linear, inverse, etc.)', }, symbol: { type: 'string', description: 'Symbol (e.g., BTCUSDT)', }, limit: { type: 'number', description: 'Number of orderbook entries to retrieve', default: 50, }, }, required: ['category', 'symbol'], },
- src/index.ts:722-736 (registration)Tool call dispatcher/registration in the CallToolRequestSchema handler that invokes the BybitService.getOrderbook method and formats the response.case 'get_orderbook': { const result = await this.bybitService.getOrderbook( typedArgs.category, typedArgs.symbol, typedArgs.limit ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:63-85 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'get_orderbook', description: 'Get orderbook data for a specific symbol', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category (spot, linear, inverse, etc.)', }, symbol: { type: 'string', description: 'Symbol (e.g., BTCUSDT)', }, limit: { type: 'number', description: 'Number of orderbook entries to retrieve', default: 50, }, }, required: ['category', 'symbol'], }, },
- src/types.ts:30-36 (schema)TypeScript interface defining the structure of the orderbook response data.export interface OrderbookData { symbol: string; bids: [string, string][]; asks: [string, string][]; ts: number; u: number; }