Function setStrategyPaused

  • Pauses or resumes new position opening for the strategy.

    While paused getSignal is NOT called and a queued createSignal DTO is NOT consumed (it stays queued and drains after resume); existing pending/scheduled signals keep being monitored and close normally. The flag is persisted and survives restarts and signal transitions until an explicit setStrategyPaused(symbol, false). When the flag actually flips, a PauseContract event is emitted (see listenPause) for notification generation.

    Automatically detects backtest/live mode from execution context.

    Parameters

    • symbol: string

      Trading pair symbol

    • paused: boolean

      New paused state

    Returns Promise<void>

    Promise that resolves when the flag is set (and persisted in live mode)

    import { setStrategyPaused } from "backtest-kit";

    // Suspend automatic generation; open position keeps closing normally
    await setStrategyPaused("BTCUSDT", true);