backtest-kit 6.2.0 → 6.3.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 +240 -30
- package/build/index.mjs +240 -30
- package/package.json +1 -1
- package/types.d.ts +134 -6
package/types.d.ts
CHANGED
|
@@ -10854,6 +10854,12 @@ declare class PersistSignalUtils {
|
|
|
10854
10854
|
* @returns Promise that resolves when write is complete
|
|
10855
10855
|
*/
|
|
10856
10856
|
writeSignalData: (signalRow: ISignalRow | null, symbol: string, strategyName: StrategyName, exchangeName: ExchangeName) => Promise<void>;
|
|
10857
|
+
/**
|
|
10858
|
+
* Clears the memoized storage cache.
|
|
10859
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
10860
|
+
* so new storage instances are created with the updated base path.
|
|
10861
|
+
*/
|
|
10862
|
+
clear(): void;
|
|
10857
10863
|
/**
|
|
10858
10864
|
* Switches to the default JSON persist adapter.
|
|
10859
10865
|
* All future persistence writes will use JSON storage.
|
|
@@ -10939,6 +10945,12 @@ declare class PersistRiskUtils {
|
|
|
10939
10945
|
* @returns Promise that resolves when write is complete
|
|
10940
10946
|
*/
|
|
10941
10947
|
writePositionData: (riskRow: RiskData, riskName: RiskName, exchangeName: ExchangeName) => Promise<void>;
|
|
10948
|
+
/**
|
|
10949
|
+
* Clears the memoized storage cache.
|
|
10950
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
10951
|
+
* so new storage instances are created with the updated base path.
|
|
10952
|
+
*/
|
|
10953
|
+
clear(): void;
|
|
10942
10954
|
/**
|
|
10943
10955
|
* Switches to the default JSON persist adapter.
|
|
10944
10956
|
* All future persistence writes will use JSON storage.
|
|
@@ -11026,6 +11038,12 @@ declare class PersistScheduleUtils {
|
|
|
11026
11038
|
* @returns Promise that resolves when write is complete
|
|
11027
11039
|
*/
|
|
11028
11040
|
writeScheduleData: (scheduledSignalRow: IScheduledSignalRow | null, symbol: string, strategyName: StrategyName, exchangeName: ExchangeName) => Promise<void>;
|
|
11041
|
+
/**
|
|
11042
|
+
* Clears the memoized storage cache.
|
|
11043
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11044
|
+
* so new storage instances are created with the updated base path.
|
|
11045
|
+
*/
|
|
11046
|
+
clear(): void;
|
|
11029
11047
|
/**
|
|
11030
11048
|
* Switches to the default JSON persist adapter.
|
|
11031
11049
|
* All future persistence writes will use JSON storage.
|
|
@@ -11115,6 +11133,12 @@ declare class PersistPartialUtils {
|
|
|
11115
11133
|
* @returns Promise that resolves when write is complete
|
|
11116
11134
|
*/
|
|
11117
11135
|
writePartialData: (partialData: PartialData, symbol: string, strategyName: StrategyName, signalId: string, exchangeName: ExchangeName) => Promise<void>;
|
|
11136
|
+
/**
|
|
11137
|
+
* Clears the memoized storage cache.
|
|
11138
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11139
|
+
* so new storage instances are created with the updated base path.
|
|
11140
|
+
*/
|
|
11141
|
+
clear(): void;
|
|
11118
11142
|
/**
|
|
11119
11143
|
* Switches to the default JSON persist adapter.
|
|
11120
11144
|
* All future persistence writes will use JSON storage.
|
|
@@ -11239,6 +11263,12 @@ declare class PersistBreakevenUtils {
|
|
|
11239
11263
|
* @returns Promise that resolves when write is complete
|
|
11240
11264
|
*/
|
|
11241
11265
|
writeBreakevenData: (breakevenData: BreakevenData, symbol: string, strategyName: StrategyName, signalId: string, exchangeName: ExchangeName) => Promise<void>;
|
|
11266
|
+
/**
|
|
11267
|
+
* Clears the memoized storage cache.
|
|
11268
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11269
|
+
* so new storage instances are created with the updated base path.
|
|
11270
|
+
*/
|
|
11271
|
+
clear(): void;
|
|
11242
11272
|
/**
|
|
11243
11273
|
* Switches to the default JSON persist adapter.
|
|
11244
11274
|
* All future persistence writes will use JSON storage.
|
|
@@ -11327,6 +11357,12 @@ declare class PersistCandleUtils {
|
|
|
11327
11357
|
* @returns Promise that resolves when all writes are complete
|
|
11328
11358
|
*/
|
|
11329
11359
|
writeCandlesData: (candles: CandleData[], symbol: string, interval: CandleInterval, exchangeName: ExchangeName) => Promise<void>;
|
|
11360
|
+
/**
|
|
11361
|
+
* Clears the memoized storage cache.
|
|
11362
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11363
|
+
* so new storage instances are created with the updated base path.
|
|
11364
|
+
*/
|
|
11365
|
+
clear(): void;
|
|
11330
11366
|
/**
|
|
11331
11367
|
* Switches to the default JSON persist adapter.
|
|
11332
11368
|
* All future persistence writes will use JSON storage.
|
|
@@ -11403,6 +11439,12 @@ declare class PersistStorageUtils {
|
|
|
11403
11439
|
* @returns Promise that resolves when write is complete
|
|
11404
11440
|
*/
|
|
11405
11441
|
writeStorageData: (signalData: StorageData, backtest: boolean) => Promise<void>;
|
|
11442
|
+
/**
|
|
11443
|
+
* Clears the memoized storage cache.
|
|
11444
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11445
|
+
* so new storage instances are created with the updated base path.
|
|
11446
|
+
*/
|
|
11447
|
+
clear(): void;
|
|
11406
11448
|
/**
|
|
11407
11449
|
* Switches to the default JSON persist adapter.
|
|
11408
11450
|
* All future persistence writes will use JSON storage.
|
|
@@ -11468,6 +11510,12 @@ declare class PersistNotificationUtils {
|
|
|
11468
11510
|
* @returns Promise that resolves when write is complete
|
|
11469
11511
|
*/
|
|
11470
11512
|
writeNotificationData: (notificationData: NotificationData, backtest: boolean) => Promise<void>;
|
|
11513
|
+
/**
|
|
11514
|
+
* Clears the memoized storage cache.
|
|
11515
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11516
|
+
* so new storage instances are created with the updated base path.
|
|
11517
|
+
*/
|
|
11518
|
+
clear(): void;
|
|
11471
11519
|
/**
|
|
11472
11520
|
* Switches to the default JSON persist adapter.
|
|
11473
11521
|
* All future persistence writes will use JSON storage.
|
|
@@ -11533,6 +11581,12 @@ declare class PersistLogUtils {
|
|
|
11533
11581
|
* @returns Promise that resolves when write is complete
|
|
11534
11582
|
*/
|
|
11535
11583
|
writeLogData: (logData: LogData) => Promise<void>;
|
|
11584
|
+
/**
|
|
11585
|
+
* Clears the cached storage instance.
|
|
11586
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11587
|
+
* so a new storage instance is created with the updated base path.
|
|
11588
|
+
*/
|
|
11589
|
+
clear(): void;
|
|
11536
11590
|
/**
|
|
11537
11591
|
* Switches to the default JSON persist adapter.
|
|
11538
11592
|
* All future persistence writes will use JSON storage.
|
|
@@ -11586,6 +11640,12 @@ declare class PersistMeasureUtils {
|
|
|
11586
11640
|
* @returns Promise that resolves when write is complete
|
|
11587
11641
|
*/
|
|
11588
11642
|
writeMeasureData: (data: MeasureData, bucket: string, key: string) => Promise<void>;
|
|
11643
|
+
/**
|
|
11644
|
+
* Clears the memoized storage cache.
|
|
11645
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11646
|
+
* so new storage instances are created with the updated base path.
|
|
11647
|
+
*/
|
|
11648
|
+
clear(): void;
|
|
11589
11649
|
/**
|
|
11590
11650
|
* Switches to the default JSON persist adapter.
|
|
11591
11651
|
*/
|
|
@@ -11700,12 +11760,20 @@ declare class PersistMemoryUtils {
|
|
|
11700
11760
|
data: MemoryData;
|
|
11701
11761
|
}>;
|
|
11702
11762
|
/**
|
|
11703
|
-
*
|
|
11763
|
+
* Clears the memoized storage cache.
|
|
11764
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
11765
|
+
* so new storage instances are created with the updated base path.
|
|
11766
|
+
*/
|
|
11767
|
+
clear: () => void;
|
|
11768
|
+
/**
|
|
11769
|
+
* Disposes of the memory adapter and releases any resources.
|
|
11770
|
+
* Call this when a signal is removed to clean up its associated storage.
|
|
11704
11771
|
*
|
|
11705
11772
|
* @param signalId - Signal identifier
|
|
11706
11773
|
* @param bucketName - Bucket name
|
|
11774
|
+
* @returns void
|
|
11707
11775
|
*/
|
|
11708
|
-
|
|
11776
|
+
dispose: (signalId: string, bucketName: string) => void;
|
|
11709
11777
|
/**
|
|
11710
11778
|
* Switches to the default JSON persist adapter.
|
|
11711
11779
|
* All future persistence writes will use JSON storage.
|
|
@@ -12004,6 +12072,12 @@ declare class ReportAdapter extends ReportUtils {
|
|
|
12004
12072
|
* @internal - Automatically called by report services, not for direct use
|
|
12005
12073
|
*/
|
|
12006
12074
|
writeData: <T = any>(reportName: ReportName, data: T, options: IReportDumpOptions) => Promise<void>;
|
|
12075
|
+
/**
|
|
12076
|
+
* Clears the memoized storage cache.
|
|
12077
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
12078
|
+
* so new storage instances are created with the updated base path.
|
|
12079
|
+
*/
|
|
12080
|
+
clear(): void;
|
|
12007
12081
|
/**
|
|
12008
12082
|
* Switches to a dummy report adapter that discards all writes.
|
|
12009
12083
|
* All future report writes will be no-ops.
|
|
@@ -12344,6 +12418,12 @@ declare class MarkdownAdapter extends MarkdownUtils {
|
|
|
12344
12418
|
* All dumps append to a single .jsonl file per markdown type.
|
|
12345
12419
|
*/
|
|
12346
12420
|
useJsonl(): void;
|
|
12421
|
+
/**
|
|
12422
|
+
* Clears the memoized storage cache.
|
|
12423
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
12424
|
+
* so new storage instances are created with the updated base path.
|
|
12425
|
+
*/
|
|
12426
|
+
clear(): void;
|
|
12347
12427
|
/**
|
|
12348
12428
|
* Switches to a dummy markdown adapter that discards all writes.
|
|
12349
12429
|
* All future markdown writes will be no-ops.
|
|
@@ -12447,6 +12527,12 @@ declare class LogAdapter implements ILog {
|
|
|
12447
12527
|
* @param dirName - Directory for the JSONL file (default: ./dump/log)
|
|
12448
12528
|
*/
|
|
12449
12529
|
useJsonl: (fileName?: string, dirName?: string) => void;
|
|
12530
|
+
/**
|
|
12531
|
+
* Clears the cached log instance by resetting to the default in-memory adapter.
|
|
12532
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
12533
|
+
* so a new adapter instance is created with the updated base path.
|
|
12534
|
+
*/
|
|
12535
|
+
clear: () => void;
|
|
12450
12536
|
}
|
|
12451
12537
|
/**
|
|
12452
12538
|
* Global singleton instance of LogAdapter.
|
|
@@ -17965,6 +18051,12 @@ declare class StorageBacktestAdapter implements IStorageUtils {
|
|
|
17965
18051
|
* Signals will be stored in memory only.
|
|
17966
18052
|
*/
|
|
17967
18053
|
useMemory: () => void;
|
|
18054
|
+
/**
|
|
18055
|
+
* Clears the cached utils instance by resetting to the default in-memory adapter.
|
|
18056
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
18057
|
+
* so a new instance is created with the updated base path.
|
|
18058
|
+
*/
|
|
18059
|
+
clear: () => void;
|
|
17968
18060
|
}
|
|
17969
18061
|
/**
|
|
17970
18062
|
* Live trading storage adapter with pluggable storage backend.
|
|
@@ -18039,6 +18131,12 @@ declare class StorageLiveAdapter implements IStorageUtils {
|
|
|
18039
18131
|
* Signals will be stored in memory only.
|
|
18040
18132
|
*/
|
|
18041
18133
|
useMemory: () => void;
|
|
18134
|
+
/**
|
|
18135
|
+
* Clears the cached utils instance by resetting to the default persistent adapter.
|
|
18136
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
18137
|
+
* so a new instance is created with the updated base path.
|
|
18138
|
+
*/
|
|
18139
|
+
clear: () => void;
|
|
18042
18140
|
}
|
|
18043
18141
|
/**
|
|
18044
18142
|
* Main storage adapter that manages both backtest and live signal storage.
|
|
@@ -18165,7 +18263,7 @@ interface INotificationUtils {
|
|
|
18165
18263
|
/**
|
|
18166
18264
|
* Clears all stored notifications.
|
|
18167
18265
|
*/
|
|
18168
|
-
|
|
18266
|
+
dispose(): Promise<void>;
|
|
18169
18267
|
}
|
|
18170
18268
|
/**
|
|
18171
18269
|
* Constructor type for notification adapters.
|
|
@@ -18254,7 +18352,7 @@ declare class NotificationBacktestAdapter implements INotificationUtils {
|
|
|
18254
18352
|
* Clears all stored notifications.
|
|
18255
18353
|
* Proxies call to the underlying notification adapter.
|
|
18256
18354
|
*/
|
|
18257
|
-
|
|
18355
|
+
dispose: () => Promise<void>;
|
|
18258
18356
|
/**
|
|
18259
18357
|
* Sets the notification adapter constructor.
|
|
18260
18358
|
* All future notification operations will use this adapter.
|
|
@@ -18277,6 +18375,12 @@ declare class NotificationBacktestAdapter implements INotificationUtils {
|
|
|
18277
18375
|
* Notifications will be persisted to disk.
|
|
18278
18376
|
*/
|
|
18279
18377
|
usePersist: () => void;
|
|
18378
|
+
/**
|
|
18379
|
+
* Resets the cached utils instance to the default in-memory adapter.
|
|
18380
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
18381
|
+
* so a new instance is created with the updated base path.
|
|
18382
|
+
*/
|
|
18383
|
+
clear: () => void;
|
|
18280
18384
|
}
|
|
18281
18385
|
/**
|
|
18282
18386
|
* Live trading notification adapter with pluggable notification backend.
|
|
@@ -18360,7 +18464,7 @@ declare class NotificationLiveAdapter implements INotificationUtils {
|
|
|
18360
18464
|
* Clears all stored notifications.
|
|
18361
18465
|
* Proxies call to the underlying notification adapter.
|
|
18362
18466
|
*/
|
|
18363
|
-
|
|
18467
|
+
dispose: () => Promise<void>;
|
|
18364
18468
|
/**
|
|
18365
18469
|
* Sets the notification adapter constructor.
|
|
18366
18470
|
* All future notification operations will use this adapter.
|
|
@@ -18383,6 +18487,12 @@ declare class NotificationLiveAdapter implements INotificationUtils {
|
|
|
18383
18487
|
* Notifications will be persisted to disk.
|
|
18384
18488
|
*/
|
|
18385
18489
|
usePersist: () => void;
|
|
18490
|
+
/**
|
|
18491
|
+
* Resets the cached utils instance to the default in-memory adapter.
|
|
18492
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
18493
|
+
* so a new instance is created with the updated base path.
|
|
18494
|
+
*/
|
|
18495
|
+
clear: () => void;
|
|
18386
18496
|
}
|
|
18387
18497
|
/**
|
|
18388
18498
|
* Main notification adapter that manages both backtest and live notification storage.
|
|
@@ -18418,7 +18528,7 @@ declare class NotificationAdapter {
|
|
|
18418
18528
|
*
|
|
18419
18529
|
* @throws Error if NotificationAdapter is not enabled
|
|
18420
18530
|
*/
|
|
18421
|
-
|
|
18531
|
+
dispose: (isBacktest: boolean) => Promise<void>;
|
|
18422
18532
|
}
|
|
18423
18533
|
/**
|
|
18424
18534
|
* Global singleton instance of NotificationAdapter.
|
|
@@ -18635,6 +18745,12 @@ declare class MemoryAdapter implements TMemoryInstance {
|
|
|
18635
18745
|
* Switches to dummy adapter that discards all writes.
|
|
18636
18746
|
*/
|
|
18637
18747
|
useDummy: () => void;
|
|
18748
|
+
/**
|
|
18749
|
+
* Clears the memoized instance cache.
|
|
18750
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
18751
|
+
* so new instances are created with the updated base path.
|
|
18752
|
+
*/
|
|
18753
|
+
clear: () => void;
|
|
18638
18754
|
/**
|
|
18639
18755
|
* Releases resources held by this adapter.
|
|
18640
18756
|
* Delegates to disable() to unsubscribe from signal lifecycle events.
|
|
@@ -18797,6 +18913,12 @@ declare class DumpAdapter {
|
|
|
18797
18913
|
* @param Ctor - Constructor for the custom dump implementation
|
|
18798
18914
|
*/
|
|
18799
18915
|
useDumpAdapter: (Ctor: TDumpInstanceCtor) => void;
|
|
18916
|
+
/**
|
|
18917
|
+
* Clears the memoized instance cache.
|
|
18918
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
18919
|
+
* so new instances are created with the updated base path.
|
|
18920
|
+
*/
|
|
18921
|
+
clear: () => void;
|
|
18800
18922
|
}
|
|
18801
18923
|
declare const Dump: DumpAdapter;
|
|
18802
18924
|
|
|
@@ -21389,6 +21511,12 @@ declare class BrokerAdapter {
|
|
|
21389
21511
|
* ```
|
|
21390
21512
|
*/
|
|
21391
21513
|
disable: () => void;
|
|
21514
|
+
/**
|
|
21515
|
+
* Clears the cached broker instance and resets the enable singleshot.
|
|
21516
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
21517
|
+
* so a new broker instance is created with the updated base path.
|
|
21518
|
+
*/
|
|
21519
|
+
clear: () => void;
|
|
21392
21520
|
}
|
|
21393
21521
|
/**
|
|
21394
21522
|
* Base class for custom broker adapter implementations.
|