Function getMinutesSinceLatestSignalCreated

  • Returns the number of whole minutes elapsed since the latest signal's creation timestamp.

    Does not distinguish between active and closed signals — measures time since whichever signal was recorded last. Useful for cooldown logic after a stop-loss.

    Searches backtest storage first, then live storage. Returns null if no signal exists at all.

    Automatically detects backtest/live mode from execution context.

    Parameters

    • symbol: string

      Trading pair symbol

    Returns Promise<number>

    Promise resolving to whole minutes since the latest signal was created, or null

    import { getMinutesSinceLatestSignalCreated } from "backtest-kit";

    const minutes = await getMinutesSinceLatestSignalCreated("BTCUSDT");
    if (minutes !== null && minutes < 24 * 60) {
    return; // cooldown — skip new signal for 24 hours after last signal
    }