import type { ExchangeAdapter } from "./exchanges/index.js"; /** * Cross-exchange rebalancing engine. * * Checks balances across exchanges, computes a rebalancing plan, * and optionally executes withdraw → bridge → deposit pipeline. */ export interface ExchangeBalanceSnapshot { exchange: string; equity: number; available: number; marginUsed: number; unrealizedPnl: number; } export interface RebalancePlan { snapshots: ExchangeBalanceSnapshot[]; totalEquity: number; targetPerExchange: number; moves: RebalanceMove[]; summary: string; } export interface RebalanceMove { from: string; to: string; amount: number; reason: string; } /** * Fetch balances from all exchanges in parallel. */ export declare function fetchAllBalances(adapters: Map): Promise; /** * Compute a rebalancing plan to equalize available balance across exchanges. * * Strategy: equal-weight — target = totalAvailable / numExchanges * Only moves from exchanges with surplus to those with deficit. * Respects a minimum move threshold to avoid tiny transfers. */ export declare function computeRebalancePlan(snapshots: ExchangeBalanceSnapshot[], opts?: { /** Minimum move amount to bother with ($) */ minMove?: number; /** Target allocation weights (default: equal). Keys = exchange names, values = 0-1 weights summing to 1 */ weights?: Record; /** Reserve: keep at least this much available on each exchange */ reserve?: number; }): RebalancePlan; /** * Check if an exchange has enough available balance for a given trade size. */ export declare function hasEnoughBalance(snapshots: ExchangeBalanceSnapshot[], exchange: string, requiredUsd: number, marginBuffer?: number): boolean; /** * Describe the bridge route for a rebalance move. */ export declare function describeBridgeRoute(move: RebalanceMove): string; /** * Estimate total time for a rebalance move. */ export declare function estimateMoveTime(move: RebalanceMove): string;