get_open_interest
Retrieve current Hyperliquid open interest for any coin, including mark price, oracle price, and 24h volume.
Instructions
Get the current Hyperliquid open interest for a coin. Returns OI, mark price, oracle price, and 24h volume.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coin | Yes | Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL' |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Result data object |
Implementation Reference
- src/index.ts:539-545 (registration)Registration of the 'get_open_interest' tool using registerCurrentTool helper. It takes a coin param, normalizes it, and calls api().hyperliquid.openInterest.current(coin).
registerCurrentTool( "get_open_interest", "Get the current Hyperliquid open interest for a coin. Returns OI, mark price, oracle price, and 24h volume.", (coin) => api().hyperliquid.openInterest.current(coin), CoinParam, normalizeHLCoin ); - src/index.ts:380-384 (handler)The registerCurrentTool helper function serves as the generic handler. It calls the SDK's openInterest.current method with the normalized coin and wraps the result via formatResponse.
registerTool(name, description, { coin: coinSchema }, ObjectOutputSchema, async (params) => { const data = await sdkCall(normFn(params.coin)); return formatResponse(data); }); } - src/index.ts:53-56 (schema)CoinParam is the input schema for the get_open_interest tool - a string describing the coin/market symbol (e.g. 'BTC', 'ETH', 'SOL').
const CoinParam = z .string() .describe("Coin/market symbol, e.g. 'BTC', 'ETH', 'SOL'"); - src/index.ts:139-141 (schema)ObjectOutputSchema is the output schema for get_open_interest - returns a single data object.
const ObjectOutputSchema: ZodRawShape = { data: z.record(z.unknown()).describe("Result data object"), }; - src/index.ts:20-22 (helper)The api() helper function returns the OxArchive SDK client instance used to call hyperliquid.openInterest.current.
function api(): OxArchive { return client!; }