get_lighter_open_interest
Retrieve current open interest for a coin on Lighter.xyz. Returns OI, mark price, and oracle price given a coin symbol.
Instructions
Get the current Lighter.xyz open interest for a coin. Returns OI, mark price, and oracle price.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Lighter.xyz coin symbol, e.g. 'BTC', 'ETH' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Result data object |
Implementation Reference
- src/index.ts:876-882 (registration)Registration of the 'get_lighter_open_interest' tool using registerCurrentTool helper, which delegates to api().lighter.openInterest.current(coin) with LighterCoinParam and normalizeLighterCoin.
registerCurrentTool( "get_lighter_open_interest", "Get the current Lighter.xyz open interest for a coin. Returns OI, mark price, and oracle price.", (coin) => api().lighter.openInterest.current(coin), LighterCoinParam, normalizeLighterCoin ); - src/index.ts:373-384 (handler)The registerCurrentTool helper function that acts as the actual handler for 'get_lighter_open_interest'. It calls the SDK's openInterest.current() method with the normalized coin symbol and formats the response.
function registerCurrentTool( name: string, description: string, sdkCall: (coin: string) => Promise<unknown>, coinSchema: z.ZodString, normFn: (coin: string) => string ): void { registerTool(name, description, { coin: coinSchema }, ObjectOutputSchema, async (params) => { const data = await sdkCall(normFn(params.coin)); return formatResponse(data); }); } - src/index.ts:73-75 (schema)The LighterCoinParam Zod schema used as input validation for the coin parameter.
const LighterCoinParam = z .string() .describe("Lighter.xyz coin symbol, e.g. 'BTC', 'ETH'"); - src/index.ts:139-141 (schema)The ObjectOutputSchema used as output schema for this current-snapshot tool.
const ObjectOutputSchema: ZodRawShape = { data: z.record(z.unknown()).describe("Result data object"), }; - src/index.ts:316-318 (helper)The normalizeLighterCoin helper function that uppercases the coin symbol before passing to the SDK.
function normalizeLighterCoin(coin: string): string { return coin.toUpperCase(); }