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
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Trading pair symbol, e.g. BTCUSDT | |
| symbols | No | Array of multiple trading pair symbols | |
| type | No | Return data type, FULL or MINI | |
| windowSize | No | Window 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
- src/index.ts:375-399 (handler)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 }; } }
- src/index.ts:369-374 (schema)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 }; } } );
- src/index.ts:403-412 (helper)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 }