/** * Unified event streaming for agent consumption. * * Streams normalized account events as NDJSON (one JSON per line). * Uses poll-based diffing for cross-exchange compatibility. */ import type { ExchangeAdapter } from "./exchanges/index.js"; export type EventType = "position_opened" | "position_closed" | "position_updated" | "order_placed" | "order_filled" | "order_cancelled" | "balance_update" | "liquidation_warning" | "margin_call" | "heartbeat" | "error"; export interface StreamEvent { type: EventType; exchange: string; timestamp: string; data: Record; riskLevel?: "normal" | "warning" | "critical"; } /** * Start polling-based event stream. * Emits NDJSON events to the provided callback. */ export declare function startEventStream(adapter: ExchangeAdapter, opts: { intervalMs?: number; liquidationWarningPct?: number; onEvent: (event: StreamEvent) => void; signal?: AbortSignal; }): Promise;