Implements IAction
ClientAction implementation for action handler execution.
Provides lifecycle management and event routing for action handlers:
Action handlers implement custom logic for:
Used internally by strategy execution to integrate action handlers.
constructor(params: IActionParams);
params: IActionParams
_handlerInstance: ActionProxy
Handler instance created from params.handler constructor. Starts as null, gets initialized on first use.
waitForInit: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
Initializes handler instance using singleshot pattern. Ensures initialization happens exactly once.
dispose: (() => Promise<void>) & ISingleshotClearable<() => Promise<void>>
Cleans up resources and subscriptions when action handler is no longer needed. Uses singleshot pattern to ensure cleanup happens exactly once.
signal(event: IStrategyTickResult): Promise<void>;
Handles signal events from all modes (live + backtest).
signalLive(event: IStrategyTickResult): Promise<void>;
Handles signal events from live trading only.
signalBacktest(event: IStrategyTickResult): Promise<void>;
Handles signal events from backtest only.
breakevenAvailable(event: BreakevenContract): Promise<void>;
Handles breakeven events when stop-loss is moved to entry price.
partialProfitAvailable(event: PartialProfitContract): Promise<void>;
Handles partial profit level events (10%, 20%, 30%, etc).
partialLossAvailable(event: PartialLossContract): Promise<void>;
Handles partial loss level events (-10%, -20%, -30%, etc).
pingScheduled(event: SchedulePingContract): Promise<void>;
Handles scheduled ping events during scheduled signal monitoring.
scheduleEvent(event: ScheduleEventContract): Promise<void>;
Handles scheduled signal lifecycle events (creation / cancellation).
Manual wiring — EVENT-BASED: users implement IActionCallbacks.onScheduleEvent (via addActionSchema)
to drive the exchange (commitActivateScheduled / commitCancelScheduled); see that contract
for the full guidance and example. This internal dispatch forwards to the handler/callback.
pendingEvent(event: SignalEventContract): Promise<void>;
Handles pending signal lifecycle events (open / close).
Manual wiring — EVENT-BASED: users implement IActionCallbacks.onPendingEvent (via addActionSchema) to
drive the exchange; for per-tick fills use onPingActive. See that contract for the full
guidance and example. This internal dispatch forwards to the handler/callback.
pingActive(event: ActivePingContract): Promise<void>;
Handles active ping events during active pending signal monitoring.
pingIdle(event: IdlePingContract): Promise<void>;
Handles idle ping events when no signal is active.
riskRejection(event: RiskContract): Promise<void>;
Handles risk rejection events when signals fail risk validation.
signalSync(event: SignalSyncContract): Promise<void>;
Gate for position open/close via limit order. NOT wrapped in trycatch — exceptions propagate to CREATE_SYNC_FN.
orderCheck(event: SignalPingContract): Promise<void>;
Gate for the pending-order ping (order still open on exchange?). NOT wrapped in trycatch — exceptions propagate to CREATE_SYNC_PENDING_FN.