Type Alias BrokerSignalPendingPayload

BrokerSignalPendingPayload: {
    backtest: boolean;
    context: {
        exchangeName: ExchangeName;
        frameName?: FrameName;
        strategyName: StrategyName;
    };
    currentPrice: number;
    maxDrawdown: IStrategyPnL;
    peakProfit: IStrategyPnL;
    pnl: IStrategyPnL;
    position: "long"
    | "short";
    priceOpen: number;
    priceStopLoss: number;
    priceTakeProfit: number;
    signalId: string;
    symbol: string;
    totalEntries: number;
    totalPartials: number;
}

Payload for the pending-order synchronization broker event.

Emitted automatically via syncPendingSubject on every live tick while a pending signal is monitored, BEFORE the framework evaluates TP/SL/time. Forwarded to the registered IBroker adapter via onOrderCheck.

The adapter should query the exchange by signalId and THROW ONLY when the order is definitively NOT FOUND by that id (filled, cancelled, or liquidated externally). A throw propagates to CREATE_SYNC_PENDING_FN, which makes the framework close the pending signal with closeReason "closed". Returning normally keeps the position under normal TP/SL monitoring.

CRITICAL: transient/network errors (timeout, 5xx, rate limit, disconnect) must be SWALLOWED — return normally instead of throwing. A thrown network error would wrongly close an open position. Only a confirmed "order not found by id" response is a valid reason to throw.

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

  • currentPrice: number

    Market price at the moment of the ping

  • maxDrawdown: IStrategyPnL

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

  • peakProfit: IStrategyPnL

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

  • pnl: IStrategyPnL

    Unrealized PnL of the open position at the moment of the ping

  • position: "long" | "short"

    Position direction

  • priceOpen: number

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

  • priceStopLoss: number

    Effective stop-loss price at the moment of the ping

  • priceTakeProfit: number

    Effective take-profit price at the moment of the ping

  • signalId: string

    Unique signal identifier (UUID v4) the order belongs to

  • symbol: string

    Trading pair symbol, e.g. "BTCUSDT"

  • totalEntries: number

    Total number of DCA entries (including initial open)

  • totalPartials: number

    Total number of partial closes executed

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