Skip to main content
Glama

fetchTickers

Fetch real-time ticker data from any exchange, including price, volume, and market statistics. Specify exchange and symbols for targeted results using the CCXT MCP Server.

Instructions

Fetch all tickers from an exchange

Input Schema

NameRequiredDescriptionDefault
exchangeIdYesExchange ID (e.g., 'binance', 'coinbase')
symbolsNoOptional list of specific symbols to fetch

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "exchangeId": { "description": "Exchange ID (e.g., 'binance', 'coinbase')", "type": "string" }, "symbols": { "description": "Optional list of specific symbols to fetch", "items": { "type": "string" }, "type": "array" } }, "required": [ "exchangeId" ], "type": "object" }

Implementation Reference

  • The main handler function for the 'fetchTickers' MCP tool. It retrieves a public CCXT exchange instance and calls fetchTickers(symbols), returning the result as JSON or an error message.
    async ({ exchangeId, symbols }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const tickers = await exchange.fetchTickers(symbols); return { content: [ { type: "text", text: JSON.stringify(tickers, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching tickers: ${(error as Error).message}` } ], isError: true }; } }
  • Zod input schema defining parameters: exchangeId (required string) and symbols (optional array of strings).
    { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')"), symbols: z.array(z.string()).optional().describe("Optional list of specific symbols to fetch") },
  • Direct registration of the 'fetchTickers' tool on the MCP server using server.tool(), including name, description, schema, and handler function.
    server.tool( "fetchTickers", "Fetch all tickers from an exchange", { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')"), symbols: z.array(z.string()).optional().describe("Optional list of specific symbols to fetch") }, async ({ exchangeId, symbols }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const tickers = await exchange.fetchTickers(symbols); return { content: [ { type: "text", text: JSON.stringify(tickers, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching tickers: ${(error as Error).message}` } ], isError: true }; } } );
  • src/server.ts:372-372 (registration)
    Top-level call to registerMarketTools in the CcxtMcpServer's registerTools method, which includes registration of fetchTickers.
    registerMarketTools(this.server, this);

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/lazy-dinosaur/ccxt-mcp'

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