--- title: docs/class/NotificationBacktestAdapter group: docs --- # NotificationBacktestAdapter Implements `INotificationUtils` Backtest notification adapter with pluggable notification backend. Features: - Adapter pattern for swappable notification implementations - Default adapter: NotificationMemoryBacktestUtils (in-memory storage) - Alternative adapters: NotificationPersistBacktestUtils, NotificationDummyBacktestUtils - Convenience methods: usePersist(), useMemory(), useDummy() ## Constructor ```ts constructor(); ``` ## Properties ### _notificationBacktestFactory ```ts _notificationBacktestFactory: any ``` Factory producing the active notification utils instance ### getInstance ```ts 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 ```ts handleSignal: (data: IStrategyTickResult) => Promise ``` Handles signal events. Proxies call to the underlying notification adapter. ### handleSignalNotify ```ts handleSignalNotify: (data: SignalInfoContract) => Promise ``` ### handlePartialProfit ```ts handlePartialProfit: (data: PartialProfitContract) => Promise ``` Handles partial profit availability event. Proxies call to the underlying notification adapter. ### handlePartialLoss ```ts handlePartialLoss: (data: PartialLossContract) => Promise ``` Handles partial loss availability event. Proxies call to the underlying notification adapter. ### handleBreakeven ```ts handleBreakeven: (data: BreakevenContract) => Promise ``` Handles breakeven availability event. Proxies call to the underlying notification adapter. ### handleStrategyCommit ```ts handleStrategyCommit: (data: StrategyCommitContract) => Promise ``` Handles strategy commit events. Proxies call to the underlying notification adapter. ### handleSync ```ts handleSync: (data: OrderSyncContract) => any ``` Handles signal sync events (signal-open, signal-close). Proxies call to the underlying notification adapter. ### handleCheck ```ts handleCheck: (data: OrderCheckContract) => any ``` Handles order-ping check event. Proxies call to the underlying notification adapter. ### handleOrderFill ```ts handleOrderFill: (data: OrderFillContract) => any ``` Handles broker-confirmed order fill events (signal-open, signal-close). Proxies call to the underlying notification adapter. ### handleOrderReject ```ts handleOrderReject: (data: OrderRejectContract) => any ``` Handles terminal order rejection events (signal-open, signal-close). Proxies call to the underlying notification adapter. ### handleOrderContinue ```ts handleOrderContinue: (data: OrderContinueContract) => any ``` Handles post-verdict order-check continue events. Proxies call to the underlying notification adapter. ### handleOrderStop ```ts handleOrderStop: (data: OrderStopContract) => any ``` Handles post-verdict order-check stop events. Proxies call to the underlying notification adapter. ### handleRisk ```ts handleRisk: (data: RiskContract) => Promise ``` Handles risk rejection event. Proxies call to the underlying notification adapter. ### handlePause ```ts handlePause: (data: PauseContract) => Promise ``` Handles strategy pause state change event. Proxies call to the underlying notification adapter. ### handleError ```ts handleError: (error: Error) => Promise ``` Handles error event. Proxies call to the underlying notification adapter. ### handleCriticalError ```ts handleCriticalError: (error: Error) => Promise ``` Handles critical error event. Proxies call to the underlying notification adapter. ### handleValidationError ```ts handleValidationError: (error: Error) => Promise ``` Handles validation error event. Proxies call to the underlying notification adapter. ### getData ```ts getData: () => Promise ``` Gets all stored notifications. Proxies call to the underlying notification adapter. ### dispose ```ts dispose: () => Promise ``` Clears all stored notifications. Proxies call to the underlying notification adapter. ### useNotificationAdapter ```ts useNotificationAdapter: (Ctor: TNotificationUtilsCtor) => void ``` Sets the notification adapter constructor. All future notification operations will use this adapter. ### useDummy ```ts useDummy: () => void ``` Switches to dummy notification adapter. All future notification writes will be no-ops. ### useMemory ```ts useMemory: () => void ``` Switches to in-memory notification adapter (default). Notifications will be stored in memory only. ### usePersist ```ts usePersist: () => void ``` Switches to persistent notification adapter. Notifications will be persisted to disk. ### clear ```ts 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.