Interface OrderStopContract

Post-verdict order-check STOP event.

The terminal counterpart of OrderContinueContract: the framework decided the order behind the monitored signal is NO LONGER open on the exchange and acts terminally — for type: "active" the pending position closes with closeReason "closed", for type: "schedule" the scheduled signal cancels (reason "user"). Emitted exactly once per monitored signal, right BEFORE the teardown runs.

reason tells which terminal path fired:

  • "deleted" — the adapter threw OrderDeletedError: the CONFIRMED "order not found by id" (filled, cancelled or liquidated externally), terminal at once, bypassing the tolerance counter;
  • "exhausted" — CC_ORDER_CHECK_RETRY_ATTEMPTS consecutive transient failures spent (or the config is 0 — legacy: any failure is terminal on the spot). For genuine network exhaustion the engine also signals a fatal exit.

Live-only: backtest never runs order checks. Notification-only channel: listener exceptions are swallowed at the emission site (logged + errorEmitter) and never affect the already-made terminal decision.

interface OrderStopContract {
    attempt: number;
    backtest: boolean;
    currentPrice: number;
    exchangeName: string;
    frameName: string;
    maxDrawdown: IStrategyPnL;
    originalPriceOpen: number;
    originalPriceStopLoss: number;
    originalPriceTakeProfit: number;
    peakProfit: IStrategyPnL;
    pendingAt: number;
    pnl: IStrategyPnL;
    position: "long" | "short";
    priceOpen: number;
    priceStopLoss: number;
    priceTakeProfit: number;
    reason: "deleted" | "exhausted";
    scheduledAt: number;
    signal: IPublicSignalRow;
    signalId: string;
    strategyName: string;
    symbol: string;
    timestamp: number;
    totalEntries: number;
    totalPartials: number;
    type: "active" | "schedule";
}

Properties

attempt: number

Consecutive-failure streak at termination (0 for an immediate "deleted" verdict)

backtest: boolean

Always false: order checks are live-only (kept for cross-channel filter uniformity)

currentPrice: number

Market price at the moment of the check (VWAP)

exchangeName: string

Exchange name where signal was executed

frameName: string

Timeframe name (empty string in live mode)

maxDrawdown: IStrategyPnL

Maximum drawdown experienced during the life of this position up to this event

originalPriceOpen: number

Original entry price before any DCA averaging (initial priceOpen)

originalPriceStopLoss: number

Original stop loss price before any trailing adjustments

originalPriceTakeProfit: number

Original take profit price before any trailing adjustments

peakProfit: IStrategyPnL

Peak profit achieved during the life of this position up to this event

pendingAt: number

Position activation timestamp in milliseconds

Unrealized PNL of the position at the moment of this event

position: "long" | "short"

Trade direction: "long" (buy) or "short" (sell)

priceOpen: number

Effective entry price (may differ from priceOpen after DCA averaging)

priceStopLoss: number

Effective stop loss price (may differ from original after trailing)

priceTakeProfit: number

Effective take profit price (may differ from original after trailing)

reason: "deleted" | "exhausted"

Which terminal path fired: confirmed not-found ("deleted") or tolerance spent ("exhausted")

scheduledAt: number

Signal creation timestamp in milliseconds

Complete public signal row at the moment of this event

signalId: string

Unique signal identifier (UUID v4)

strategyName: string

Strategy name that generated this signal

symbol: string

Trading pair symbol (e.g., "BTCUSDT")

timestamp: number

Timestamp from execution context (tick's when)

totalEntries: number

Total number of DCA entries (_entry.length). 1 = no averaging done.

totalPartials: number

Total number of partial closes executed (_partial.length). 0 = none.

type: "active" | "schedule"

Monitored state: "active" — open position order, "schedule" — resting entry order