Interface ISessionInstance

Interface for session instance implementations. Defines the contract for local, persist, and dummy backends.

Intended use: per-(symbol, strategy, exchange, frame) mutable session data shared across strategy callbacks within a single run — e.g. caching LLM inference results, intermediate indicator state, or cross-candle accumulators.

Example shape:

{ lastLlmSignal: "buy" | "sell" | null; confirmedAt: number }
interface ISessionInstance {
    dispose(): Promise<void>;
    getData<Value extends object = object>(): Promise<Value>;
    setData<Value extends object = object>(value: Value): Promise<void>;
    waitForInit(initial: boolean): Promise<void>;
}

Methods

  • Releases any resources held by this instance.

    Returns Promise<void>

  • Read the current session value.

    Type Parameters

    • Value extends object = object

    Returns Promise<Value>

    Current session value, or null if not set

  • Write a new session value.

    Type Parameters

    • Value extends object = object

    Parameters

    • value: Value

      New value or null to clear

    Returns Promise<void>

  • Initialize the session instance.

    Parameters

    • initial: boolean

      Whether this is the first initialization

    Returns Promise<void>