Skip to main content
Glama

fetchTicker

Retrieve real-time ticker data for specified trading pairs on supported exchanges. Input exchange ID and symbol to access pricing, volume, and market information for informed cryptocurrency trading decisions.

Instructions

Fetch ticker information for a symbol on an exchange

Input Schema

NameRequiredDescriptionDefault
exchangeIdYesExchange ID (e.g., 'binance', 'coinbase')
symbolYesTrading symbol (e.g., 'BTC/USDT')

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" }, "symbol": { "description": "Trading symbol (e.g., 'BTC/USDT')", "type": "string" } }, "required": [ "exchangeId", "symbol" ], "type": "object" }

Implementation Reference

  • Handler function that fetches ticker data from the CCXT exchange instance for the specified symbol and returns JSON-formatted response or error.
    async ({ exchangeId, symbol }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const ticker = await exchange.fetchTicker(symbol); return { content: [ { type: "text", text: JSON.stringify(ticker, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching ticker: ${(error as Error).message}` } ], isError: true }; } } );
  • Input schema using Zod validators for 'exchangeId' and 'symbol' parameters.
    { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')"), symbol: z.string().describe("Trading symbol (e.g., 'BTC/USDT')") },
  • Full server.tool call registering the 'fetchTicker' MCP tool, including name, description, input schema, and handler.
    server.tool( "fetchTicker", "Fetch ticker information for a symbol on an exchange", { exchangeId: z.string().describe("Exchange ID (e.g., 'binance', 'coinbase')"), symbol: z.string().describe("Trading symbol (e.g., 'BTC/USDT')") }, async ({ exchangeId, symbol }) => { try { // 공개 인스턴스 사용 const exchange = ccxtServer.getPublicExchangeInstance(exchangeId); const ticker = await exchange.fetchTicker(symbol); return { content: [ { type: "text", text: JSON.stringify(ticker, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error fetching ticker: ${(error as Error).message}` } ], isError: true }; } } );
  • src/server.ts:372-372 (registration)
    Top-level call to registerMarketTools in CcxtMcpServer's registerTools method, which registers the fetchTicker tool among market tools.
    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