Utility class for managing candles cache persistence.
Features:
Used by ClientExchange for candle data caching.
constructor();
PersistCandlesFactory: any
getCandlesStorage: any
readCandlesData: (symbol: string, interval: CandleInterval, exchangeName: string, limit: number, sinceTimestamp: number, _untilTimestamp: number) => Promise<ICandleData[]>
Reads cached candles for a specific exchange, symbol, and interval. Returns candles only if cache contains ALL requested candles.
Algorithm (matches ClientExchange.ts logic):
writeCandlesData: (candles: ICandleData[], symbol: string, interval: CandleInterval, exchangeName: string) => Promise<void>
Writes candles to cache with atomic file writes. Each candle is stored as a separate JSON file named by its timestamp.
The candles passed to this function should be validated candles from the adapter:
usePersistCandleAdapter(Ctor: TPersistBaseCtor<string, CandleData>): void;
Registers a custom persistence adapter.
useJson(): void;
Switches to the default JSON persist adapter. All future persistence writes will use JSON storage.
useDummy(): void;
Switches to a dummy persist adapter that discards all writes. All future persistence writes will be no-ops.