Skip to main content
Glama

candles

Retrieve OHLCV candlestick data for cryptocurrency analysis. Get open, high, low, close prices with historical periods to track market trends and price movements.

Instructions

Get OHLCV candlestick data for any crypto. Returns open, high, low, close for each period.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesCrypto symbol
daysNoNumber of days of history (1, 7, 14, 30, 90, 180, 365). Default: 7

Implementation Reference

  • index.js:80-99 (handler)
    The function `getCryptoCandles` fetches and returns OHLCV candlestick data from CoinGecko.
    async function getCryptoCandles(symbol, interval = '1h', days = 7) {
      const id = symbol.toLowerCase().replace('usdt', '').replace('usd', '');
      const idMap = {
        btc: 'bitcoin', eth: 'ethereum', sol: 'solana', doge: 'dogecoin',
        xrp: 'ripple', bnb: 'binancecoin', ada: 'cardano', avax: 'avalanche-2',
      };
      const coinId = idMap[id] || id;
    
      const data = await fetch(
        `https://api.coingecko.com/api/v3/coins/${coinId}/ohlc?vs_currency=usd&days=${days}`
      );
    
      return data.map(c => ({
        time: new Date(c[0]).toISOString(),
        open: c[1],
        high: c[2],
        low: c[3],
        close: c[4],
      }));
    }
  • Tool registration definition for "candles" including input schema.
    {
      name: 'candles',
      description: 'Get OHLCV candlestick data for any crypto. Returns open, high, low, close for each period.',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: { type: 'string', description: 'Crypto symbol' },
          days: { type: 'number', description: 'Number of days of history (1, 7, 14, 30, 90, 180, 365). Default: 7' }
        },
        required: ['symbol']
      }
    },
  • index.js:323-324 (registration)
    Tool invocation handler for "candles" within the main MCP request loop.
    case 'candles':
      return await getCryptoCandles(args.symbol, '1h', args.days || 7);

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/ShipItAndPray/mcp-market-data'

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