Type Alias BrokerOrderOpenPayload

BrokerOrderOpenPayload: {
    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";
}

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); throw = the exchange did not fill the entry, the framework rolls back the open and retries on the next tick;
  • "schedule" — the resting entry order is being PLACED (scheduled signal creation); throw = the exchange did not accept the resting order, the scheduled signal is NOT registered and the placement retries on the next tick.

Type declaration

  • 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

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,
};