/** * Live Dashboard Server — HTTP + WebSocket for real-time portfolio monitoring. * * Polls all configured exchange adapters and pushes updates to connected clients. * Includes cross-exchange arb data: funding rate comparison + dex arb scan. */ import type { ExchangeAdapter, ExchangeBalance, ExchangePosition, ExchangeOrder, ExchangeMarketInfo } from "../exchanges/index.js"; export interface DashboardExchange { name: string; adapter: ExchangeAdapter; } export interface ArbOpportunity { symbol: string; longExchange: string; shortExchange: string; spreadAnnual: number; estHourlyUsd: number; rates: { exchange: string; annualizedPct: number; hourlyRate: number; markPrice: number; }[]; } export interface DexArbOpportunity { underlying: string; longDex: string; shortDex: string; annualSpread: number; priceGapPct: number; viability: string; } export interface DexAssetRow { base: string; dexes: { dex: string; rate: number; annualizedPct: number; markPrice: number; oi: number; }[]; } export interface DashboardSnapshot { timestamp: string; exchanges: { name: string; balance: ExchangeBalance; positions: ExchangePosition[]; orders: ExchangeOrder[]; topMarkets: ExchangeMarketInfo[]; }[]; totals: { equity: number; available: number; marginUsed: number; unrealizedPnl: number; positionCount: number; orderCount: number; }; arb: { opportunities: ArbOpportunity[]; dexArb: DexArbOpportunity[]; dexAssets: DexAssetRow[]; dexNames: string[]; exchangeStatus: Record; }; } export interface DashboardOpts { port?: number; pollInterval?: number; arbInterval?: number; signal?: AbortSignal; } /** * Start the dashboard HTTP + WebSocket server. */ export declare function startDashboard(exchanges: DashboardExchange[], opts?: DashboardOpts): Promise<{ port: number; close: () => void; }>;