Type Alias BrokerOrderOpenPayload

BrokerOrderOpenPayload: {
    attempt: number;
    backtest: boolean;
    context: {
        exchangeName: ExchangeName;
        frameName?: FrameName;
        strategyName: StrategyName;
    };
    cost: number;
    maxDrawdown: IStrategyPnL;
    peakProfit: IStrategyPnL;
    pnl: IStrategyPnL;
    position: "long"
    | "short";
    priceOpen: number;
    priceStopLoss: number;
    priceTakeProfit: number;
    signalId: string;
    symbol: string;
    type: "schedule" | "active";
    when: Date;
}

Payload for the signal-open broker event.

Emitted automatically via syncSubject and forwarded to the registered IBroker adapter via onOrderOpenCommit. Discriminated by type:

  • "active" — a pending signal is being opened (immediate entry or activation fill of the resting order);
  • "schedule" — the resting entry order is being PLACED (scheduled signal creation).

Throw semantics (see IBrokerOrderVerdict): a plain Error / OrderTransientError rolls the open back and retries identity-stably (same signalId, attempt increments) up to CC_ORDER_OPEN_RETRY_ATTEMPTS; OrderRejectedError drops the open terminally without arming the retry.

Type declaration

  • attempt: number

    Consecutive prior rejections of this open by the gate (0 = first attempt). Managed by the framework: a rejected open increments the counter carried by the identity-stable retry (same signalId, bounded by CC_ORDER_OPEN_RETRY_ATTEMPTS); a confirmed open resets it. Lets the adapter distinguish a fresh placement from a retry of an order it may have already placed (reconcile by clientOrderId = signalId).

  • backtest: boolean

    true when called during a backtest run — adapter should skip exchange calls

  • context: {
        exchangeName: ExchangeName;
        frameName?: FrameName;
        strategyName: StrategyName;
    }

    Strategy/exchange/frame routing context

  • cost: number

    Dollar cost of the position entry (CC_POSITION_ENTRY_COST)

  • maxDrawdown: IStrategyPnL

    Maximum drawdown experienced during the life of this position up to the moment this public signal was created

  • peakProfit: IStrategyPnL

    Peak profit achieved during the life of this position up to the moment this public signal was created

  • pnl: IStrategyPnL

    Market price at the moment of activation (VWAP or candle average)

  • position: "long" | "short"

    Position direction

  • priceOpen: number

    Activation price — the price at which the signal became active

  • priceStopLoss: number

    Original stop-loss price from the signal

  • priceTakeProfit: number

    Original take-profit price from the signal

  • signalId: string

    Unique signal identifier (UUID v4) the order belongs to

  • symbol: string

    Trading pair symbol, e.g. "BTCUSDT"

  • type: "schedule" | "active"

    Which order is being opened: "active" — position entry, "schedule" — resting entry order placement

  • when: Date

    Virtual time of the event: candle timestamp in backtest, wall-clock tick time in live

const payload: BrokerOrderOpenPayload = {
symbol: "BTCUSDT",
cost: 100,
position: "long",
priceOpen: 50000,
priceTakeProfit: 55000,
priceStopLoss: 48000,
context: { strategyName: "my-strategy", exchangeName: "binance", frameName: "1h" },
backtest: false,
};