Skip to main content
Glama

get_spot_twap_by_symbol

Read-onlyIdempotent

Retrieve Time-Weighted Average Price (TWAP) statuses for a specific Hyperliquid spot trading pair, including twap_id, user, side, size, and execution metadata. Data sourced from the L4 order stream.

Instructions

Get Hyperliquid Spot TWAP statuses for a single pair (every TWAP touching this pair). Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns timestamped TWAP status records with twap_id, user_address, side, size, filled_size, status, and execution metadata. Sourced from the L4 order stream. Live from 2026-05-05.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
coinYesHyperliquid 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.
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:1437-1445 (registration)
    The tool 'get_spot_twap_by_symbol' is registered via registerHistoryTool pattern. It calls api().spot.twap.bySymbol(coin, params) with SpotCoinParam as the coin schema and normalizeSpotCoin as the normalizer.
    // Spot TWAP by Symbol
    registerHistoryTool(
      "get_spot_twap_by_symbol",
      "Get Hyperliquid Spot TWAP statuses for a single pair (every TWAP touching this pair). Symbols are dashed canonical (e.g. 'HYPE-USDC'). Returns timestamped TWAP status records with twap_id, user_address, side, size, filled_size, status, and execution metadata. Sourced from the L4 order stream. Live from 2026-05-05.",
      (coin, params) =>
        api().spot.twap.bySymbol(coin, params as any),
      SpotCoinParam,
      normalizeSpotCoin
    );
  • SpotCoinParam is the Zod schema used for the coin parameter. It expects a Hyperliquid Spot dashed canonical pair symbol (e.g. 'HYPE-USDC').
    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."
      );
  • normalizeSpotCoin is the normalization helper called on the coin parameter before passing to the SDK call. It uppercases the coin symbol.
    function normalizeSpotCoin(coin: string): string {
      return coin.toUpperCase();
    }
  • registerCandleTool is used to register 'get_spot_twap_by_symbol' (via the pattern). Since the tool has no extra params beyond coin+history, it simplifies to registerHistoryTool with just coin and history params.
    // Pattern 5: Candle history (coin + time range + interval)
    function registerCandleTool(
      name: string,
      description: string,
      sdkCall: (coin: string, params: Record<string, unknown>) => Promise<{ data: unknown; nextCursor?: string }>,
      coinSchema: z.ZodString,
      normFn: (coin: string) => string
    ): void {
      registerHistoryTool(
        name,
        description,
        sdkCall,
        coinSchema,
        normFn,
        { interval: IntervalParam }
      );
    }
  • registerHistoryTool (Pattern 4) is the actual registration helper used for 'get_spot_twap_by_symbol'. It accepts coin, start, end, limit, cursor params and calls the SDK's bySymbol function with cursor pagination support.
    // 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);
      });
    }
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, covering safety. The description adds value by specifying the data source ('L4 order stream') and start date ('2026-05-05'), which goes beyond what annotations provide.

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, front-loaded with purpose, followed by return fields and metadata. Every sentence adds value with no wasted words.

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 existence of an output schema and complete annotations, the description adequately covers purpose, data source, and temporal scope. It lacks explanation of TWAP status values but is sufficient for the tool's complexity.

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 coverage is 100% with detailed descriptions. The description adds minimal extra meaning (e.g., reinforcing dashed canonical format) but does not significantly enhance understanding 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 verb 'Get', the resource 'Hyperliquid Spot TWAP statuses', and the scope 'for a single pair' with dashed canonical symbols. This effectively distinguishes it from siblings like get_spot_twap_by_user.

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 a single symbol pair but does not explicitly state when to use this tool over alternatives (e.g., get_spot_twap_by_user for user-based queries). No when-not-to-use guidance is 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