Creates a new ActionBase instance.
Strategy identifier this action is attached to
Timeframe identifier this action is attached to
Action identifier
If running in backtest
ReadonlyactionReadonlybacktestReadonlyframeReadonlystrategyHandles breakeven events when stop-loss is moved to entry price.
Called once per signal when price moves far enough to cover fees and slippage. Breakeven threshold: (CC_PERCENT_SLIPPAGE + CC_PERCENT_FEE) * 2 + CC_BREAKEVEN_THRESHOLD
Triggered by: ActionCoreService.breakevenAvailable() via BreakevenConnectionService Source: breakevenSubject.next() in CREATE_COMMIT_BREAKEVEN_FN callback Frequency: Once per signal when threshold reached
Default implementation: Logs breakeven event.
Breakeven milestone data with signal info, current price, timestamp
Optionalsource: stringCleans up resources and subscriptions when action handler is disposed.
Called once when strategy execution ends. Guaranteed to run exactly once via singleshot pattern.
Override to:
Default implementation: Logs dispose event.
Optionalsource: stringInitializes the action handler.
Called once after construction. Override to perform async initialization:
Default implementation: Logs initialization event.
Optionalsource: stringHandles partial loss level events (-10%, -20%, -30%, etc).
Called once per loss level per signal (deduplicated). Use to track loss milestones and implement risk management actions.
Triggered by: ActionCoreService.partialLossAvailable() via PartialConnectionService Source: partialLossSubject.next() in CREATE_COMMIT_LOSS_FN callback Frequency: Once per loss level per signal
Default implementation: Logs partial loss event.
Loss milestone data with signal info, level (-10, -20, -30...), price, timestamp
Optionalsource: stringHandles partial profit level events (10%, 20%, 30%, etc).
Called once per profit level per signal (deduplicated). Use to track profit milestones and adjust position management.
Triggered by: ActionCoreService.partialProfitAvailable() via PartialConnectionService Source: partialProfitSubject.next() in CREATE_COMMIT_PROFIT_FN callback Frequency: Once per profit level per signal
Default implementation: Logs partial profit event.
Profit milestone data with signal info, level (10, 20, 30...), price, timestamp
Optionalsource: stringHandles active ping events during active pending signal monitoring.
Called every minute while a pending signal is active (position open). Use to monitor active positions and track lifecycle.
Triggered by: ActionCoreService.pingActive() via StrategyConnectionService Source: activePingSubject.next() in CREATE_COMMIT_ACTIVE_PING_FN callback Frequency: Every minute while pending signal is active
Default implementation: Logs active ping event.
Active pending signal monitoring data with symbol, strategy info, signal data, timestamp
Optionalsource: stringHandles scheduled ping events during scheduled signal monitoring.
Called every minute while a scheduled signal is waiting for activation. Use to monitor pending signals and track wait time.
Triggered by: ActionCoreService.pingScheduled() via StrategyConnectionService Source: schedulePingSubject.next() in CREATE_COMMIT_SCHEDULE_PING_FN callback Frequency: Every minute while scheduled signal is waiting
Default implementation: Logs scheduled ping event.
Scheduled signal monitoring data with symbol, strategy info, signal data, timestamp
Optionalsource: stringHandles risk rejection events when signals fail risk validation.
Called only when signal is rejected (not emitted for allowed signals). Use to track rejected signals and analyze risk management effectiveness.
Triggered by: ActionCoreService.riskRejection() via RiskConnectionService Source: riskSubject.next() in CREATE_COMMIT_REJECTION_FN callback Frequency: Only when signal fails risk validation
Default implementation: Logs risk rejection event.
Risk rejection data with symbol, pending signal, rejection reason, timestamp
Optionalsource: stringHandles signal events from all modes (live + backtest).
Called every tick/candle when strategy is evaluated. Receives all signal states: idle, scheduled, opened, active, closed, cancelled.
Triggered by: ActionCoreService.signal() via StrategyConnectionService Source: signalEmitter.next() in tick() and backtest() methods Frequency: Every tick/candle
Default implementation: Logs signal event.
Signal state result with action, state, signal data, and context
Optionalsource: stringHandles signal events from backtest only.
Called every candle in backtest mode. Use for actions specific to backtesting (e.g., collecting test metrics).
Triggered by: ActionCoreService.signalBacktest() via StrategyConnectionService Source: signalBacktestEmitter.next() in tick() and backtest() methods when backtest=true Frequency: Every candle in backtest mode
Default implementation: Logs backtest signal event.
Signal state result from backtest
Optionalsource: stringHandles signal events from live trading only.
Called every tick in live mode. Use for actions that should only run in production (e.g., sending real notifications).
Triggered by: ActionCoreService.signalLive() via StrategyConnectionService Source: signalLiveEmitter.next() in tick() and backtest() methods when backtest=false Frequency: Every tick in live mode
Default implementation: Logs live signal event.
Signal state result from live trading
Optionalsource: string
Base class for custom action handlers.
Provides default implementations for all IPublicAction methods that log events. Extend this class to implement custom action handlers for:
Key features:
Lifecycle:
Event flow:
Example
Example