backtest-kit 6.3.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.cjs CHANGED
@@ -51140,12 +51140,14 @@ const NotificationLive = new NotificationLiveAdapter();
51140
51140
  */
51141
51141
  const NotificationBacktest = new NotificationBacktestAdapter();
51142
51142
 
51143
- const CACHE_METHOD_NAME_FLUSH = "CacheUtils.flush";
51144
- const CACHE_METHOD_NAME_CLEAR = "CacheInstance.clear";
51145
51143
  const CACHE_METHOD_NAME_RUN = "CacheInstance.run";
51146
- const CACHE_METHOD_NAME_GC = "CacheInstance.gc";
51147
51144
  const CACHE_METHOD_NAME_FN = "CacheUtils.fn";
51145
+ const CACHE_METHOD_NAME_FN_CLEAR = "CacheUtils.fn.clear";
51146
+ const CACHE_METHOD_NAME_FN_GC = "CacheUtils.fn.gc";
51148
51147
  const CACHE_METHOD_NAME_FILE = "CacheUtils.file";
51148
+ const CACHE_METHOD_NAME_FILE_CLEAR = "CacheUtils.file.clear";
51149
+ const CACHE_METHOD_NAME_DISPOSE = "CacheUtils.dispose";
51150
+ const CACHE_METHOD_NAME_CLEAR = "CacheUtils.clear";
51149
51151
  const CACHE_FILE_INSTANCE_METHOD_NAME_RUN = "CacheFileInstance.run";
51150
51152
  const MS_PER_MINUTE = 60000;
51151
51153
  const INTERVAL_MINUTES = {
@@ -51394,6 +51396,12 @@ class CacheFileInstance {
51394
51396
  static createIndex() {
51395
51397
  return CacheFileInstance._indexCounter++;
51396
51398
  }
51399
+ /**
51400
+ * Clears the index counter.
51401
+ */
51402
+ static clearCounter() {
51403
+ CacheFileInstance._indexCounter = 0;
51404
+ }
51397
51405
  /**
51398
51406
  * Creates a new CacheFileInstance.
51399
51407
  *
@@ -51527,6 +51535,26 @@ class CacheUtils {
51527
51535
  const instance = this._getFnInstance(run, context.interval, context.key);
51528
51536
  return instance.run(...args).value;
51529
51537
  };
51538
+ wrappedFn.clear = () => {
51539
+ bt.loggerService.info(CACHE_METHOD_NAME_FN_CLEAR);
51540
+ if (!MethodContextService.hasContext()) {
51541
+ bt.loggerService.warn(`${CACHE_METHOD_NAME_FN_CLEAR} called without method context, skipping`);
51542
+ return;
51543
+ }
51544
+ if (!ExecutionContextService.hasContext()) {
51545
+ bt.loggerService.warn(`${CACHE_METHOD_NAME_FN_CLEAR} called without execution context, skipping`);
51546
+ return;
51547
+ }
51548
+ this._getFnInstance.get(run)?.clear();
51549
+ };
51550
+ wrappedFn.gc = () => {
51551
+ bt.loggerService.info(CACHE_METHOD_NAME_FN_GC);
51552
+ if (!ExecutionContextService.hasContext()) {
51553
+ bt.loggerService.warn(`${CACHE_METHOD_NAME_FN_GC} called without execution context, skipping`);
51554
+ return;
51555
+ }
51556
+ return this._getFnInstance.get(run)?.gc();
51557
+ };
51530
51558
  return wrappedFn;
51531
51559
  };
51532
51560
  /**
@@ -51573,117 +51601,51 @@ class CacheUtils {
51573
51601
  const instance = this._getFileInstance(run, context.interval, context.name, context.key);
51574
51602
  return instance.run(...args);
51575
51603
  };
51604
+ wrappedFn.clear = () => {
51605
+ bt.loggerService.info(CACHE_METHOD_NAME_FILE_CLEAR);
51606
+ this._getFileInstance.clear(run);
51607
+ };
51576
51608
  return wrappedFn;
51577
51609
  };
51578
51610
  /**
51579
- * Flush (remove) cached CacheInstance for a specific function or all functions.
51580
- *
51581
- * This method removes CacheInstance objects from the internal memoization cache.
51582
- * When a CacheInstance is flushed, all cached results across all contexts
51583
- * (all strategy/exchange/mode combinations) for that function are discarded.
51584
- *
51585
- * Use cases:
51586
- * - Remove specific function's CacheInstance when implementation changes
51587
- * - Free memory by removing unused CacheInstances
51588
- * - Reset all CacheInstances when switching between different test scenarios
51589
- *
51590
- * Note: This is different from `clear()` which only removes cached values
51591
- * for the current context within an existing CacheInstance.
51592
- *
51593
- * @template T - Function type
51594
- * @param run - Optional function to flush CacheInstance for. If omitted, flushes all CacheInstances.
51595
- *
51596
- * @example
51597
- * ```typescript
51598
- * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
51599
- *
51600
- * // Flush CacheInstance for specific function
51601
- * Cache.flush(calculateIndicator);
51602
- *
51603
- * // Flush all CacheInstances
51604
- * Cache.flush();
51605
- * ```
51606
- */
51607
- this.flush = (run) => {
51608
- bt.loggerService.info(CACHE_METHOD_NAME_FLUSH, {
51609
- run,
51610
- });
51611
- this._getFnInstance.clear(run);
51612
- };
51613
- /**
51614
- * Clear cached value for current execution context of a specific function.
51611
+ * Dispose (remove) the memoized CacheInstance for a specific function.
51615
51612
  *
51616
- * Removes the cached entry for the current strategy/exchange/mode combination
51617
- * from the specified function's CacheInstance. The next call to the wrapped function
51618
- * will recompute the value for that context.
51619
- *
51620
- * This only clears the cache for the current execution context, not all contexts.
51621
- * Use `flush()` to remove the entire CacheInstance across all contexts.
51622
- *
51623
- * Requires active execution context (strategy, exchange, backtest mode) and method context.
51613
+ * Removes the CacheInstance from the internal memoization cache, discarding all cached
51614
+ * results across all contexts (all strategy/exchange/mode combinations) for that function.
51615
+ * The next call to the wrapped function will create a fresh CacheInstance.
51624
51616
  *
51625
51617
  * @template T - Function type
51626
- * @param run - Function whose cache should be cleared for current context
51618
+ * @param run - Function whose CacheInstance should be disposed.
51627
51619
  *
51628
51620
  * @example
51629
51621
  * ```typescript
51630
51622
  * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
51631
51623
  *
51632
- * // Within strategy execution context
51633
- * const result1 = cachedFn("BTCUSDT", 14); // Computed
51634
- * const result2 = cachedFn("BTCUSDT", 14); // Cached
51635
- *
51636
- * Cache.clear(calculateIndicator); // Clear cache for current context only
51637
- *
51638
- * const result3 = cachedFn("BTCUSDT", 14); // Recomputed for this context
51639
- * // Other contexts (different strategies/exchanges) remain cached
51624
+ * // Dispose CacheInstance for a specific function
51625
+ * Cache.dispose(calculateIndicator);
51640
51626
  * ```
51641
51627
  */
51642
- this.clear = (run) => {
51643
- bt.loggerService.info(CACHE_METHOD_NAME_CLEAR, {
51628
+ this.dispose = (run) => {
51629
+ bt.loggerService.info(CACHE_METHOD_NAME_DISPOSE, {
51644
51630
  run,
51645
51631
  });
51646
- if (!MethodContextService.hasContext()) {
51647
- console.warn(`${CACHE_METHOD_NAME_CLEAR} called without method context, skipping clear`);
51648
- return;
51649
- }
51650
- if (!ExecutionContextService.hasContext()) {
51651
- console.warn(`${CACHE_METHOD_NAME_CLEAR} called without execution context, skipping clear`);
51652
- return;
51632
+ {
51633
+ this._getFnInstance.clear(run);
51634
+ this._getFileInstance.clear(run);
51653
51635
  }
51654
- this._getFnInstance.get(run).clear();
51655
51636
  };
51656
51637
  /**
51657
- * Garbage collect expired cache entries for a specific function.
51658
- *
51659
- * Removes all cached entries whose interval has expired (not aligned with current time).
51660
- * Call this periodically to free memory from stale cache entries.
51661
- *
51662
- * Requires active execution context to get current time.
51663
- *
51664
- * @template T - Function type
51665
- * @param run - Function whose expired cache entries should be removed
51666
- * @returns Number of entries removed
51667
- *
51668
- * @example
51669
- * ```typescript
51670
- * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
51671
- *
51672
- * cachedFn("BTCUSDT", 14); // Cached at 10:00
51673
- * cachedFn("ETHUSDT", 14); // Cached at 10:00
51674
- * // Time passes to 11:00
51675
- * const removed = Cache.gc(calculateIndicator); // Returns 2
51676
- * ```
51638
+ * Clears all memoized CacheInstance and CacheFileInstance objects.
51639
+ * Call this when process.cwd() changes between strategy iterations
51640
+ * so new instances are created with the updated base path.
51677
51641
  */
51678
- this.gc = (run) => {
51679
- bt.loggerService.info(CACHE_METHOD_NAME_GC, {
51680
- run,
51681
- });
51682
- if (!ExecutionContextService.hasContext()) {
51683
- console.warn(`${CACHE_METHOD_NAME_GC} called without execution context, skipping garbage collection`);
51684
- return;
51642
+ this.clear = () => {
51643
+ bt.loggerService.info(CACHE_METHOD_NAME_CLEAR);
51644
+ {
51645
+ this._getFnInstance.clear();
51646
+ this._getFileInstance.clear();
51685
51647
  }
51686
- return this._getFnInstance.get(run).gc();
51648
+ CacheFileInstance.clearCounter();
51687
51649
  };
51688
51650
  }
51689
51651
  }
package/build/index.mjs CHANGED
@@ -51120,12 +51120,14 @@ const NotificationLive = new NotificationLiveAdapter();
51120
51120
  */
51121
51121
  const NotificationBacktest = new NotificationBacktestAdapter();
51122
51122
 
51123
- const CACHE_METHOD_NAME_FLUSH = "CacheUtils.flush";
51124
- const CACHE_METHOD_NAME_CLEAR = "CacheInstance.clear";
51125
51123
  const CACHE_METHOD_NAME_RUN = "CacheInstance.run";
51126
- const CACHE_METHOD_NAME_GC = "CacheInstance.gc";
51127
51124
  const CACHE_METHOD_NAME_FN = "CacheUtils.fn";
51125
+ const CACHE_METHOD_NAME_FN_CLEAR = "CacheUtils.fn.clear";
51126
+ const CACHE_METHOD_NAME_FN_GC = "CacheUtils.fn.gc";
51128
51127
  const CACHE_METHOD_NAME_FILE = "CacheUtils.file";
51128
+ const CACHE_METHOD_NAME_FILE_CLEAR = "CacheUtils.file.clear";
51129
+ const CACHE_METHOD_NAME_DISPOSE = "CacheUtils.dispose";
51130
+ const CACHE_METHOD_NAME_CLEAR = "CacheUtils.clear";
51129
51131
  const CACHE_FILE_INSTANCE_METHOD_NAME_RUN = "CacheFileInstance.run";
51130
51132
  const MS_PER_MINUTE = 60000;
51131
51133
  const INTERVAL_MINUTES = {
@@ -51374,6 +51376,12 @@ class CacheFileInstance {
51374
51376
  static createIndex() {
51375
51377
  return CacheFileInstance._indexCounter++;
51376
51378
  }
51379
+ /**
51380
+ * Clears the index counter.
51381
+ */
51382
+ static clearCounter() {
51383
+ CacheFileInstance._indexCounter = 0;
51384
+ }
51377
51385
  /**
51378
51386
  * Creates a new CacheFileInstance.
51379
51387
  *
@@ -51507,6 +51515,26 @@ class CacheUtils {
51507
51515
  const instance = this._getFnInstance(run, context.interval, context.key);
51508
51516
  return instance.run(...args).value;
51509
51517
  };
51518
+ wrappedFn.clear = () => {
51519
+ bt.loggerService.info(CACHE_METHOD_NAME_FN_CLEAR);
51520
+ if (!MethodContextService.hasContext()) {
51521
+ bt.loggerService.warn(`${CACHE_METHOD_NAME_FN_CLEAR} called without method context, skipping`);
51522
+ return;
51523
+ }
51524
+ if (!ExecutionContextService.hasContext()) {
51525
+ bt.loggerService.warn(`${CACHE_METHOD_NAME_FN_CLEAR} called without execution context, skipping`);
51526
+ return;
51527
+ }
51528
+ this._getFnInstance.get(run)?.clear();
51529
+ };
51530
+ wrappedFn.gc = () => {
51531
+ bt.loggerService.info(CACHE_METHOD_NAME_FN_GC);
51532
+ if (!ExecutionContextService.hasContext()) {
51533
+ bt.loggerService.warn(`${CACHE_METHOD_NAME_FN_GC} called without execution context, skipping`);
51534
+ return;
51535
+ }
51536
+ return this._getFnInstance.get(run)?.gc();
51537
+ };
51510
51538
  return wrappedFn;
51511
51539
  };
51512
51540
  /**
@@ -51553,117 +51581,51 @@ class CacheUtils {
51553
51581
  const instance = this._getFileInstance(run, context.interval, context.name, context.key);
51554
51582
  return instance.run(...args);
51555
51583
  };
51584
+ wrappedFn.clear = () => {
51585
+ bt.loggerService.info(CACHE_METHOD_NAME_FILE_CLEAR);
51586
+ this._getFileInstance.clear(run);
51587
+ };
51556
51588
  return wrappedFn;
51557
51589
  };
51558
51590
  /**
51559
- * Flush (remove) cached CacheInstance for a specific function or all functions.
51560
- *
51561
- * This method removes CacheInstance objects from the internal memoization cache.
51562
- * When a CacheInstance is flushed, all cached results across all contexts
51563
- * (all strategy/exchange/mode combinations) for that function are discarded.
51564
- *
51565
- * Use cases:
51566
- * - Remove specific function's CacheInstance when implementation changes
51567
- * - Free memory by removing unused CacheInstances
51568
- * - Reset all CacheInstances when switching between different test scenarios
51569
- *
51570
- * Note: This is different from `clear()` which only removes cached values
51571
- * for the current context within an existing CacheInstance.
51572
- *
51573
- * @template T - Function type
51574
- * @param run - Optional function to flush CacheInstance for. If omitted, flushes all CacheInstances.
51575
- *
51576
- * @example
51577
- * ```typescript
51578
- * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
51579
- *
51580
- * // Flush CacheInstance for specific function
51581
- * Cache.flush(calculateIndicator);
51582
- *
51583
- * // Flush all CacheInstances
51584
- * Cache.flush();
51585
- * ```
51586
- */
51587
- this.flush = (run) => {
51588
- bt.loggerService.info(CACHE_METHOD_NAME_FLUSH, {
51589
- run,
51590
- });
51591
- this._getFnInstance.clear(run);
51592
- };
51593
- /**
51594
- * Clear cached value for current execution context of a specific function.
51591
+ * Dispose (remove) the memoized CacheInstance for a specific function.
51595
51592
  *
51596
- * Removes the cached entry for the current strategy/exchange/mode combination
51597
- * from the specified function's CacheInstance. The next call to the wrapped function
51598
- * will recompute the value for that context.
51599
- *
51600
- * This only clears the cache for the current execution context, not all contexts.
51601
- * Use `flush()` to remove the entire CacheInstance across all contexts.
51602
- *
51603
- * Requires active execution context (strategy, exchange, backtest mode) and method context.
51593
+ * Removes the CacheInstance from the internal memoization cache, discarding all cached
51594
+ * results across all contexts (all strategy/exchange/mode combinations) for that function.
51595
+ * The next call to the wrapped function will create a fresh CacheInstance.
51604
51596
  *
51605
51597
  * @template T - Function type
51606
- * @param run - Function whose cache should be cleared for current context
51598
+ * @param run - Function whose CacheInstance should be disposed.
51607
51599
  *
51608
51600
  * @example
51609
51601
  * ```typescript
51610
51602
  * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
51611
51603
  *
51612
- * // Within strategy execution context
51613
- * const result1 = cachedFn("BTCUSDT", 14); // Computed
51614
- * const result2 = cachedFn("BTCUSDT", 14); // Cached
51615
- *
51616
- * Cache.clear(calculateIndicator); // Clear cache for current context only
51617
- *
51618
- * const result3 = cachedFn("BTCUSDT", 14); // Recomputed for this context
51619
- * // Other contexts (different strategies/exchanges) remain cached
51604
+ * // Dispose CacheInstance for a specific function
51605
+ * Cache.dispose(calculateIndicator);
51620
51606
  * ```
51621
51607
  */
51622
- this.clear = (run) => {
51623
- bt.loggerService.info(CACHE_METHOD_NAME_CLEAR, {
51608
+ this.dispose = (run) => {
51609
+ bt.loggerService.info(CACHE_METHOD_NAME_DISPOSE, {
51624
51610
  run,
51625
51611
  });
51626
- if (!MethodContextService.hasContext()) {
51627
- console.warn(`${CACHE_METHOD_NAME_CLEAR} called without method context, skipping clear`);
51628
- return;
51629
- }
51630
- if (!ExecutionContextService.hasContext()) {
51631
- console.warn(`${CACHE_METHOD_NAME_CLEAR} called without execution context, skipping clear`);
51632
- return;
51612
+ {
51613
+ this._getFnInstance.clear(run);
51614
+ this._getFileInstance.clear(run);
51633
51615
  }
51634
- this._getFnInstance.get(run).clear();
51635
51616
  };
51636
51617
  /**
51637
- * Garbage collect expired cache entries for a specific function.
51638
- *
51639
- * Removes all cached entries whose interval has expired (not aligned with current time).
51640
- * Call this periodically to free memory from stale cache entries.
51641
- *
51642
- * Requires active execution context to get current time.
51643
- *
51644
- * @template T - Function type
51645
- * @param run - Function whose expired cache entries should be removed
51646
- * @returns Number of entries removed
51647
- *
51648
- * @example
51649
- * ```typescript
51650
- * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
51651
- *
51652
- * cachedFn("BTCUSDT", 14); // Cached at 10:00
51653
- * cachedFn("ETHUSDT", 14); // Cached at 10:00
51654
- * // Time passes to 11:00
51655
- * const removed = Cache.gc(calculateIndicator); // Returns 2
51656
- * ```
51618
+ * Clears all memoized CacheInstance and CacheFileInstance objects.
51619
+ * Call this when process.cwd() changes between strategy iterations
51620
+ * so new instances are created with the updated base path.
51657
51621
  */
51658
- this.gc = (run) => {
51659
- bt.loggerService.info(CACHE_METHOD_NAME_GC, {
51660
- run,
51661
- });
51662
- if (!ExecutionContextService.hasContext()) {
51663
- console.warn(`${CACHE_METHOD_NAME_GC} called without execution context, skipping garbage collection`);
51664
- return;
51622
+ this.clear = () => {
51623
+ bt.loggerService.info(CACHE_METHOD_NAME_CLEAR);
51624
+ {
51625
+ this._getFnInstance.clear();
51626
+ this._getFileInstance.clear();
51665
51627
  }
51666
- return this._getFnInstance.get(run).gc();
51628
+ CacheFileInstance.clearCounter();
51667
51629
  };
51668
51630
  }
51669
51631
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "6.3.0",
3
+ "version": "6.5.0",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -19159,7 +19159,10 @@ declare class CacheUtils {
19159
19159
  fn: <T extends Function, K = symbol>(run: T, context: {
19160
19160
  interval: CandleInterval;
19161
19161
  key?: (args: Parameters<T>) => K;
19162
- }) => T;
19162
+ }) => T & {
19163
+ clear(): void;
19164
+ gc(): number | undefined;
19165
+ };
19163
19166
  /**
19164
19167
  * Wrap an async function with persistent file-based caching.
19165
19168
  *
@@ -19202,90 +19205,34 @@ declare class CacheUtils {
19202
19205
  interval: CandleInterval;
19203
19206
  name: string;
19204
19207
  key?: (args: CacheFileKeyArgs<T>) => string;
19205
- }) => T;
19208
+ }) => T & {
19209
+ clear(): void;
19210
+ };
19206
19211
  /**
19207
- * Flush (remove) cached CacheInstance for a specific function or all functions.
19208
- *
19209
- * This method removes CacheInstance objects from the internal memoization cache.
19210
- * When a CacheInstance is flushed, all cached results across all contexts
19211
- * (all strategy/exchange/mode combinations) for that function are discarded.
19212
+ * Dispose (remove) the memoized CacheInstance for a specific function.
19212
19213
  *
19213
- * Use cases:
19214
- * - Remove specific function's CacheInstance when implementation changes
19215
- * - Free memory by removing unused CacheInstances
19216
- * - Reset all CacheInstances when switching between different test scenarios
19217
- *
19218
- * Note: This is different from `clear()` which only removes cached values
19219
- * for the current context within an existing CacheInstance.
19214
+ * Removes the CacheInstance from the internal memoization cache, discarding all cached
19215
+ * results across all contexts (all strategy/exchange/mode combinations) for that function.
19216
+ * The next call to the wrapped function will create a fresh CacheInstance.
19220
19217
  *
19221
19218
  * @template T - Function type
19222
- * @param run - Optional function to flush CacheInstance for. If omitted, flushes all CacheInstances.
19219
+ * @param run - Function whose CacheInstance should be disposed.
19223
19220
  *
19224
19221
  * @example
19225
19222
  * ```typescript
19226
19223
  * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
19227
19224
  *
19228
- * // Flush CacheInstance for specific function
19229
- * Cache.flush(calculateIndicator);
19230
- *
19231
- * // Flush all CacheInstances
19232
- * Cache.flush();
19225
+ * // Dispose CacheInstance for a specific function
19226
+ * Cache.dispose(calculateIndicator);
19233
19227
  * ```
19234
19228
  */
19235
- flush: <T extends Function>(run?: T) => void;
19229
+ dispose: <T extends Function>(run: T) => void;
19236
19230
  /**
19237
- * Clear cached value for current execution context of a specific function.
19238
- *
19239
- * Removes the cached entry for the current strategy/exchange/mode combination
19240
- * from the specified function's CacheInstance. The next call to the wrapped function
19241
- * will recompute the value for that context.
19242
- *
19243
- * This only clears the cache for the current execution context, not all contexts.
19244
- * Use `flush()` to remove the entire CacheInstance across all contexts.
19245
- *
19246
- * Requires active execution context (strategy, exchange, backtest mode) and method context.
19247
- *
19248
- * @template T - Function type
19249
- * @param run - Function whose cache should be cleared for current context
19250
- *
19251
- * @example
19252
- * ```typescript
19253
- * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
19254
- *
19255
- * // Within strategy execution context
19256
- * const result1 = cachedFn("BTCUSDT", 14); // Computed
19257
- * const result2 = cachedFn("BTCUSDT", 14); // Cached
19258
- *
19259
- * Cache.clear(calculateIndicator); // Clear cache for current context only
19260
- *
19261
- * const result3 = cachedFn("BTCUSDT", 14); // Recomputed for this context
19262
- * // Other contexts (different strategies/exchanges) remain cached
19263
- * ```
19264
- */
19265
- clear: <T extends Function>(run: T) => void;
19266
- /**
19267
- * Garbage collect expired cache entries for a specific function.
19268
- *
19269
- * Removes all cached entries whose interval has expired (not aligned with current time).
19270
- * Call this periodically to free memory from stale cache entries.
19271
- *
19272
- * Requires active execution context to get current time.
19273
- *
19274
- * @template T - Function type
19275
- * @param run - Function whose expired cache entries should be removed
19276
- * @returns Number of entries removed
19277
- *
19278
- * @example
19279
- * ```typescript
19280
- * const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
19281
- *
19282
- * cachedFn("BTCUSDT", 14); // Cached at 10:00
19283
- * cachedFn("ETHUSDT", 14); // Cached at 10:00
19284
- * // Time passes to 11:00
19285
- * const removed = Cache.gc(calculateIndicator); // Returns 2
19286
- * ```
19231
+ * Clears all memoized CacheInstance and CacheFileInstance objects.
19232
+ * Call this when process.cwd() changes between strategy iterations
19233
+ * so new instances are created with the updated base path.
19287
19234
  */
19288
- gc: <T extends Function>(run: T) => number;
19235
+ clear: () => void;
19289
19236
  }
19290
19237
  /**
19291
19238
  * Singleton instance of CacheUtils for convenient function caching.