Interface IPersistRiskInstance

Per-context risk positions persistence instance interface. Scoped to a specific (riskName, exchangeName) pair.

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

interface IPersistRiskInstance {
    readPositionData(when: Date): Promise<RiskData>;
    waitForInit(initial: boolean): Promise<void>;
    writePositionData(riskRow: RiskData, when: Date): Promise<void>;
}

Implemented by

Methods

  • Read persisted active positions for this context.

    Parameters

    • when: Date

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

    Returns Promise<RiskData>

    Promise resolving to position entries (empty array if none persisted)

  • Initialize storage for this risk context.

    Parameters

    • initial: boolean

      Whether this is the first initialization

    Returns Promise<void>

    Promise that resolves when initialization is complete

  • Write active positions for this context.

    Parameters

    • riskRow: RiskData

      Position entries to persist

    • when: Date

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

    Returns Promise<void>

    Promise that resolves when write is complete