import { z } from "zod";
import { apiGet } from "../client.js";
export const name = "get_funding_rates";
export const description =
"Get cross-exchange perpetual funding rates. Positive funding means longs pay shorts (bullish crowding); " +
"negative funding means shorts pay longs (bearish crowding). Extreme positive rates (>0.05%) often " +
"precede corrections; extreme negative rates often signal capitulation. " +
"Returns data from multiple exchanges including Binance, Bybit, OKX, and more.";
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/funding-rates", {
exchange: args.exchange,
type: args.type,
limit: args.limit,
});
}