Utility class for managing candles cache persistence.
Features:
Used by ClientExchange for candle data caching.
constructor();
PersistCandleInstanceCtor: any
Constructor used to create per-context candle cache instances. Replaceable via usePersistCandleAdapter() / useJson() / useDummy().
getCandlesStorage: any
Memoized factory creating one IPersistCandleInstance per (symbol, interval, exchange) triple.
readCandlesData: (symbol: string, interval: CandleInterval, exchangeName: string, limit: number, sinceTimestamp: number, untilTimestamp: number) => Promise<ICandleData[]>
Reads cached candles for the given context and time window. Lazily initializes the instance on first access.
writeCandlesData: (candles: ICandleData[], symbol: string, interval: CandleInterval, exchangeName: string) => Promise<void>
Writes candles to cache for the given context. Lazily initializes the instance on first access.
usePersistCandleAdapter(Ctor: TPersistCandleInstanceCtor): void;
Registers a custom IPersistCandleInstance constructor. Clears the memoization cache so subsequent calls use the new adapter.
clear(): void;
Clears the memoized instance cache. Call when process.cwd() changes between strategy iterations.
useJson(): void;
Switches to the default file-based PersistCandleInstance.
useDummy(): void;
Switches to PersistCandleDummyInstance (always returns null on read, discards writes).