Skip to main content
Glama

get_trades

Read-onlyIdempotent

Retrieve historical trade data for any coin on Hyperliquid. Get price, size, side, timestamps, and trader addresses with pagination support.

Instructions

Get Hyperliquid trade/fill history for a coin over a time range. Returns price, size, side, timestamps, and user addresses. Data available from April 2023. Supports cursor pagination.

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

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:498-506 (registration)
    Registration of the 'get_trades' tool via registerHistoryTool helper. It's a Hyperliquid trade history tool using cursor pagination, normalized coin param, and delegating to api().hyperliquid.trades.list().
    // 4. Trades
    registerHistoryTool(
      "get_trades",
      "Get Hyperliquid trade/fill history for a coin over a time range. Returns price, size, side, timestamps, and user addresses. Data available from April 2023. Supports cursor pagination.",
      (coin, params) =>
        api().hyperliquid.trades.list(coin, params as any),
      CoinParam,
      normalizeHLCoin
    );
  • This is the shared handler/registration pattern ('Pattern 4') used by 'get_trades'. It creates the actual handler function that resolves time range, limit, cursor, calls the SDK, and formats the cursor-based response.
    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);
      });
  • Input schemas used by the 'get_trades' tool: CoinParam (string coin symbol), HistoryParams (start/end timestamps, limit, cursor), plus the ListOutputSchema for output.
    const CoinParam = z
      .string()
      .describe("Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL'");
    
    const Hip3CoinParam = z
      .string()
      .describe(
        "HIP-3 coin symbol (CASE-SENSITIVE). 125+ markets across 6 builders: xyz, flx, hyna, km, vntl, cash. Examples: 'km:US500', 'xyz:GOLD', 'hyna:BTC', 'vntl:SPACEX', 'flx:TSLA', 'cash:NVDA'. Use get_hip3_instruments to list all."
      );
    
    const Hip4CoinParam = z
      .string()
      .describe(
        "HIP-4 outcome-market coin symbol. Canonical form is the bare numeric '<10*outcome_id + side>' (e.g. '0' for outcome 0 Yes, '1' for outcome 0 No, '10' for outcome 1 Yes). The legacy '#0' and '%230' forms are also accepted. Use get_hip4_instruments to list all."
      );
    
    const Hip4OutcomeIdParam = z
      .union([z.number(), z.string()])
      .describe("HIP-4 outcome_id (integer). Each outcome has two sides: '<10*id>' (Yes) and '<10*id+1>' (No).");
    
    const LighterCoinParam = z
      .string()
      .describe("Lighter.xyz coin symbol, e.g. 'BTC', 'ETH'");
    
    const SpotCoinParam = z
      .string()
      .describe(
        "Hyperliquid Spot dashed canonical pair symbol (e.g. 'HYPE-USDC', 'PURR-USDC'). 294 pairs available. The server resolves the dashed form to Hyperliquid's wire format ('PURR/USDC', '@107') internally. Use get_spot_pairs to list all."
      );
    
    const TimestampParam = z
      .union([z.number(), z.string()])
      .optional()
      .describe("Timestamp as Unix milliseconds or ISO 8601 string");
    
    const LimitParam = z
      .number()
      .optional()
      .describe("Max records to return (default 100, max 1000)");
    
    const CursorParam = z
      .string()
      .optional()
      .describe("Pagination cursor from previous response's nextCursor");
  • Helper utilities used by 'get_trades': resolveTimeRange (defaults to 24h range), resolveLimit (defaults to 100), and normalizeHLCoin (uppercases coin symbol).
    function resolveTimeRange(
      start?: number | string,
      end?: number | string
    ): { start: number; end: number } {
      return {
        start: start != null ? toUnixMs(start) : Date.now() - 24 * 60 * 60 * 1000,
        end: end != null ? toUnixMs(end) : Date.now(),
      };
    }
Behavior4/5

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

Annotations already declare read-only, safe, idempotent behavior. Description adds value by noting data availability from April 2023 and cursor pagination, which are beyond structured fields.

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 with clear front-loading of main action. No wasted words; every sentence adds useful information.

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 rich annotations and output schema, description covers purpose, return fields, data availability, and pagination. Lacks mention of ordering or rate limits but is sufficient for typical use.

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 fully describes all 5 parameters (100% coverage). Description references time range and pagination but adds no new semantics beyond the schema.

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

Purpose4/5

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

Clearly states it retrieves Hyperliquid trade/fill history for a coin over a time range, listing return fields. However, it does not differentiate from many similar trade tools (e.g., get_hip3_trades, get_lighter_trades) which share the same purpose.

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?

Provides no guidance on when to use this tool versus alternatives. It describes basic functionality but omits context like preferred use cases or prerequisites.

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