Skip to main content
Glama

get_candles_snapshot

Fetch historical candlestick data for cryptocurrency trading analysis by specifying coin, time interval, and date range to retrieve open, high, low, close prices and volume.

Instructions

Fetch the candlestick data snapshot for a specific coin. Parameters: coin_name (str): The trading symbol (e.g., 'BTC', 'ETH'). interval (str): The candlestick interval (e.g., '1m', '5m', '1h'). start_time (str): The start time for the candles in ISO 8601 format (e.g., '2025-01-01T00:00:00Z'). end_time (str): The end time for the candles in ISO 8601 format (e.g., '2025-12-31T23:59:59Z'). ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing a list of candlestick data, each with open, high, low, close, volume, and timestamp. Returns a JSON string with an error message if the query fails.

Input Schema

NameRequiredDescriptionDefault
coin_nameYes
intervalYes
start_timeYes
end_timeYes

Input Schema (JSON Schema)

{ "properties": { "coin_name": { "title": "Coin Name", "type": "string" }, "end_time": { "title": "End Time", "type": "string" }, "interval": { "title": "Interval", "type": "string" }, "start_time": { "title": "Start Time", "type": "string" } }, "required": [ "coin_name", "interval", "start_time", "end_time" ], "type": "object" }

Implementation Reference

  • main.py:192-214 (handler)
    The handler function decorated with @mcp.tool() that implements the get_candles_snapshot tool. It converts ISO timestamps to milliseconds, calls info.candles_snapshot from the Hyperliquid SDK, and returns the JSON data or an error message.
    @mcp.tool() async def get_candles_snapshot(coin_name: str, interval: str, start_time: str, end_time: str, ctx: Context) -> str: """ Fetch the candlestick data snapshot for a specific coin. Parameters: coin_name (str): The trading symbol (e.g., 'BTC', 'ETH'). interval (str): The candlestick interval (e.g., '1m', '5m', '1h'). start_time (str): The start time for the candles in ISO 8601 format (e.g., '2025-01-01T00:00:00Z'). end_time (str): The end time for the candles in ISO 8601 format (e.g., '2025-12-31T23:59:59Z'). ctx (Context): The MCP context object for accessing server state. Returns: str: A JSON string containing a list of candlestick data, each with open, high, low, close, volume, and timestamp. Returns a JSON string with an error message if the query fails. """ try: start_ms = int(iso8601.parse_date(start_time).timestamp() * 1000) end_ms = int(iso8601.parse_date(end_time).timestamp() * 1000) data = info.candles_snapshot(coin_name, interval, start_ms, end_ms) return json.dumps(data) except Exception as e: return json.dumps({"error": f"Failed to fetch candles snapshot: {str(e)}"})

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/kukapay/hyperliquid-info-mcp'

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