import { z } from "zod";
import { apiGet } from "../client.js";
export const name = "get_open_interest";
export const description =
"Get cross-exchange open interest data. Open interest is the total value of outstanding " +
"perpetual futures contracts. Rising OI with rising price = new money entering (trend continuation). " +
"Rising OI with falling price = new shorts opening (bearish). Falling OI = positions closing (deleveraging). " +
"Returns per-exchange OI in USD with 24h change percentages.";
export const schema = z.object({
exchange: z
.string()
.optional()
.describe("Filter by exchange name (e.g., 'binance', 'hyperliquid'). Omit for all exchanges."),
type: z
.string()
.optional()
.describe("Market type filter (e.g., 'perps'). Omit for default."),
limit: z
.number()
.optional()
.describe("Number of results to return. Default 250."),
});
export async function handler(args: z.infer<typeof schema>) {
return apiGet("/api/v1/market-intelligence/open-interest", {
exchange: args.exchange,
type: args.type,
limit: args.limit,
});
}