Skip to main content
Glama

get_orderbook_history

Read-onlyIdempotent

Retrieve historical Hyperliquid orderbook snapshots with bids and asks over a time range. Supports pagination and depth control. Data from April 2023.

Instructions

Get historical Hyperliquid orderbook snapshots (~1.2s resolution). Returns L2 snapshots with bids/asks over a time range. Data available from April 2023. Free: BTC only (20 levels). Build+: all symbols (200 levels). Pro+: full depth.

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
depthNoOrderbook depth — number of price levels per side

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:488-496 (registration)
    Registration of the 'get_orderbook_history' tool using the registerHistoryTool helper. Binds the Hyperliquid orderbook history SDK call with the CoinParam schema, normalizeHLCoin normalizer, and an optional depth parameter.
    registerHistoryTool(
      "get_orderbook_history",
      "Get historical Hyperliquid orderbook snapshots (~1.2s resolution). Returns L2 snapshots with bids/asks over a time range. Data available from April 2023. Free: BTC only (20 levels). Build+: all symbols (200 levels). Pro+: full depth.",
      (coin, params) =>
        api().hyperliquid.orderbook.history(coin, params as any),
      CoinParam,
      normalizeHLCoin,
      { depth: DepthParam }
    );
  • The registerHistoryTool helper function that implements the actual handler logic for all history/paginated tools including get_orderbook_history. It builds the SDK query params from the user's input (coin, start, end, limit, cursor, plus any extra params like depth), then calls the SDK and formats the response with cursor pagination support.
    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 schema used by get_orderbook_history (start, end, limit, cursor). These define the time range and pagination 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,
    };
  • DepthParam optional schema — extra parameter added to get_orderbook_history's input schema to allow specifying the number of price levels per side.
    const DepthParam = z
      .number()
      .optional()
      .describe("Orderbook depth — number of price levels per side");
  • ListOutputSchema — the output schema for get_orderbook_history, defining the structured response shape with records array, count, and optional nextCursor for pagination.
    const ListOutputSchema: ZodRawShape = {
      records: z.array(z.record(z.unknown())).describe("Array of result records"),
      count: z.number().describe("Total number of records in the full result set"),
      nextCursor: z
        .string()
        .optional()
        .describe("Cursor for next page, if more results available"),
    };
Behavior4/5

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

Annotations already declare the tool as readOnlyHint, destructiveHint false, idempotentHint true, and openWorldHint true. The description adds valuable behavioral context: ~1.2s resolution, data available from April 2023, and tier-specific depth limits, which go beyond 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 extraneous information. The first sentence states the core purpose, the second adds data scope, and the third provides tier details. Every sentence earns its place.

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 tool has 6 parameters, an output schema, and many siblings, the description covers critical aspects: what is returned, resolution, time range, data history, and tier limitations. It is sufficient for an agent to decide when to use this tool.

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

Parameters4/5

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

The input schema has 100% description coverage for all 6 parameters, so the description need not repeat parameter details. However, the description indirectly adds value by linking parameters like 'coin' and 'depth' to tier restrictions, e.g., 'BTC only' for free users and depth limits per tier.

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 it retrieves historical Hyperliquid orderbook snapshots with ~1.2s resolution, returning L2 snapshots with bids/asks over a time range. This distinguishes it from siblings like get_orderbook (current snapshot) and get_l2_orderbook by focusing on historical 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 tier-based usage guidance (free: BTC only with 20 levels, Build+: all symbols with 200 levels, Pro+: full depth), which helps users select appropriate tool variants. It does not explicitly mention when not to use this tool vs similar siblings like get_hip3_orderbook_history, but the tier information is practical.

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