Skip to main content
Glama

get_kline

Retrieve candlestick (K-line) data for specific assets on Bybit, including historical price details, time intervals, and customizable start/end times for analysis and trading strategies.

Instructions

Get K-line (candlestick) data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory (spot, linear, inverse, etc.)
endNoEnd time in milliseconds
intervalYesTime interval (1, 3, 5, 15, 30, 60, 120, 240, 360, 720, D, W, M)
limitNoNumber of records to retrieve
startNoStart time in milliseconds
symbolYesSymbol (e.g., BTCUSDT)

Implementation Reference

  • The core handler function that constructs the request parameters and calls the Bybit /v5/market/kline API endpoint via makeBybitRequest.
    async getKline( category: string, symbol: string, interval: string, start?: number, end?: number, limit: number = 200 ): Promise<BybitResponse<KlineData> | { error: string }> { const params: any = { category, symbol, interval, limit }; if (start) params.start = start; if (end) params.end = end; return this.makeBybitRequest('/v5/market/kline', 'GET', params); }
  • Input schema definition for the get_kline tool, specifying parameters, types, descriptions, and required fields.
    name: 'get_kline', description: 'Get K-line (candlestick) data', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Category (spot, linear, inverse, etc.)', }, symbol: { type: 'string', description: 'Symbol (e.g., BTCUSDT)', }, interval: { type: 'string', description: 'Time interval (1, 3, 5, 15, 30, 60, 120, 240, 360, 720, D, W, M)', }, start: { type: 'number', description: 'Start time in milliseconds', }, end: { type: 'number', description: 'End time in milliseconds', }, limit: { type: 'number', description: 'Number of records to retrieve', default: 200, }, }, required: ['category', 'symbol', 'interval'], },
  • src/index.ts:738-755 (registration)
    Tool call dispatcher in the MCP server's CallToolRequestSchema handler that invokes the getKline method with parsed arguments.
    case 'get_kline': { const result = await this.bybitService.getKline( typedArgs.category, typedArgs.symbol, typedArgs.interval, typedArgs.start, typedArgs.end, typedArgs.limit ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • TypeScript interface defining the structure of KlineData returned by the Bybit kline API.
    export interface KlineData { symbol: string; category: string; list: [string, string, string, string, string, string, string][]; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kondisettyravi/mcp-bybit-node'

If you have feedback or need assistance with the MCP directory API, please join our Discord server