Interface SignalInfoContract

Contract for signal info notification events.

Emitted by signalNotifySubject when a strategy calls commitSignalInfo() to broadcast a user-defined informational message for an open position. Used for custom strategy annotations, debug output, and external notification routing.

Consumers:

  • User callbacks via listenSignalNotify() / listenSignalNotifyOnce()
import { listenSignalNotify } from "backtest-kit";

// Listen to all signal info events
listenSignalNotify((event) => {
console.log(`[${event.backtest ? "Backtest" : "Live"}] Signal ${event.data.id}: ${event.note}`);
console.log(`Symbol: ${event.symbol}, Price: ${event.currentPrice}`);
});

// Wait for the first info event on BTCUSDT
listenSignalNotifyOnce(
(event) => event.symbol === "BTCUSDT",
(event) => console.log("BTCUSDT info:", event.note)
);
interface SignalInfoContract {
    backtest: boolean;
    currentPrice: number;
    data: IPublicSignalRow;
    exchangeName: string;
    frameName: string;
    note: string;
    notificationId?: string;
    strategyName: string;
    symbol: string;
    timestamp: number;
}

Properties

backtest: boolean

Execution mode flag.

  • true: Event from backtest execution (historical candle data)
  • false: Event from live trading (real-time tick)
currentPrice: number

Current market price at the moment the info event was emitted.

Complete signal row data with original prices. Contains all signal information including originalPriceStopLoss, originalPriceTakeProfit, and partialExecuted.

exchangeName: string

Exchange name where this signal is being executed. Identifies which exchange this info event belongs to.

frameName: string

Frame name where this signal is being executed. Identifies which frame this info event belongs to (empty string for live mode).

note: string

User-defined informational note attached to this event. Provided by the strategy when calling commitSignalInfo().

notificationId?: string

Optional user-defined identifier for correlating this event with external systems. Provided by the strategy when calling commitSignalInfo().

strategyName: string

Strategy name that generated this signal. Identifies which strategy execution this info event belongs to.

symbol: string

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

timestamp: number

Event timestamp in milliseconds since Unix epoch.

Timing semantics:

  • Live mode: when.getTime() at the moment the info event was emitted
  • Backtest mode: candle.timestamp of the candle that triggered the event