/** * Real-time 3-DEX funding rate comparison. * * Fetches funding rates from Pacifica, Hyperliquid, and Lighter in parallel, * normalizes them to comparable hourly rates, and identifies arbitrage * opportunities across exchanges. */ import { type HistoricalAverages } from "./history.js"; export interface ExchangeFundingRate { exchange: "pacifica" | "hyperliquid" | "lighter" | "aster"; symbol: string; fundingRate: number; hourlyRate: number; annualizedPct: number; markPrice: number; nextFundingTime?: number; historicalAvg?: HistoricalAverages; } export interface SymbolFundingComparison { symbol: string; rates: ExchangeFundingRate[]; maxSpreadAnnual: number; longExchange: string; shortExchange: string; bestMarkPrice: number; estHourlyIncomeUsd: number; } export interface FundingRateSnapshot { timestamp: string; symbols: SymbolFundingComparison[]; exchangeStatus: Record; } export declare const TOP_SYMBOLS: string[]; /** * Fetch funding rates from all 3 DEXs in parallel, normalize, and compare. * Returns rates sorted by max spread (descending). */ export declare function fetchAllFundingRates(opts?: { symbols?: string[]; minSpread?: number; }): Promise; /** * Fetch rates for a single symbol across all exchanges. */ export declare function fetchSymbolFundingRates(symbol: string): Promise; export interface SpotPerpSpread { symbol: string; /** Perp exchange with the highest absolute funding rate */ perpExchange: string; /** Spot exchange(s) available for the hedge leg */ spotExchanges: string[]; /** Perp funding rate (raw) */ perpFundingRate: number; /** Perp funding hourly rate */ perpHourlyRate: number; /** Annualized spread % (spot funding = 0, so spread = |perp annual rate|) */ annualSpreadPct: number; /** Best mark price */ bestMarkPrice: number; /** Direction: "long-spot-short-perp" when perp funding > 0, else "sell-spot-long-perp" */ direction: "long-spot-short-perp" | "sell-spot-long-perp"; /** Estimated hourly income for $1000 notional */ estHourlyIncomeUsd: number; } /** * Fetch spot+perp funding rate spreads. * Since spot has 0 funding cost, the spread is simply |perp funding rate|. * Only includes symbols available on at least one spot exchange (HL or LT). * * Key safety checks: * - U-token mapping: UBTC→BTC, UETH→ETH, USOL→SOL, UFART→FARTCOIN * - Price validation: spot mid price must be within 5% of perp mark price * (filters out same-ticker-different-token issues like HIP-1 TRUMP ≠ perp TRUMP) */ export declare function fetchSpotPerpSpreads(opts?: { symbols?: string[]; minSpread?: number; }): Promise<{ timestamp: string; spreads: SpotPerpSpread[]; }>;