Skip to main content
Glama

get_open_interest_history

Read-onlyIdempotent

Retrieve historical open interest data for any Hyperliquid coin with timestamped snapshots and price data. Supports custom time ranges and aggregation intervals from 5 minutes to daily.

Instructions

Get Hyperliquid open interest history for a coin over a time range. Returns timestamped OI snapshots with mark/oracle prices. Data available from May 2023. Supports aggregation intervals (5m, 15m, 30m, 1h, 4h, 1d).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesCoin/market symbol, e.g. 'BTC', 'ETH', 'SOL'
startNoStart timestamp (Unix ms or ISO). Defaults to 24h ago.
endNoEnd timestamp (Unix ms or ISO). Defaults to now.
limitNoMax records to return (default 100, max 1000)
cursorNoPagination cursor from previous response's nextCursor
intervalNoAggregation interval. Omit for raw ~1 min data.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
recordsYesArray of result records
countYesTotal number of records in the full result set
nextCursorNoCursor for next page, if more results available

Implementation Reference

  • src/index.ts:547-556 (registration)
    Registration of the 'get_open_interest_history' tool using the registerHistoryTool helper pattern. It calls api().hyperliquid.openInterest.history() with coin, time range params, and an optional aggregation interval.
    // 9. Open Interest History
    registerHistoryTool(
      "get_open_interest_history",
      "Get Hyperliquid open interest history for a coin over a time range. Returns timestamped OI snapshots with mark/oracle prices. Data available from May 2023. Supports aggregation intervals (5m, 15m, 30m, 1h, 4h, 1d).",
      (coin, params) =>
        api().hyperliquid.openInterest.history(coin, params as any),
      CoinParam,
      normalizeHLCoin,
      { interval: AggregationIntervalParam }
    );
  • Zod schema for the optional aggregation interval parameter used by get_open_interest_history.
    const AggregationIntervalParam = z
      .enum(["5m", "15m", "30m", "1h", "4h", "1d"])
      .optional()
      .describe("Aggregation interval. Omit for raw ~1 min data.");
  • Shared input schema for history-type tools providing start/end timestamps, limit, and cursor for pagination.
    const HistoryParams = {
      start: TimestampParam.describe(
        "Start timestamp (Unix ms or ISO). Defaults to 24h ago."
      ),
      end: TimestampParam.describe(
        "End timestamp (Unix ms or ISO). Defaults to now."
      ),
      limit: LimitParam,
      cursor: CursorParam,
    };
  • Generic handler function (registerHistoryTool) that wraps the tool logic. This is the actual handler for get_open_interest_history — it resolves time range, builds SDK params, calls the SDK, and formats the cursor-paginated response.
    // Pattern 4: History with cursor pagination (coin + time range)
    function registerHistoryTool(
      name: string,
      description: string,
      sdkCall: (coin: string, params: Record<string, unknown>) => Promise<{ data: unknown; nextCursor?: string }>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string,
      extraSchema?: ZodRawShape
    ): void {
      const schema: ZodRawShape = { coin: coinSchema, ...HistoryParams };
      if (extraSchema) Object.assign(schema, extraSchema);
    
      registerTool(name, description, schema, ListOutputSchema, async (params) => {
        const { coin, start, end, limit, cursor, ...extra } = params;
    
        const timeRange = resolveTimeRange(start, end);
        const sdkParams: Record<string, unknown> = {
          ...timeRange,
          limit: resolveLimit(limit),
        };
    
        if (cursor) sdkParams.cursor = cursor;
    
        // Pass through extra params (interval, side, etc.)
        for (const [k, v] of Object.entries(extra)) {
          if (v !== undefined) sdkParams[k] = v;
        }
    
        const result = await sdkCall(normFn(coin), sdkParams);
        return formatCursorResponse(result);
      });
    }
Behavior3/5

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

Annotations already declare readOnlyHint, destructiveHint, idempotentHint, openWorldHint. The description adds minor context about data availability (May 2023) and output content (timestamped OI snapshots with mark/oracle prices). No contradictions with annotations.

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?

The description is three sentences with no wasted words. First sentence states purpose, second describes output, third provides data availability and intervals. Front-loaded and efficient.

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

Completeness4/5

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

Given the tool's complexity (6 params, output schema exists), the description covers purpose, output, data range, and intervals. It does not explain pagination or defaults, but those are in the schema. Adequate for a read-only history tool.

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 description coverage is 100%, so parameters are well-documented. The description adds value by explaining output includes mark/oracle prices and mentioning aggregation intervals, but this is tangential to parameters. Baseline 3 is appropriate.

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?

The description clearly states the verb 'Get' and the specific resource 'Hyperliquid open interest history for a coin over a time range'. It distinguishes from siblings like get_open_interest by emphasizing time range, OI snapshots with prices, and aggregation intervals. Data availability from May 2023 adds further specificity.

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

Usage Guidelines3/5

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

The description implies usage for historical OI data with timestamps and prices, but does not explicitly state when to use this tool versus siblings like get_hip3_open_interest_history or get_lighter_open_interest_history. No exclusions or alternative recommendations are provided.

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/0xArchiveIO/0xarchive-mcp'

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