Reads the session value scoped to the current (symbol, strategy, exchange, frame) context.
Session data persists across candles within a single run and can survive process
restarts in live mode — useful for caching LLM inference results, intermediate
indicator state, or any cross-candle accumulator that is not tied to a specific signal.
Automatically detects backtest/live mode from execution context.
Promise resolving to current session value, or null if not set
Example
import { getSession } from"backtest-kit";
constsession = awaitgetSession<{ lastLlmSignal: string }>("BTCUSDT"); if (session?.lastLlmSignal === "buy") { // reuse cached LLM result instead of calling the model again }
Reads the session value scoped to the current (symbol, strategy, exchange, frame) context.
Session data persists across candles within a single run and can survive process restarts in live mode — useful for caching LLM inference results, intermediate indicator state, or any cross-candle accumulator that is not tied to a specific signal.
Automatically detects backtest/live mode from execution context.