Interface IPersistPartialInstance

Per-context partial profit/loss levels persistence instance interface. Scoped to a specific (symbol, strategyName, exchangeName) triple.

Each signal's partial data is stored under its own signalId key within the context-scoped storage.

Custom adapters should implement this interface to override the default file-based partial data persistence behavior.

interface IPersistPartialInstance {
    readPartialData(signalId: string, when: Date): Promise<PartialData>;
    waitForInit(initial: boolean): Promise<void>;
    writePartialData(
        data: PartialData,
        signalId: string,
        when: Date,
    ): Promise<void>;
}

Implemented by

Methods

  • Read persisted partial data for a specific signal.

    Parameters

    • signalId: string

      Signal identifier

    • when: Date

      Logical timestamp at which the read is happening (reserved for API consistency)

    Returns Promise<PartialData>

    Promise resolving to partial data record (empty object if none persisted)

  • Initialize storage for this partial context.

    Parameters

    • initial: boolean

      Whether this is the first initialization

    Returns Promise<void>

    Promise that resolves when initialization is complete

  • Write partial data for a specific signal.

    Parameters

    • data: PartialData

      Partial data record to persist

    • signalId: string

      Signal identifier

    • when: Date

      Logical timestamp this write belongs to (reserved for API consistency)

    Returns Promise<void>

    Promise that resolves when write is complete