Skip to main content
Glama

get_funding_history

Read-onlyIdempotent

Retrieve Hyperliquid funding rate history and premiums for a coin over a specified time range with adjustable aggregation intervals.

Instructions

Get Hyperliquid funding rate history for a coin over a time range. Returns timestamped funding rates and premiums. 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:528-536 (registration)
    Registration of the `get_funding_history` tool using `registerHistoryTool`. It binds the tool name to the SDK call `api().hyperliquid.funding.history(coin, params)` with CoinParam, normalizeHLCoin, and an extra `interval: AggregationIntervalParam` schema.
    registerHistoryTool(
      "get_funding_history",
      "Get Hyperliquid funding rate history for a coin over a time range. Returns timestamped funding rates and premiums. Data available from May 2023. Supports aggregation intervals (5m, 15m, 30m, 1h, 4h, 1d).",
      (coin, params) =>
        api().hyperliquid.funding.history(coin, params as any),
      CoinParam,
      normalizeHLCoin,
      { interval: AggregationIntervalParam }
    );
  • The handler logic for `get_funding_history` is defined inline via the arrow function `(coin, params) => api().hyperliquid.funding.history(coin, params as any)` passed to `registerHistoryTool`. The actual handler execution is inside `registerHistoryTool` (lines 419-437) which resolves time range, limit, cursor, and extra params then calls `sdkCall(normFn(coin), sdkParams)`.
    registerHistoryTool(
      "get_funding_history",
      "Get Hyperliquid funding rate history for a coin over a time range. Returns timestamped funding rates and premiums. Data available from May 2023. Supports aggregation intervals (5m, 15m, 30m, 1h, 4h, 1d).",
      (coin, params) =>
        api().hyperliquid.funding.history(coin, params as any),
      CoinParam,
      normalizeHLCoin,
      { interval: AggregationIntervalParam }
    );
  • `registerHistoryTool` (Pattern 4) is the helper function that generates the actual tool handler. It builds the Zod input schema from `coin`, `HistoryParams` (start, end, limit, cursor), and any extraSchema (here `{ interval: AggregationIntervalParam }`). The handler resolves time range via `resolveTimeRange`, applies `resolveLimit`, passes through cursor and extra params, calls `sdkCall(normFn(coin), sdkParams)`, and formats the result via `formatCursorResponse`.
    // 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);
      });
  • `HistoryParams` shared Zod schema used by `get_funding_history` — defines `start`, `end`, `limit`, and `cursor` input parameters.
    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,
    };
  • `AggregationIntervalParam` Zod enum schema for the `interval` parameter, allowing '5m', '15m', '30m', '1h', '4h', '1d' — used as extra schema in `get_funding_history`.
    const AggregationIntervalParam = z
      .enum(["5m", "15m", "30m", "1h", "4h", "1d"])
      .optional()
      .describe("Aggregation interval. Omit for raw ~1 min data.");
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds behavioral context such as data available from May 2023 and support for aggregation intervals, going beyond the annotations by specifying the historical scope and optional aggregation.

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?

Three concise sentences front-load the purpose, detail return content, and then provide additional context. No unnecessary words, every sentence adds value.

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

Completeness5/5

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

Given the parameter count, full schema coverage, and presence of output schema and annotations, the description is complete. It covers the coin, time range, aggregation, and data availability. No major gaps identified.

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?

Input schema has 100% description coverage, so the schema already explains all parameters. The description adds useful context about data starting from May 2023 and aggregation intervals, but does not significantly enhance parameter meaning beyond the 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?

The description clearly states the tool retrieves Hyperliquid funding rate history for a coin over a time range, specifying it returns timestamped funding rates and premiums. This clearly differentiates it from sibling tools like get_funding_current that provide current data.

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

Usage Guidelines4/5

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

The description provides clear context on what the tool does and mentions data availability and aggregation intervals, but does not explicitly state when to use it versus alternatives like get_funding_current. However, the distinction is implied by the word 'history'.

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