get_lighter_open_interest_history
Retrieve historical open interest snapshots for any Lighter.xyz coin, with timestamps and optional aggregation intervals, over a specified time range.
Instructions
Get Lighter.xyz open interest history for a coin over a time range. Returns timestamped OI snapshots.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Lighter.xyz coin symbol, e.g. 'BTC', 'ETH' | |
| 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. Omit for raw ~1 min data. |
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:884-893 (registration)Registration of the 'get_lighter_open_interest_history' tool using the registerHistoryTool pattern. It calls api().lighter.openInterest.history with a coin, time range parameters, and optional aggregation interval.
// 29. Lighter Open Interest History registerHistoryTool( "get_lighter_open_interest_history", "Get Lighter.xyz open interest history for a coin over a time range. Returns timestamped OI snapshots.", (coin, params) => api().lighter.openInterest.history(coin, params as any), LighterCoinParam, normalizeLighterCoin, { interval: AggregationIntervalParam } ); - src/index.ts:73-76 (schema)Input schema for the 'coin' parameter. A Zod string describing the Lighter.xyz coin symbol.
const LighterCoinParam = z .string() .describe("Lighter.xyz coin symbol, e.g. 'BTC', 'ETH'"); - src/index.ts:108-111 (schema)Input schema for the optional 'interval' parameter used by get_lighter_open_interest_history.
const AggregationIntervalParam = z .enum(["5m", "15m", "30m", "1h", "4h", "1d"]) .optional() .describe("Aggregation interval. Omit for raw ~1 min data."); - src/index.ts:129-136 (schema)Output schema for the tool — returns records, 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:408-437 (handler)The registerHistoryTool helper that serves as the actual handler for get_lighter_open_interest_history. It resolves time range, limit, cursor, and extra params (interval), calls the SDK's lighter.openInterest.history, and formats the cursor-paginated 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); });