get_lighter_trades_recent
Fetches the most recent trades for a specified coin from Lighter.xyz. Returns recent trades without requiring a time range.
Instructions
Get most recent Lighter.xyz trades for a coin. Returns the latest trades without needing a time range.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Lighter.xyz coin symbol, e.g. 'BTC', 'ETH' | |
| limit | No | Max records to return (default 100, max 1000) |
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:828-843 (registration)Registration of the 'get_lighter_trades_recent' tool via registerTool(). Accepts coin (LighterCoinParam) and optional limit. Calls api().lighter.trades.recent().
registerTool( "get_lighter_trades_recent", "Get most recent Lighter.xyz trades for a coin. Returns the latest trades without needing a time range.", { coin: LighterCoinParam, limit: LimitParam, }, ListOutputSchema, async (params) => { const data = await api().lighter.trades.recent( normalizeLighterCoin(params.coin), params.limit ); return formatResponse(data); } ); - src/index.ts:836-842 (handler)Handler function for get_lighter_trades_recent. Normalizes the coin symbol via normalizeLighterCoin (uppercase), calls api().lighter.trades.recent() on the SDK, and formats the response.
async (params) => { const data = await api().lighter.trades.recent( normalizeLighterCoin(params.coin), params.limit ); return formatResponse(data); } - src/index.ts:831-834 (schema)Input schema for get_lighter_trades_recent: coin (LighterCoinParam) and optional limit (LimitParam). Output uses ListOutputSchema.
{ coin: LighterCoinParam, limit: LimitParam, }, - src/index.ts:129-136 (schema)ListOutputSchema defines the output shape: records array, count, and optional nextCursor.
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:316-318 (helper)Helper function normalizeLighterCoin that uppercases the coin symbol before passing to the SDK.
function normalizeLighterCoin(coin: string): string { return coin.toUpperCase(); }