Skip to main content
Glama
kukapay

hyperliquid-info-mcp

get_candles_snapshot

Fetch historical candlestick data for a specific cryptocurrency within a defined time range to analyze price movements and trading 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

TableJSON Schema
NameRequiredDescriptionDefault
coin_nameYes
intervalYes
start_timeYes
end_timeYes

Implementation Reference

  • main.py:192-214 (handler)
    The handler function implementing the get_candles_snapshot tool. It fetches candlestick data from the Hyperliquid Info API using the provided parameters, converts timestamps to milliseconds, and returns JSON data or an error message. The @mcp.tool() decorator registers it as an MCP tool.
    @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