Implements INotificationUtils
Live trading notification adapter with pluggable notification backend.
Features:
constructor();
_notificationLiveFactory: any
Factory producing the active notification utils instance
getInstance: any
Lazily constructs the notification utils from the registered factory and
memoizes the result via singleshot.
The instance is built on the first call and cached for all subsequent calls.
Reset via clear() so the next call rebuilds from the current factory.
handleSignal: (data: IStrategyTickResult) => Promise<void>
Handles signal events. Proxies call to the underlying notification adapter.
handleSignalNotify: (data: SignalInfoContract) => Promise<void>
handlePartialProfit: (data: PartialProfitContract) => Promise<void>
Handles partial profit availability event. Proxies call to the underlying notification adapter.
handlePartialLoss: (data: PartialLossContract) => Promise<void>
Handles partial loss availability event. Proxies call to the underlying notification adapter.
handleBreakeven: (data: BreakevenContract) => Promise<void>
Handles breakeven availability event. Proxies call to the underlying notification adapter.
handleStrategyCommit: (data: StrategyCommitContract) => Promise<void>
Handles strategy commit events. Proxies call to the underlying notification adapter.
handleSync: (data: SignalSyncContract) => any
Handles signal sync events (signal-open, signal-close). Proxies call to the underlying notification adapter.
handleRisk: (data: RiskContract) => Promise<void>
Handles risk rejection event. Proxies call to the underlying notification adapter.
handleError: (error: Error) => Promise<void>
Handles error event. Proxies call to the underlying notification adapter.
handleCriticalError: (error: Error) => Promise<void>
Handles critical error event. Proxies call to the underlying notification adapter.
handleValidationError: (error: Error) => Promise<void>
Handles validation error event. Proxies call to the underlying notification adapter.
getData: () => Promise<NotificationModel[]>
Gets all stored notifications. Proxies call to the underlying notification adapter.
dispose: () => Promise<void>
Clears all stored notifications. Proxies call to the underlying notification adapter.
useNotificationAdapter: (Ctor: TNotificationUtilsCtor) => void
Sets the notification adapter constructor. All future notification operations will use this adapter.
useDummy: () => void
Switches to dummy notification adapter. All future notification writes will be no-ops.
useMemory: () => void
Switches to in-memory notification adapter (default). Notifications will be stored in memory only.
usePersist: () => void
Switches to persistent notification adapter. Notifications will be persisted to disk.
clear: () => void
Clears the memoized utils instance. Call this when process.cwd() changes between strategy iterations so a new instance is created with the updated base path.