get_order_flow
Aggregate Hyperliquid order placement, cancellation, and fill metrics over customizable time intervals. Input coin symbol and optional time range to retrieve order flow data.
Instructions
Get Hyperliquid order flow aggregation (Build+ tier). Returns aggregated order placement, cancellation, and fill metrics over time intervals.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL' | |
| start | No | Start timestamp (Unix ms or ISO). Defaults to 24h ago. | |
| end | No | End timestamp (Unix ms or ISO). Defaults to now. | |
| limit | No | Max records to return (default 100, max 1000) | |
| cursor | No | Pagination cursor from previous response's nextCursor | |
| interval | No | Aggregation interval (default '1h') |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| records | Yes | Array of result records | |
| count | Yes | Total number of records in the full result set | |
| nextCursor | No | Cursor for next page, if more results available |
Implementation Reference
- src/index.ts:1027-1052 (handler)The handler function that executes the get_order_flow tool logic. It accepts coin, start, end, limit, cursor, and interval parameters, resolves the time range, builds SDK params, calls api().hyperliquid.orders.flow(), and formats the response.
registerTool( "get_order_flow", "Get Hyperliquid order flow aggregation (Build+ tier). Returns aggregated order placement, cancellation, and fill metrics over time intervals.", { coin: CoinParam, ...HistoryParams, interval: z.enum(["1m", "5m", "15m", "30m", "1h", "4h", "1d"]).optional() .describe("Aggregation interval (default '1h')"), }, ListOutputSchema, async (params) => { const { coin, start, end, limit, cursor, interval } = params; const timeRange = resolveTimeRange(start, end); const sdkParams: Record<string, unknown> = { ...timeRange, limit: resolveLimit(limit), }; if (cursor) sdkParams.cursor = cursor; if (interval) sdkParams.interval = interval; const result = await api().hyperliquid.orders.flow( normalizeHLCoin(coin), sdkParams as any ); return formatCursorResponse(result); } ); - src/index.ts:1030-1036 (schema)Input schema for get_order_flow: coin (string), history params (start, end, limit, cursor), and optional interval enum for aggregation.
{ coin: CoinParam, ...HistoryParams, interval: z.enum(["1m", "5m", "15m", "30m", "1h", "4h", "1d"]).optional() .describe("Aggregation interval (default '1h')"), }, ListOutputSchema, - src/index.ts:129-136 (schema)Output schema used by get_order_flow - returns 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"), }; - src/index.ts:1027-1052 (registration)Registration of the get_order_flow tool via the registerTool helper. The tool is registered under the 'Hyperliquid L4 Orders & Orderbook' section.
registerTool( "get_order_flow", "Get Hyperliquid order flow aggregation (Build+ tier). Returns aggregated order placement, cancellation, and fill metrics over time intervals.", { coin: CoinParam, ...HistoryParams, interval: z.enum(["1m", "5m", "15m", "30m", "1h", "4h", "1d"]).optional() .describe("Aggregation interval (default '1h')"), }, ListOutputSchema, async (params) => { const { coin, start, end, limit, cursor, interval } = params; const timeRange = resolveTimeRange(start, end); const sdkParams: Record<string, unknown> = { ...timeRange, limit: resolveLimit(limit), }; if (cursor) sdkParams.cursor = cursor; if (interval) sdkParams.interval = interval; const result = await api().hyperliquid.orders.flow( normalizeHLCoin(coin), sdkParams as any ); return formatCursorResponse(result); } ); - src/index.ts:282-290 (helper)Helper function used to format paginated cursor-based responses from get_order_flow.
function formatCursorResponse(result: { data: unknown; nextCursor?: string; }): McpContent { return formatResponse(result.data, { nextCursor: result.nextCursor, paginated: true, }); }