Function commitCreateSignal

  • Queues a user-supplied signal DTO to be consumed by the next tick instead of params.getSignal.

    priceOpen decides the outcome via the existing pipeline: omitted → opens immediately at the current price; provided → opens immediately if already reached, otherwise registers a scheduled (priceOpen-awaiting) signal. The DTO is validated (reusing validateSignal) and the call is rejected if a signal or deferred action is already in flight.

    Automatically detects backtest/live mode from execution context.

    Parameters

    • symbol: string

      Trading pair symbol

    • dto: ISignalDto

      Signal DTO to open (priceOpen optional)

    Returns Promise<void>

    Promise that resolves when the DTO is queued

    import { createSignal } from "backtest-kit";

    // Open immediately at current price
    await commitCreateSignal("BTCUSDT", { position: "long", priceTakeProfit: 110, priceStopLoss: 90 });