get_rolling_window_ticker
Retrieve rolling window ticker data for cryptocurrency trading pairs from Binance, specifying window size and data type for market analysis.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Trading pair symbol, e.g. BTCUSDT | |
| symbols | No | Array of multiple trading pair symbols | |
| windowSize | No | Window size, e.g. 1m, 4h, 1d | |
| type | No | Return data type, FULL or MINI |
Implementation Reference
- src/index.ts:375-399 (handler)Handler function that constructs parameters from input args and fetches rolling window ticker statistics from Binance API endpoint /api/v3/ticker, returning JSON data or 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 optional input parameters: single symbol, array of symbols, windowSize (e.g., 1m), and type (FULL or MINI).{ 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)Registration of the 'get_rolling_window_ticker' tool via server.tool(), including name, input schema, and inline handler function.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 }; } } );