get_liquidations_by_user
Get liquidation history for a Hyperliquid user. Returns events where the user was liquidated or acted as liquidator, with optional coin filter.
Instructions
Get Hyperliquid liquidation history for a specific user address. Returns liquidations where the user was either liquidated or was the liquidator. Filter by coin optionally.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | User's wallet address (e.g., '0x1234...') | |
| 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 | |
| coin | No | Optional coin filter |
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:569-590 (handler)The handler function for get_liquidations_by_user. It extracts params (address, start, end, limit, cursor, coin), resolves time range, builds SDK params, optionally normalizes the coin filter, and calls api().hyperliquid.liquidations.byUser().
registerTool( "get_liquidations_by_user", "Get Hyperliquid liquidation history for a specific user address. Returns liquidations where the user was either liquidated or was the liquidator. Filter by coin optionally.", { address: z.string().describe("User's wallet address (e.g., '0x1234...')"), ...HistoryParams, coin: CoinParam.optional().describe("Optional coin filter"), }, ListOutputSchema, async (params) => { const { address, start, end, limit, cursor, coin } = params; const timeRange = resolveTimeRange(start, end); const sdkParams: Record<string, unknown> = { ...timeRange, limit: resolveLimit(limit), }; if (cursor) sdkParams.cursor = cursor; if (coin) sdkParams.coin = coin.toUpperCase(); const result = await api().hyperliquid.liquidations.byUser(address, sdkParams as any); return formatCursorResponse(result); } ); - src/index.ts:569-590 (registration)The tool registration for get_liquidations_by_user using the registerTool helper (not one of the standard patterns like registerHistoryTool, since this has a custom address parameter). Registers name, description, input schema (address + HistoryParams + optional coin), and output schema (ListOutputSchema).
registerTool( "get_liquidations_by_user", "Get Hyperliquid liquidation history for a specific user address. Returns liquidations where the user was either liquidated or was the liquidator. Filter by coin optionally.", { address: z.string().describe("User's wallet address (e.g., '0x1234...')"), ...HistoryParams, coin: CoinParam.optional().describe("Optional coin filter"), }, ListOutputSchema, async (params) => { const { address, start, end, limit, cursor, coin } = params; const timeRange = resolveTimeRange(start, end); const sdkParams: Record<string, unknown> = { ...timeRange, limit: resolveLimit(limit), }; if (cursor) sdkParams.cursor = cursor; if (coin) sdkParams.coin = coin.toUpperCase(); const result = await api().hyperliquid.liquidations.byUser(address, sdkParams as any); return formatCursorResponse(result); } ); - src/index.ts:572-576 (schema)Input schema for get_liquidations_by_user: address (required string), plus HistoryParams (start, end, limit, cursor), plus optional coin filter.
{ address: z.string().describe("User's wallet address (e.g., '0x1234...')"), ...HistoryParams, coin: CoinParam.optional().describe("Optional coin filter"), }, - src/index.ts:577-577 (schema)Output schema is ListOutputSchema: records array, count, and optional nextCursor.
ListOutputSchema,