RiskContract

Contract for risk rejection events.

Emitted by riskSubject ONLY when a signal is REJECTED due to risk validation failure. Used for tracking actual risk violations and monitoring rejected signals.

Events are emitted only when risk limits are violated (not for allowed signals). This prevents spam and allows focusing on actual risk management interventions.

Consumers:

  • RiskMarkdownService: Accumulates rejection events for report generation
  • User callbacks via listenRisk() / listenRiskOnce()
symbol: string

Trading pair symbol (e.g., "BTCUSDT"). Identifies which market this rejected signal belongs to.

pendingSignal: ISignalDto

Pending signal to apply. Contains signal details (position, priceOpen, priceTakeProfit, priceStopLoss, etc).

strategyName: string

Strategy name requesting to open a position. Identifies which strategy attempted to create the signal.

frameName: string

Frame name used in backtest execution. Identifies which frame this signal was for in backtest execution.

exchangeName: string

Exchange name. Identifies which exchange this signal was for.

currentPrice: number

Current VWAP price at the time of rejection. Market price when risk check was performed.

activePositionCount: number

Number of currently active positions across all strategies at rejection time. Used to track portfolio-level exposure when signal was rejected.

rejectionId: string

Unique identifier for this rejection instance. Generated by ClientRisk for tracking and debugging purposes. Null if validation threw exception without custom ID.

rejectionNote: string

Human-readable reason why the signal was rejected. Captured from IRiskValidation.note or error message.

timestamp: number

Event timestamp in milliseconds since Unix epoch. Represents when the signal was rejected.

backtest: boolean

Whether this event is from backtest mode (true) or live mode (false). Used to separate backtest and live risk rejection tracking.