Implements IPublicAction
Proxy wrapper for user-defined action handlers with automatic error capture.
Wraps all IPublicAction methods with trycatch to prevent user code errors from crashing the system. All errors are logged, sent to errorEmitter, and returned as null (non-breaking).
Key features:
Architecture:
Used by:
constructor();
_target: Partial<IPublicAction>
init(): Promise<any>;
Initializes the action handler with error capture.
Wraps the user's init() method in trycatch to prevent initialization errors from crashing the system. If the target doesn't implement init(), this method safely returns undefined.
signal(event: IStrategyTickResult): Promise<any>;
Handles signal events from all modes with error capture.
Wraps the user's signal() method to catch and log any errors. Called on every tick/candle when strategy is evaluated.
signalLive(event: IStrategyTickResult): Promise<any>;
Handles signal events from live trading only with error capture.
Wraps the user's signalLive() method to catch and log any errors. Called every tick in live mode.
signalBacktest(event: IStrategyTickResult): Promise<any>;
Handles signal events from backtest only with error capture.
Wraps the user's signalBacktest() method to catch and log any errors. Called every candle in backtest mode.
breakevenAvailable(event: BreakevenContract): Promise<any>;
Handles breakeven events with error capture.
Wraps the user's breakevenAvailable() method to catch and log any errors. Called once per signal when stop-loss is moved to entry price.
partialProfitAvailable(event: PartialProfitContract): Promise<any>;
Handles partial profit level events with error capture.
Wraps the user's partialProfitAvailable() method to catch and log any errors. Called once per profit level per signal (10%, 20%, 30%, etc).
partialLossAvailable(event: PartialLossContract): Promise<any>;
Handles partial loss level events with error capture.
Wraps the user's partialLossAvailable() method to catch and log any errors. Called once per loss level per signal (-10%, -20%, -30%, etc).
pingScheduled(event: SchedulePingContract): Promise<any>;
Handles scheduled ping events with error capture.
Wraps the user's pingScheduled() method to catch and log any errors. Called every minute while a scheduled signal is waiting for activation.
pingActive(event: ActivePingContract): Promise<any>;
Handles active ping events with error capture.
Wraps the user's pingActive() method to catch and log any errors. Called every minute while a pending signal is active (position open).
riskRejection(event: RiskContract): Promise<any>;
Handles risk rejection events with error capture.
Wraps the user's riskRejection() method to catch and log any errors. Called only when signal is rejected by risk management validation.
signalSync(event: SignalSyncContract): Promise<void>;
Gate for position open/close via limit order. NOT wrapped in trycatch — exceptions propagate to CREATE_SYNC_FN.
dispose(): Promise<any>;
Cleans up resources with error capture.
Wraps the user's dispose() method to catch and log any errors. Called once when strategy execution ends.
static fromInstance(instance: Partial<IPublicAction>): ActionProxy;
Creates a new ActionProxy instance wrapping a user-provided action handler.
Factory method enforcing the private constructor pattern. Wraps all methods of the provided instance with error capture.