Skip to main content
Glama

binance.market.klines

Retrieve historical candlestick data for cryptocurrency pairs to analyze market trends and price movements over specified time intervals.

Instructions

Get historical klines/candles for a symbol and interval.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
intervalYes
limitNo

Implementation Reference

  • The handler implementation for the 'binance.market.klines' tool. It defines the tool object with name, description, parameters schema, and the async run function that validates input, fetches klines data via the binance client, and handles errors.
    export const tool_market_klines: BinanceTool = { name: "binance.market.klines", description: "Get historical klines/candles for a symbol and interval.", parameters: klinesSchema, async run(input) { const params = klinesSchema.parse(input); try { const res = await binance.klines(params.symbol, params.interval, { limit: params.limit }); return res.data; } catch (err) { throw toToolError(err); } } };
  • Zod schema defining the input parameters for the klines tool: symbol (string), interval (string), limit (number, 1-1000, default 200).
    const klinesSchema = z.object({ symbol: z.string().min(1), interval: z.string().min(1), limit: z.number().int().min(1).max(1000).default(200) });
  • src/index.ts:14-22 (registration)
    The tool is imported from './tools/market.js' (line 2) and included in the 'tools' array, which is then iterated over to register each tool with the FastMCP server using server.addTool (lines 24-39). This is the registration point.
    const tools = [ tool_market_price, tool_market_klines, tool_exchange_info, tool_account_balances, tool_open_orders, tool_place_order, tool_cancel_order, ];

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/Valerio357/binance-mcp'

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