Service for logging max drawdown events to the JSONL report database.
Listens to maxDrawdownSubject and writes each new drawdown record to ReportWriter.writeData() for persistence and analytics.
constructor();
loggerService: any
_lastWrittenPnl: any
Last WRITTEN drawdown PnL percent per signal — state of the CC_REPORT_MAX_DRAWDOWN_MIN_STEP_PERCENT write-gate. FIFO-bounded (see MAX_DRAWDOWN_GATE_MAP_LIMIT).
tick: any
Handles a single MaxDrawdownContract event emitted by maxDrawdownSubject.
Writes a JSONL record to the "max_drawdown" report database via
ReportWriter.writeData, capturing the full signal snapshot at the moment
the new drawdown record was set:
timestamp, symbol, strategyName, exchangeName, frameName, backtestsignalId, position, currentPricepriceOpen, priceTakeProfit, priceStopLoss (effective values from the signal)strategyName and signal-level fields are sourced from data.signal
rather than the contract root.
subscribe: (() => () => void) & ISingleshotClearable<() => () => void>
Subscribes to maxDrawdownSubject to start persisting drawdown records.
Protected against multiple subscriptions via singleshot — subsequent
calls return the same unsubscribe function without re-subscribing.
The returned unsubscribe function clears the singleshot state and
detaches from maxDrawdownSubject.
unsubscribe: () => Promise<void>
Detaches from maxDrawdownSubject, stopping further JSONL writes.
Calls the unsubscribe closure returned by subscribe().
If subscribe() was never called, does nothing.