/** * Arb utilities: settlement timing strategy, basis risk monitoring, and webhook notifications. */ /** Settlement schedules per exchange (UTC hours when settlement occurs) */ export declare const SETTLEMENT_SCHEDULES: Record; export type SettleStrategy = "block" | "aggressive" | "off"; /** * Get the most recent settlement time for an exchange. * @returns Date of the most recent past settlement */ export declare function getLastSettlement(exchange: string, now?: Date): Date; /** * Get minutes since the most recent settlement for an exchange. */ export declare function getMinutesSinceSettlement(exchange: string, now?: Date): number; /** * Compute a score boost for aggressive settlement mode. * Returns a multiplier > 1.0 if within the post-settlement window, else 1.0. * The boost decays linearly from 1.5x (right after settlement) to 1.0x (at windowMinutes). */ export declare function aggressiveSettleBoost(longExchange: string, shortExchange: string, windowMinutes?: number, now?: Date): number; /** * Estimate cumulative funding between now and the next settlement. * * Since all three exchanges (HL, PAC, LT) settle every hour, both sides * accumulate funding at the same frequency. The function estimates * cumulative funding over the given time horizon. * * @param hlHourlyRate - HL per-hour funding rate (raw, not %) * @param pacHourlyRate - PAC per-hour funding rate (raw, not %) * @param positionSize - position notional in USD * @param hoursUntilSettlement - hours until next settlement * @returns { hlCumulative, pacPayment, netFunding } in USD (positive = you receive) */ export declare function estimateFundingUntilSettlement(hlHourlyRate: number, pacHourlyRate: number, positionSize: number, hoursUntilSettlement: number): { hlCumulative: number; pacPayment: number; netFunding: number; }; export interface BasisRisk { symbol: string; longExchange: string; shortExchange: string; longMarkPrice: number; shortMarkPrice: number; divergencePct: number; warning: boolean; } /** * Compute basis risk from pre-fetched prices (no async, for use in tests and monitor). */ export declare function computeBasisRisk(longPrice: number, shortPrice: number, maxDivergencePct?: number): { divergencePct: number; warning: boolean; }; export type ArbNotifyEvent = "entry" | "exit" | "reversal" | "margin" | "basis" | "heartbeat"; /** * Format a notification message for an arb event. */ export declare function formatNotifyMessage(event: ArbNotifyEvent, data: Record): string; /** * Send a notification to a webhook URL (Discord, Telegram, or generic). * * @param webhookUrl - The webhook URL * @param event - The event type * @param data - Event data * @param fetchFn - Optional fetch function for testing */ export declare function sendNotification(webhookUrl: string, event: ArbNotifyEvent, data: Record, fetchFn?: typeof fetch): Promise; /** * Helper to send notification only if the event is in the allowed list. */ export declare function notifyIfEnabled(webhookUrl: string | undefined, enabledEvents: ArbNotifyEvent[], event: ArbNotifyEvent, data: Record, fetchFn?: typeof fetch): Promise;