Skip to main content
Glama
Liquidiction

Liquidiction

get_candles

Retrieve OHLCV candle data for any prediction market outcome on Hyperliquid. Specify coin identifier, time interval, and history duration.

Instructions

Get OHLCV candle data for a prediction market outcome

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin identifier, e.g. "#90"
intervalNoCandle interval: "1m", "5m", "15m", "1h", "4h", "1d"1h
hoursNoHours of history to fetch

Implementation Reference

  • Candle interface defining the shape of OHLCV data returned by the API (t, o, h, l, c, v, n).
    interface Candle {
      t: number; o: string; h: string; l: string; c: string; v: string; n: number;
    }
  • Registration of the 'get_candles' tool via server.tool() with Zod schema for coin, interval, and hours, and the async handler that fetches candleSnapshot data from HL API and formats it as text.
    server.tool(
      'get_candles',
      'Get OHLCV candle data for a prediction market outcome',
      {
        coin: z.string().describe('Coin identifier, e.g. "#90"'),
        interval: z.string().default('1h').describe('Candle interval: "1m", "5m", "15m", "1h", "4h", "1d"'),
        hours: z.number().default(24).describe('Hours of history to fetch'),
      },
      async ({ coin, interval, hours }) => {
        const endTime = Date.now();
        const startTime = endTime - hours * 60 * 60 * 1000;
    
        const candles = await hlInfo<Candle[]>({
          type: 'candleSnapshot',
          req: { coin: coinToAtFormat(coin), interval, startTime, endTime },
        });
    
        const lines = candles.map(c => {
          const time = new Date(c.t).toISOString().slice(0, 16);
          return `${time}  O:${(parseFloat(c.o) * 100).toFixed(1)}% H:${(parseFloat(c.h) * 100).toFixed(1)}% L:${(parseFloat(c.l) * 100).toFixed(1)}% C:${(parseFloat(c.c) * 100).toFixed(1)}% V:${c.v} (${c.n} trades)`;
        });
    
        return { content: [{ type: 'text', text: lines.length > 0 ? lines.join('\n') : 'No candle data found.' }] };
      },
    );
  • Core handler logic: computes start/end times, calls hlInfo with type 'candleSnapshot' and the converted coin identifier, then maps result to formatted lines.
    async ({ coin, interval, hours }) => {
      const endTime = Date.now();
      const startTime = endTime - hours * 60 * 60 * 1000;
    
      const candles = await hlInfo<Candle[]>({
        type: 'candleSnapshot',
        req: { coin: coinToAtFormat(coin), interval, startTime, endTime },
      });
  • Utility function coinToAtFormat that converts a coin identifier (e.g. '#90') to the '@' format required by the Hyperliquid API.
    function coinToAtFormat(coin: string): string {
      const num = coin.startsWith('#') ? coin.slice(1) : coin;
      return `@${num}`;
  • Generic hlInfo helper that POSTs a JSON body to the HL /info endpoint and returns typed JSON.
    async function hlInfo<T>(body: object): Promise<T> {
      const res = await fetch(`${API_URL}/info`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(body),
      });
      if (!res.ok) throw new Error(`HL API error: ${res.status}`);
      return res.json() as Promise<T>;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided and description does not mention any behavioral traits such as data limits, pagination, or rate limits. The description is too brief for a data retrieval tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, concise and front-loaded. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema; description does not clarify return format (e.g., array of candles with fields). For a tool that fetches historical data, this is a gap. Parameter coverage is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema covers all three parameters with descriptions, so baseline 3. Description adds no extra meaning beyond existing schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb 'Get' and specific resource 'OHLCV candle data for a prediction market outcome'. Distinguishes from siblings like get_prices or get_market_detail which provide different data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool compared to alternatives like get_prices or get_recent_trades. Missing conditions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/Liquidiction/liquidiction-mcp'

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