import { Command } from "commander"; import type { ExchangeAdapter } from "../exchanges/index.js"; interface FundingSnapshot { symbol: string; pacRate: number; hlRate: number; ltRate: number; astRate: number; spread: number; longExch: string; shortExch: string; markPrice: number; pacMarkPrice: number; hlMarkPrice: number; ltMarkPrice: number; astMarkPrice: number; } /** * Compute the estimated round-trip cost as a percentage of notional. * Round-trip = 4 × taker fee + 2 × slippage (entry + exit for both legs). */ export declare function computeRoundTripCostPct(longExchange: string, shortExchange: string, slippagePct?: number): number; /** * Compute net annualized spread after deducting round-trip costs amortized over hold period. * * Net = grossAnnualPct - (roundTripCostPct / holdDays * 365) - (bridgeCostPct annualized) * * @param grossAnnualPct - Gross annual spread in % * @param holdDays - Expected holding period in days for cost amortization * @param roundTripCostPct - Total round-trip cost as % of notional * @param bridgeCostUsd - One-way bridge cost in USD (doubled for round-trip) * @param positionSizeUsd - Position size per leg in USD (for bridge cost %) */ export declare function computeNetSpread(grossAnnualPct: number, holdDays: number, roundTripCostPct: number, bridgeCostUsd?: number, positionSizeUsd?: number): number; /** * Get the next settlement time for an exchange. * @returns Date of next settlement */ export declare function getNextSettlement(exchange: string, now?: Date): Date; /** * Check if we are within N minutes before a settlement event on either exchange. * If so, we should avoid entering positions (rates may change). */ export declare function isNearSettlement(longExchange: string, shortExchange: string, bufferMinutes?: number, now?: Date): { blocked: boolean; exchange?: string; minutesUntil?: number; }; /** * Detect if the funding spread has reversed direction for an open position. * A reversal means the long exchange now has a HIGHER hourly rate than the short exchange, * meaning we're now paying on both sides instead of collecting. */ export declare function isSpreadReversed(longExchange: string, shortExchange: string, snapshot: FundingSnapshot): boolean; export declare let handleSpotClose: ((sym: string, opts: { spotExch?: string; perpExch?: string; }, getAdapterForExchange: (exchange: string) => Promise, isJson: () => boolean) => Promise) | undefined; export declare function registerArbAutoCommands(program: Command, getAdapterForExchange: (exchange: string) => Promise, isJson: () => boolean, getHLAdapterForDex?: (dex: string) => Promise): void; export declare let handleArbPnlRef: (() => Promise) | undefined; /** * Exported wrapper for handleArbPnl. */ export declare function handleArbPnl(getAdapterForExchange: (exchange: string) => Promise, isJson: () => boolean): Promise; export {};