get_lighter_l3_orderbook_history
Access historical Lighter L3 orderbook snapshots with order-level details: order IDs, user addresses, prices, and sizes over a time range.
Instructions
Get historical Lighter L3 orderbook snapshots (Pro+ tier). Returns order-level snapshots with individual order IDs, user addresses, prices, and sizes over a time range.
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 | |
| depth | No | Orderbook depth — number of price levels per side |
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:977-985 (registration)Registration of get_lighter_l3_orderbook_history tool using the generic registerHistoryTool helper. It passes the SDK call api().lighter.l3Orderbook.history with coin normalization and an optional depth parameter.
registerHistoryTool( "get_lighter_l3_orderbook_history", "Get historical Lighter L3 orderbook snapshots (Pro+ tier). Returns order-level snapshots with individual order IDs, user addresses, prices, and sizes over a time range.", (coin, params) => api().lighter.l3Orderbook.history(coin, params as any), LighterCoinParam, normalizeLighterCoin, { depth: DepthParam } ); - src/index.ts:408-438 (helper)The registerHistoryTool helper function that builds the tool registration for history-type tools with cursor pagination. It constructs the schema (coin + HistoryParams + extra params), resolves time range, limit, cursor, and passes extra params through to the SDK call.
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); }); } - src/index.ts:73-75 (schema)LighterCoinParam schema — the coin parameter used by get_lighter_l3_orderbook_history (validates coin symbol input).
const LighterCoinParam = z .string() .describe("Lighter.xyz coin symbol, e.g. 'BTC', 'ETH'"); - src/index.ts:316-318 (helper)Helper function to normalize Lighter coin symbols to uppercase.
function normalizeLighterCoin(coin: string): string { return coin.toUpperCase(); } - src/index.ts:166-168 (helper)resolveLimit — default limit helper used by the history tool handler (defaults to 100).
function resolveLimit(limit?: number): number { return limit ?? 100; }