Skip to main content
Glama

Binance Cryptocurrency MCP

by snjyor

get_rolling_window_ticker

Fetch real-time cryptocurrency market data for specific trading pairs within defined time windows using the Binance Cryptocurrency MCP. Specify symbols, window size, and data type (FULL or MINI) for detailed or condensed insights.

Input Schema

NameRequiredDescriptionDefault
symbolNoTrading pair symbol, e.g. BTCUSDT
symbolsNoArray of multiple trading pair symbols
typeNoReturn data type, FULL or MINI
windowSizeNoWindow size, e.g. 1m, 4h, 1d

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "symbol": { "description": "Trading pair symbol, e.g. BTCUSDT", "type": "string" }, "symbols": { "description": "Array of multiple trading pair symbols", "items": { "type": "string" }, "type": "array" }, "type": { "description": "Return data type, FULL or MINI", "enum": [ "FULL", "MINI" ], "type": "string" }, "windowSize": { "description": "Window size, e.g. 1m, 4h, 1d", "type": "string" } }, "type": "object" }

Implementation Reference

  • The handler function that implements the core logic of the 'get_rolling_window_ticker' tool. It constructs query parameters from input args, makes an HTTP GET request to the Binance API endpoint '/api/v3/ticker', and returns the response data as formatted JSON or an error message.
    async (args: { symbol?: string; symbols?: string[]; windowSize?: string; type?: "FULL" | "MINI" }) => { try { let params: any = {}; if (args.symbol) { params.symbol = args.symbol; } else if (args.symbols) { params.symbols = JSON.stringify(args.symbols); } if (args.windowSize) params.windowSize = args.windowSize; if (args.type) params.type = args.type; const response = await axios.get(`${BASE_URL}/api/v3/ticker`, { params, proxy: getProxy(), }); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Failed to get rolling window price statistics: ${error.message}` }], isError: true }; } }
  • Zod schema defining the input parameters and their descriptions for the 'get_rolling_window_ticker' tool.
    { symbol: z.string().optional().describe("Trading pair symbol, e.g. BTCUSDT"), symbols: z.array(z.string()).optional().describe("Array of multiple trading pair symbols"), windowSize: z.string().optional().describe("Window size, e.g. 1m, 4h, 1d"), type: z.enum(["FULL", "MINI"]).optional().describe("Return data type, FULL or MINI") },
  • src/index.ts:367-400 (registration)
    The registration of the 'get_rolling_window_ticker' tool using server.tool(), including inline schema and handler.
    server.tool( "get_rolling_window_ticker", { symbol: z.string().optional().describe("Trading pair symbol, e.g. BTCUSDT"), symbols: z.array(z.string()).optional().describe("Array of multiple trading pair symbols"), windowSize: z.string().optional().describe("Window size, e.g. 1m, 4h, 1d"), type: z.enum(["FULL", "MINI"]).optional().describe("Return data type, FULL or MINI") }, async (args: { symbol?: string; symbols?: string[]; windowSize?: string; type?: "FULL" | "MINI" }) => { try { let params: any = {}; if (args.symbol) { params.symbol = args.symbol; } else if (args.symbols) { params.symbols = JSON.stringify(args.symbols); } if (args.windowSize) params.windowSize = args.windowSize; if (args.type) params.type = args.type; const response = await axios.get(`${BASE_URL}/api/v3/ticker`, { params, proxy: getProxy(), }); return { content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Failed to get rolling window price statistics: ${error.message}` }], isError: true }; } } );
  • Helper function getProxy() used by the tool handler to configure proxy settings from environment variables.
    function getProxy():any { const proxy: any = {} if (proxyURL) { const urlInfo = new URL(proxyURL); proxy.host = urlInfo.hostname; proxy.port = urlInfo.port; proxy.protocol = urlInfo.protocol.replace(":", ""); } return proxy }

Other Tools

Related Tools

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

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