PartialGlobalService

Global service for partial profit/loss tracking.

Thin delegation layer that forwards operations to PartialConnectionService. Provides centralized logging for all partial operations at the global level.

Architecture:

  • Injected into ClientStrategy constructor via IStrategyParams
  • Delegates all operations to PartialConnectionService
  • Logs operations at "partialGlobalService" level before delegation

Purpose:

  • Single injection point for ClientStrategy (dependency injection pattern)
  • Centralized logging for monitoring partial operations
  • Layer of abstraction between strategy and connection layer
constructor();
loggerService: any

Logger service injected from DI container. Used for logging operations at global service level.

partialConnectionService: any

Connection service injected from DI container. Handles actual ClientPartial instance creation and management.

profit: (symbol: string, data: ISignalRow, currentPrice: number, revenuePercent: number, backtest: boolean, when: Date) => Promise<void>

Processes profit state and emits events for newly reached profit levels.

Logs operation at global service level, then delegates to PartialConnectionService.

loss: (symbol: string, data: ISignalRow, currentPrice: number, lossPercent: number, backtest: boolean, when: Date) => Promise<void>

Processes loss state and emits events for newly reached loss levels.

Logs operation at global service level, then delegates to PartialConnectionService.

clear: (symbol: string, data: ISignalRow, priceClose: number) => Promise<void>

Clears partial profit/loss state when signal closes.

Logs operation at global service level, then delegates to PartialConnectionService.