PerformanceMarkdownService

Service for collecting and analyzing performance metrics.

Features:

  • Listens to performance events via performanceEmitter
  • Accumulates metrics per strategy
  • Calculates aggregated statistics (avg, min, max, percentiles)
  • Generates markdown reports with bottleneck analysis
  • Saves reports to disk in logs/performance/{strategyName}.md
constructor();
loggerService: any

Logger service for debug output

getStorage: any

Memoized function to get or create PerformanceStorage for a symbol-strategy pair. Each symbol-strategy combination gets its own isolated storage instance.

track: any

Processes performance events and accumulates metrics. Should be called from performance tracking code.

getData: (symbol: string, strategyName: string) => Promise<PerformanceStatistics>

Gets aggregated performance statistics for a symbol-strategy pair.

getReport: (symbol: string, strategyName: string) => Promise<string>

Generates markdown report with performance analysis.

dump: (symbol: string, strategyName: string, path?: string) => Promise<void>

Saves performance report to disk.

clear: (ctx?: { symbol: string; strategyName: string; }) => Promise<void>

Clears accumulated performance data from storage.

init: (() => Promise<void>) & ISingleshotClearable

Initializes the service by subscribing to performance events. Uses singleshot to ensure initialization happens only once.