Skip to main content
Glama

get_kline

Retrieve candlestick chart data for cryptocurrency trading analysis on Bybit. Specify symbol, time interval, and category to access historical price patterns for informed trading decisions.

Instructions

Get K-line (candlestick) data

Input Schema

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

Implementation Reference

  • Core handler function that executes the get_kline tool logic by making authenticated API request to Bybit's /v5/market/kline endpoint.
    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 and registration for the get_kline tool in the MCP tools list.
    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'], }, },
  • MCP CallToolRequest handler case that invokes the BybitService.getKline method and formats the response.
    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 Kline data returned by the Bybit 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