backtest-kit 6.1.1 → 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 +274 -30
- package/build/index.mjs +274 -30
- package/package.json +1 -1
- package/types.d.ts +138 -6
package/build/index.mjs
CHANGED
|
@@ -888,26 +888,31 @@ const PERSIST_SIGNAL_UTILS_METHOD_NAME_READ_DATA = "PersistSignalUtils.readSigna
|
|
|
888
888
|
const PERSIST_SIGNAL_UTILS_METHOD_NAME_WRITE_DATA = "PersistSignalUtils.writeSignalData";
|
|
889
889
|
const PERSIST_SIGNAL_UTILS_METHOD_NAME_USE_JSON = "PersistSignalUtils.useJson";
|
|
890
890
|
const PERSIST_SIGNAL_UTILS_METHOD_NAME_USE_DUMMY = "PersistSignalUtils.useDummy";
|
|
891
|
+
const PERSIST_SIGNAL_UTILS_METHOD_NAME_CLEAR = "PersistSignalUtils.clear";
|
|
891
892
|
const PERSIST_SCHEDULE_UTILS_METHOD_NAME_USE_PERSIST_SCHEDULE_ADAPTER = "PersistScheduleUtils.usePersistScheduleAdapter";
|
|
892
893
|
const PERSIST_SCHEDULE_UTILS_METHOD_NAME_READ_DATA = "PersistScheduleUtils.readScheduleData";
|
|
893
894
|
const PERSIST_SCHEDULE_UTILS_METHOD_NAME_WRITE_DATA = "PersistScheduleUtils.writeScheduleData";
|
|
894
895
|
const PERSIST_SCHEDULE_UTILS_METHOD_NAME_USE_JSON = "PersistScheduleUtils.useJson";
|
|
895
896
|
const PERSIST_SCHEDULE_UTILS_METHOD_NAME_USE_DUMMY = "PersistScheduleUtils.useDummy";
|
|
897
|
+
const PERSIST_SCHEDULE_UTILS_METHOD_NAME_CLEAR = "PersistScheduleUtils.clear";
|
|
896
898
|
const PERSIST_PARTIAL_UTILS_METHOD_NAME_USE_PERSIST_PARTIAL_ADAPTER = "PersistPartialUtils.usePersistPartialAdapter";
|
|
897
899
|
const PERSIST_PARTIAL_UTILS_METHOD_NAME_READ_DATA = "PersistPartialUtils.readPartialData";
|
|
898
900
|
const PERSIST_PARTIAL_UTILS_METHOD_NAME_WRITE_DATA = "PersistPartialUtils.writePartialData";
|
|
899
901
|
const PERSIST_PARTIAL_UTILS_METHOD_NAME_USE_JSON = "PersistPartialUtils.useJson";
|
|
900
902
|
const PERSIST_PARTIAL_UTILS_METHOD_NAME_USE_DUMMY = "PersistPartialUtils.useDummy";
|
|
903
|
+
const PERSIST_PARTIAL_UTILS_METHOD_NAME_CLEAR = "PersistPartialUtils.clear";
|
|
901
904
|
const PERSIST_BREAKEVEN_UTILS_METHOD_NAME_USE_PERSIST_BREAKEVEN_ADAPTER = "PersistBreakevenUtils.usePersistBreakevenAdapter";
|
|
902
905
|
const PERSIST_BREAKEVEN_UTILS_METHOD_NAME_READ_DATA = "PersistBreakevenUtils.readBreakevenData";
|
|
903
906
|
const PERSIST_BREAKEVEN_UTILS_METHOD_NAME_WRITE_DATA = "PersistBreakevenUtils.writeBreakevenData";
|
|
904
907
|
const PERSIST_BREAKEVEN_UTILS_METHOD_NAME_USE_JSON = "PersistBreakevenUtils.useJson";
|
|
905
908
|
const PERSIST_BREAKEVEN_UTILS_METHOD_NAME_USE_DUMMY = "PersistBreakevenUtils.useDummy";
|
|
909
|
+
const PERSIST_BREAKEVEN_UTILS_METHOD_NAME_CLEAR = "PersistBreakevenUtils.clear";
|
|
906
910
|
const PERSIST_RISK_UTILS_METHOD_NAME_USE_PERSIST_RISK_ADAPTER = "PersistRiskUtils.usePersistRiskAdapter";
|
|
907
911
|
const PERSIST_RISK_UTILS_METHOD_NAME_READ_DATA = "PersistRiskUtils.readPositionData";
|
|
908
912
|
const PERSIST_RISK_UTILS_METHOD_NAME_WRITE_DATA = "PersistRiskUtils.writePositionData";
|
|
909
913
|
const PERSIST_RISK_UTILS_METHOD_NAME_USE_JSON = "PersistRiskUtils.useJson";
|
|
910
914
|
const PERSIST_RISK_UTILS_METHOD_NAME_USE_DUMMY = "PersistRiskUtils.useDummy";
|
|
915
|
+
const PERSIST_RISK_UTILS_METHOD_NAME_CLEAR = "PersistRiskUtils.clear";
|
|
911
916
|
const PERSIST_BASE_METHOD_NAME_CTOR = "PersistBase.CTOR";
|
|
912
917
|
const PERSIST_BASE_METHOD_NAME_WAIT_FOR_INIT = "PersistBase.waitForInit";
|
|
913
918
|
const PERSIST_BASE_METHOD_NAME_READ_VALUE = "PersistBase.readValue";
|
|
@@ -918,22 +923,27 @@ const PERSIST_STORAGE_UTILS_METHOD_NAME_READ_DATA = "PersistStorageUtils.readSto
|
|
|
918
923
|
const PERSIST_STORAGE_UTILS_METHOD_NAME_WRITE_DATA = "PersistStorageUtils.writeStorageData";
|
|
919
924
|
const PERSIST_STORAGE_UTILS_METHOD_NAME_USE_JSON = "PersistStorageUtils.useJson";
|
|
920
925
|
const PERSIST_STORAGE_UTILS_METHOD_NAME_USE_DUMMY = "PersistStorageUtils.useDummy";
|
|
926
|
+
const PERSIST_STORAGE_UTILS_METHOD_NAME_CLEAR = "PersistStorageUtils.clear";
|
|
921
927
|
const PERSIST_STORAGE_UTILS_METHOD_NAME_USE_PERSIST_STORAGE_ADAPTER = "PersistStorageUtils.usePersistStorageAdapter";
|
|
922
928
|
const PERSIST_NOTIFICATION_UTILS_METHOD_NAME_READ_DATA = "PersistNotificationUtils.readNotificationData";
|
|
923
929
|
const PERSIST_NOTIFICATION_UTILS_METHOD_NAME_WRITE_DATA = "PersistNotificationUtils.writeNotificationData";
|
|
924
930
|
const PERSIST_NOTIFICATION_UTILS_METHOD_NAME_USE_JSON = "PersistNotificationUtils.useJson";
|
|
925
931
|
const PERSIST_NOTIFICATION_UTILS_METHOD_NAME_USE_DUMMY = "PersistNotificationUtils.useDummy";
|
|
932
|
+
const PERSIST_NOTIFICATION_UTILS_METHOD_NAME_CLEAR = "PersistNotificationUtils.clear";
|
|
926
933
|
const PERSIST_NOTIFICATION_UTILS_METHOD_NAME_USE_PERSIST_NOTIFICATION_ADAPTER = "PersistNotificationUtils.usePersistNotificationAdapter";
|
|
927
934
|
const PERSIST_LOG_UTILS_METHOD_NAME_READ_DATA = "PersistLogUtils.readLogData";
|
|
928
935
|
const PERSIST_LOG_UTILS_METHOD_NAME_WRITE_DATA = "PersistLogUtils.writeLogData";
|
|
929
936
|
const PERSIST_LOG_UTILS_METHOD_NAME_USE_JSON = "PersistLogUtils.useJson";
|
|
930
937
|
const PERSIST_LOG_UTILS_METHOD_NAME_USE_DUMMY = "PersistLogUtils.useDummy";
|
|
931
938
|
const PERSIST_LOG_UTILS_METHOD_NAME_USE_PERSIST_LOG_ADAPTER = "PersistLogUtils.usePersistLogAdapter";
|
|
939
|
+
const PERSIST_LOG_UTILS_METHOD_NAME_CLEAR = "PersistLogUtils.clear";
|
|
932
940
|
const PERSIST_MEASURE_UTILS_METHOD_NAME_READ_DATA = "PersistMeasureUtils.readMeasureData";
|
|
933
941
|
const PERSIST_MEASURE_UTILS_METHOD_NAME_WRITE_DATA = "PersistMeasureUtils.writeMeasureData";
|
|
934
942
|
const PERSIST_MEASURE_UTILS_METHOD_NAME_USE_JSON = "PersistMeasureUtils.useJson";
|
|
935
943
|
const PERSIST_MEASURE_UTILS_METHOD_NAME_USE_DUMMY = "PersistMeasureUtils.useDummy";
|
|
944
|
+
const PERSIST_MEASURE_UTILS_METHOD_NAME_CLEAR = "PersistMeasureUtils.clear";
|
|
936
945
|
const PERSIST_MEASURE_UTILS_METHOD_NAME_USE_PERSIST_MEASURE_ADAPTER = "PersistMeasureUtils.usePersistMeasureAdapter";
|
|
946
|
+
const PERSIST_CANDLE_UTILS_METHOD_NAME_CLEAR = "PersistCandleUtils.clear";
|
|
937
947
|
const PERSIST_MEMORY_UTILS_METHOD_NAME_USE_PERSIST_MEMORY_ADAPTER = "PersistMemoryUtils.usePersistMemoryAdapter";
|
|
938
948
|
const PERSIST_MEMORY_UTILS_METHOD_NAME_READ_DATA = "PersistMemoryUtils.readMemoryData";
|
|
939
949
|
const PERSIST_MEMORY_UTILS_METHOD_NAME_WRITE_DATA = "PersistMemoryUtils.writeMemoryData";
|
|
@@ -941,6 +951,7 @@ const PERSIST_MEMORY_UTILS_METHOD_NAME_REMOVE_DATA = "PersistMemoryUtils.removeM
|
|
|
941
951
|
const PERSIST_MEMORY_UTILS_METHOD_NAME_LIST_DATA = "PersistMemoryUtils.listMemoryData";
|
|
942
952
|
const PERSIST_MEMORY_UTILS_METHOD_NAME_HAS_DATA = "PersistMemoryUtils.hasMemoryData";
|
|
943
953
|
const PERSIST_MEMORY_UTILS_METHOD_NAME_CLEAR = "PersistMemoryUtils.clear";
|
|
954
|
+
const PERSIST_MEMORY_UTILS_METHOD_NAME_DISPOSE = "PersistMemoryUtils.dispose";
|
|
944
955
|
const BASE_WAIT_FOR_INIT_FN_METHOD_NAME = "PersistBase.waitForInitFn";
|
|
945
956
|
const BASE_UNLINK_RETRY_COUNT = 5;
|
|
946
957
|
const BASE_UNLINK_RETRY_DELAY = 1000;
|
|
@@ -1226,6 +1237,15 @@ class PersistSignalUtils {
|
|
|
1226
1237
|
bt.loggerService.info(PERSIST_SIGNAL_UTILS_METHOD_NAME_USE_PERSIST_SIGNAL_ADAPTER);
|
|
1227
1238
|
this.PersistSignalFactory = Ctor;
|
|
1228
1239
|
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Clears the memoized storage cache.
|
|
1242
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
1243
|
+
* so new storage instances are created with the updated base path.
|
|
1244
|
+
*/
|
|
1245
|
+
clear() {
|
|
1246
|
+
bt.loggerService.log(PERSIST_SIGNAL_UTILS_METHOD_NAME_CLEAR);
|
|
1247
|
+
this.getStorage.clear();
|
|
1248
|
+
}
|
|
1229
1249
|
/**
|
|
1230
1250
|
* Switches to the default JSON persist adapter.
|
|
1231
1251
|
* All future persistence writes will use JSON storage.
|
|
@@ -1339,6 +1359,15 @@ class PersistRiskUtils {
|
|
|
1339
1359
|
bt.loggerService.info(PERSIST_RISK_UTILS_METHOD_NAME_USE_PERSIST_RISK_ADAPTER);
|
|
1340
1360
|
this.PersistRiskFactory = Ctor;
|
|
1341
1361
|
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Clears the memoized storage cache.
|
|
1364
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
1365
|
+
* so new storage instances are created with the updated base path.
|
|
1366
|
+
*/
|
|
1367
|
+
clear() {
|
|
1368
|
+
bt.loggerService.log(PERSIST_RISK_UTILS_METHOD_NAME_CLEAR);
|
|
1369
|
+
this.getRiskStorage.clear();
|
|
1370
|
+
}
|
|
1342
1371
|
/**
|
|
1343
1372
|
* Switches to the default JSON persist adapter.
|
|
1344
1373
|
* All future persistence writes will use JSON storage.
|
|
@@ -1452,6 +1481,15 @@ class PersistScheduleUtils {
|
|
|
1452
1481
|
bt.loggerService.info(PERSIST_SCHEDULE_UTILS_METHOD_NAME_USE_PERSIST_SCHEDULE_ADAPTER);
|
|
1453
1482
|
this.PersistScheduleFactory = Ctor;
|
|
1454
1483
|
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Clears the memoized storage cache.
|
|
1486
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
1487
|
+
* so new storage instances are created with the updated base path.
|
|
1488
|
+
*/
|
|
1489
|
+
clear() {
|
|
1490
|
+
bt.loggerService.log(PERSIST_SCHEDULE_UTILS_METHOD_NAME_CLEAR);
|
|
1491
|
+
this.getScheduleStorage.clear();
|
|
1492
|
+
}
|
|
1455
1493
|
/**
|
|
1456
1494
|
* Switches to the default JSON persist adapter.
|
|
1457
1495
|
* All future persistence writes will use JSON storage.
|
|
@@ -1567,6 +1605,15 @@ class PersistPartialUtils {
|
|
|
1567
1605
|
bt.loggerService.info(PERSIST_PARTIAL_UTILS_METHOD_NAME_USE_PERSIST_PARTIAL_ADAPTER);
|
|
1568
1606
|
this.PersistPartialFactory = Ctor;
|
|
1569
1607
|
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Clears the memoized storage cache.
|
|
1610
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
1611
|
+
* so new storage instances are created with the updated base path.
|
|
1612
|
+
*/
|
|
1613
|
+
clear() {
|
|
1614
|
+
bt.loggerService.log(PERSIST_PARTIAL_UTILS_METHOD_NAME_CLEAR);
|
|
1615
|
+
this.getPartialStorage.clear();
|
|
1616
|
+
}
|
|
1570
1617
|
/**
|
|
1571
1618
|
* Switches to the default JSON persist adapter.
|
|
1572
1619
|
* All future persistence writes will use JSON storage.
|
|
@@ -1717,6 +1764,15 @@ class PersistBreakevenUtils {
|
|
|
1717
1764
|
bt.loggerService.info(PERSIST_BREAKEVEN_UTILS_METHOD_NAME_USE_PERSIST_BREAKEVEN_ADAPTER);
|
|
1718
1765
|
this.PersistBreakevenFactory = Ctor;
|
|
1719
1766
|
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Clears the memoized storage cache.
|
|
1769
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
1770
|
+
* so new storage instances are created with the updated base path.
|
|
1771
|
+
*/
|
|
1772
|
+
clear() {
|
|
1773
|
+
bt.loggerService.log(PERSIST_BREAKEVEN_UTILS_METHOD_NAME_CLEAR);
|
|
1774
|
+
this.getBreakevenStorage.clear();
|
|
1775
|
+
}
|
|
1720
1776
|
/**
|
|
1721
1777
|
* Switches to the default JSON persist adapter.
|
|
1722
1778
|
* All future persistence writes will use JSON storage.
|
|
@@ -1888,6 +1944,15 @@ class PersistCandleUtils {
|
|
|
1888
1944
|
bt.loggerService.info("PersistCandleUtils.usePersistCandleAdapter");
|
|
1889
1945
|
this.PersistCandlesFactory = Ctor;
|
|
1890
1946
|
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Clears the memoized storage cache.
|
|
1949
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
1950
|
+
* so new storage instances are created with the updated base path.
|
|
1951
|
+
*/
|
|
1952
|
+
clear() {
|
|
1953
|
+
bt.loggerService.log(PERSIST_CANDLE_UTILS_METHOD_NAME_CLEAR);
|
|
1954
|
+
this.getCandlesStorage.clear();
|
|
1955
|
+
}
|
|
1891
1956
|
/**
|
|
1892
1957
|
* Switches to the default JSON persist adapter.
|
|
1893
1958
|
* All future persistence writes will use JSON storage.
|
|
@@ -1994,6 +2059,15 @@ class PersistStorageUtils {
|
|
|
1994
2059
|
bt.loggerService.info(PERSIST_STORAGE_UTILS_METHOD_NAME_USE_PERSIST_STORAGE_ADAPTER);
|
|
1995
2060
|
this.PersistStorageFactory = Ctor;
|
|
1996
2061
|
}
|
|
2062
|
+
/**
|
|
2063
|
+
* Clears the memoized storage cache.
|
|
2064
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
2065
|
+
* so new storage instances are created with the updated base path.
|
|
2066
|
+
*/
|
|
2067
|
+
clear() {
|
|
2068
|
+
bt.loggerService.log(PERSIST_STORAGE_UTILS_METHOD_NAME_CLEAR);
|
|
2069
|
+
this.getStorage.clear();
|
|
2070
|
+
}
|
|
1997
2071
|
/**
|
|
1998
2072
|
* Switches to the default JSON persist adapter.
|
|
1999
2073
|
* All future persistence writes will use JSON storage.
|
|
@@ -2089,6 +2163,15 @@ class PersistNotificationUtils {
|
|
|
2089
2163
|
bt.loggerService.info(PERSIST_NOTIFICATION_UTILS_METHOD_NAME_USE_PERSIST_NOTIFICATION_ADAPTER);
|
|
2090
2164
|
this.PersistNotificationFactory = Ctor;
|
|
2091
2165
|
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Clears the memoized storage cache.
|
|
2168
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
2169
|
+
* so new storage instances are created with the updated base path.
|
|
2170
|
+
*/
|
|
2171
|
+
clear() {
|
|
2172
|
+
bt.loggerService.log(PERSIST_NOTIFICATION_UTILS_METHOD_NAME_CLEAR);
|
|
2173
|
+
this.getNotificationStorage.clear();
|
|
2174
|
+
}
|
|
2092
2175
|
/**
|
|
2093
2176
|
* Switches to the default JSON persist adapter.
|
|
2094
2177
|
* All future persistence writes will use JSON storage.
|
|
@@ -2189,6 +2272,15 @@ class PersistLogUtils {
|
|
|
2189
2272
|
bt.loggerService.info(PERSIST_LOG_UTILS_METHOD_NAME_USE_PERSIST_LOG_ADAPTER);
|
|
2190
2273
|
this.PersistLogFactory = Ctor;
|
|
2191
2274
|
}
|
|
2275
|
+
/**
|
|
2276
|
+
* Clears the cached storage instance.
|
|
2277
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
2278
|
+
* so a new storage instance is created with the updated base path.
|
|
2279
|
+
*/
|
|
2280
|
+
clear() {
|
|
2281
|
+
bt.loggerService.log(PERSIST_LOG_UTILS_METHOD_NAME_CLEAR);
|
|
2282
|
+
this._logStorage = null;
|
|
2283
|
+
}
|
|
2192
2284
|
/**
|
|
2193
2285
|
* Switches to the default JSON persist adapter.
|
|
2194
2286
|
* All future persistence writes will use JSON storage.
|
|
@@ -2277,6 +2369,15 @@ class PersistMeasureUtils {
|
|
|
2277
2369
|
bt.loggerService.info(PERSIST_MEASURE_UTILS_METHOD_NAME_USE_PERSIST_MEASURE_ADAPTER);
|
|
2278
2370
|
this.PersistMeasureFactory = Ctor;
|
|
2279
2371
|
}
|
|
2372
|
+
/**
|
|
2373
|
+
* Clears the memoized storage cache.
|
|
2374
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
2375
|
+
* so new storage instances are created with the updated base path.
|
|
2376
|
+
*/
|
|
2377
|
+
clear() {
|
|
2378
|
+
bt.loggerService.log(PERSIST_MEASURE_UTILS_METHOD_NAME_CLEAR);
|
|
2379
|
+
this.getMeasureStorage.clear();
|
|
2380
|
+
}
|
|
2280
2381
|
/**
|
|
2281
2382
|
* Switches to the default JSON persist adapter.
|
|
2282
2383
|
*/
|
|
@@ -2420,16 +2521,24 @@ class PersistMemoryUtils {
|
|
|
2420
2521
|
}
|
|
2421
2522
|
};
|
|
2422
2523
|
/**
|
|
2423
|
-
*
|
|
2524
|
+
* Clears the memoized storage cache.
|
|
2525
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
2526
|
+
* so new storage instances are created with the updated base path.
|
|
2527
|
+
*/
|
|
2528
|
+
this.clear = () => {
|
|
2529
|
+
bt.loggerService.info(PERSIST_MEMORY_UTILS_METHOD_NAME_CLEAR);
|
|
2530
|
+
this.getMemoryStorage.clear();
|
|
2531
|
+
};
|
|
2532
|
+
/**
|
|
2533
|
+
* Disposes of the memory adapter and releases any resources.
|
|
2534
|
+
* Call this when a signal is removed to clean up its associated storage.
|
|
2424
2535
|
*
|
|
2425
2536
|
* @param signalId - Signal identifier
|
|
2426
2537
|
* @param bucketName - Bucket name
|
|
2538
|
+
* @returns void
|
|
2427
2539
|
*/
|
|
2428
|
-
this.
|
|
2429
|
-
bt.loggerService.info(
|
|
2430
|
-
signalId,
|
|
2431
|
-
bucketName,
|
|
2432
|
-
});
|
|
2540
|
+
this.dispose = (signalId, bucketName) => {
|
|
2541
|
+
bt.loggerService.info(PERSIST_MEMORY_UTILS_METHOD_NAME_DISPOSE);
|
|
2433
2542
|
const key = `${signalId}:${bucketName}`;
|
|
2434
2543
|
this.getMemoryStorage.clear(key);
|
|
2435
2544
|
};
|
|
@@ -19378,6 +19487,22 @@ const walker_strategy_columns = [
|
|
|
19378
19487
|
: "N/A",
|
|
19379
19488
|
isVisible: () => true,
|
|
19380
19489
|
},
|
|
19490
|
+
{
|
|
19491
|
+
key: "firstEventTime",
|
|
19492
|
+
label: "First Event",
|
|
19493
|
+
format: (data) => data.firstEventTime !== null
|
|
19494
|
+
? new Date(data.firstEventTime).toISOString()
|
|
19495
|
+
: "N/A",
|
|
19496
|
+
isVisible: () => true,
|
|
19497
|
+
},
|
|
19498
|
+
{
|
|
19499
|
+
key: "lastEventTime",
|
|
19500
|
+
label: "Last Event",
|
|
19501
|
+
format: (data) => data.lastEventTime !== null
|
|
19502
|
+
? new Date(data.lastEventTime).toISOString()
|
|
19503
|
+
: "N/A",
|
|
19504
|
+
isVisible: () => true,
|
|
19505
|
+
},
|
|
19381
19506
|
];
|
|
19382
19507
|
/**
|
|
19383
19508
|
* Column configuration for walker PNL table in markdown reports.
|
|
@@ -19518,6 +19643,7 @@ const MARKDOWN_METHOD_NAME_WRITE_DATA = "MarkdownAdapter.writeData";
|
|
|
19518
19643
|
const MARKDOWN_METHOD_NAME_USE_MD = "MarkdownAdapter.useMd";
|
|
19519
19644
|
const MARKDOWN_METHOD_NAME_USE_JSONL = "MarkdownAdapter.useJsonl";
|
|
19520
19645
|
const MARKDOWN_METHOD_NAME_USE_DUMMY = "MarkdownAdapter.useDummy";
|
|
19646
|
+
const MARKDOWN_METHOD_NAME_CLEAR = "MarkdownAdapter.clear";
|
|
19521
19647
|
/** Symbol key for the singleshot waitForInit function on MarkdownFileBase instances. */
|
|
19522
19648
|
const WAIT_FOR_INIT_SYMBOL$2 = Symbol("wait-for-init");
|
|
19523
19649
|
/** Symbol key for the timeout-protected write function on MarkdownFileBase instances. */
|
|
@@ -19989,6 +20115,15 @@ class MarkdownAdapter extends MarkdownUtils {
|
|
|
19989
20115
|
bt.loggerService.debug(MARKDOWN_METHOD_NAME_USE_JSONL);
|
|
19990
20116
|
this.useMarkdownAdapter(MarkdownFileBase);
|
|
19991
20117
|
}
|
|
20118
|
+
/**
|
|
20119
|
+
* Clears the memoized storage cache.
|
|
20120
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
20121
|
+
* so new storage instances are created with the updated base path.
|
|
20122
|
+
*/
|
|
20123
|
+
clear() {
|
|
20124
|
+
bt.loggerService.log(MARKDOWN_METHOD_NAME_CLEAR);
|
|
20125
|
+
this.getMarkdownStorage.clear();
|
|
20126
|
+
}
|
|
19992
20127
|
/**
|
|
19993
20128
|
* Switches to a dummy markdown adapter that discards all writes.
|
|
19994
20129
|
* All future markdown writes will be no-ops.
|
|
@@ -22186,10 +22321,19 @@ let ReportStorage$6 = class ReportStorage {
|
|
|
22186
22321
|
if (data.strategyName === data.bestStrategy) {
|
|
22187
22322
|
this._bestStats = data.stats;
|
|
22188
22323
|
}
|
|
22324
|
+
const signals = data.stats.signalList;
|
|
22325
|
+
const firstEventTime = signals.length > 0
|
|
22326
|
+
? signals.reduce((acc, s) => s.signal.pendingAt < acc ? s.signal.pendingAt : acc, signals[0].signal.pendingAt)
|
|
22327
|
+
: null;
|
|
22328
|
+
const lastEventTime = signals.length > 0
|
|
22329
|
+
? signals.reduce((acc, s) => s.closeTimestamp > acc ? s.closeTimestamp : acc, signals[0].closeTimestamp)
|
|
22330
|
+
: null;
|
|
22189
22331
|
this._strategyResults.unshift({
|
|
22190
22332
|
strategyName: data.strategyName,
|
|
22191
22333
|
stats: data.stats,
|
|
22192
22334
|
metricValue: isUnsafe$1(data.metricValue) ? null : data.metricValue,
|
|
22335
|
+
firstEventTime,
|
|
22336
|
+
lastEventTime,
|
|
22193
22337
|
});
|
|
22194
22338
|
}
|
|
22195
22339
|
/**
|
|
@@ -26781,6 +26925,7 @@ const REPORT_UTILS_METHOD_NAME_ENABLE = "ReportUtils.enable";
|
|
|
26781
26925
|
const REPORT_UTILS_METHOD_NAME_DISABLE = "ReportUtils.disable";
|
|
26782
26926
|
const REPORT_UTILS_METHOD_NAME_USE_DUMMY = "ReportUtils.useDummy";
|
|
26783
26927
|
const REPORT_UTILS_METHOD_NAME_USE_JSONL = "ReportUtils.useJsonl";
|
|
26928
|
+
const REPORT_UTILS_METHOD_NAME_CLEAR = "ReportUtils.clear";
|
|
26784
26929
|
/** Symbol key for the singleshot waitForInit function on ReportBase instances. */
|
|
26785
26930
|
const WAIT_FOR_INIT_SYMBOL$1 = Symbol("wait-for-init");
|
|
26786
26931
|
/** Symbol key for the timeout-protected write function on ReportBase instances. */
|
|
@@ -27190,6 +27335,15 @@ class ReportAdapter extends ReportUtils {
|
|
|
27190
27335
|
bt.loggerService.info(REPORT_UTILS_METHOD_NAME_USE_REPORT_ADAPTER);
|
|
27191
27336
|
this.ReportFactory = Ctor;
|
|
27192
27337
|
}
|
|
27338
|
+
/**
|
|
27339
|
+
* Clears the memoized storage cache.
|
|
27340
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
27341
|
+
* so new storage instances are created with the updated base path.
|
|
27342
|
+
*/
|
|
27343
|
+
clear() {
|
|
27344
|
+
bt.loggerService.log(REPORT_UTILS_METHOD_NAME_CLEAR);
|
|
27345
|
+
this.getReportStorage.clear();
|
|
27346
|
+
}
|
|
27193
27347
|
/**
|
|
27194
27348
|
* Switches to a dummy report adapter that discards all writes.
|
|
27195
27349
|
* All future report writes will be no-ops.
|
|
@@ -28032,6 +28186,13 @@ class WalkerReportService {
|
|
|
28032
28186
|
*/
|
|
28033
28187
|
this.tick = async (data) => {
|
|
28034
28188
|
this.loggerService.log(WALKER_REPORT_METHOD_NAME_TICK, { data });
|
|
28189
|
+
const signals = data.stats.signalList;
|
|
28190
|
+
const firstEventTime = signals.length > 0
|
|
28191
|
+
? signals.reduce((acc, s) => s.signal.pendingAt < acc ? s.signal.pendingAt : acc, signals[0].signal.pendingAt)
|
|
28192
|
+
: null;
|
|
28193
|
+
const lastEventTime = signals.length > 0
|
|
28194
|
+
? signals.reduce((acc, s) => s.closeTimestamp > acc ? s.closeTimestamp : acc, signals[0].closeTimestamp)
|
|
28195
|
+
: null;
|
|
28035
28196
|
await Report.writeData("walker", {
|
|
28036
28197
|
timestamp: getContextTimestamp(),
|
|
28037
28198
|
walkerName: data.walkerName,
|
|
@@ -28056,6 +28217,8 @@ class WalkerReportService {
|
|
|
28056
28217
|
annualizedSharpeRatio: data.stats.annualizedSharpeRatio,
|
|
28057
28218
|
certaintyRatio: data.stats.certaintyRatio,
|
|
28058
28219
|
expectedYearlyReturns: data.stats.expectedYearlyReturns,
|
|
28220
|
+
firstEventTime,
|
|
28221
|
+
lastEventTime,
|
|
28059
28222
|
}, {
|
|
28060
28223
|
symbol: data.symbol,
|
|
28061
28224
|
strategyName: data.strategyName,
|
|
@@ -33505,6 +33668,7 @@ const BROKER_METHOD_NAME_COMMIT_AVERAGE_BUY = "BrokerAdapter.commitAverageBuy";
|
|
|
33505
33668
|
const BROKER_METHOD_NAME_USE_BROKER_ADAPTER = "BrokerAdapter.useBrokerAdapter";
|
|
33506
33669
|
const BROKER_METHOD_NAME_ENABLE = "BrokerAdapter.enable";
|
|
33507
33670
|
const BROKER_METHOD_NAME_DISABLE = "BrokerAdapter.disable";
|
|
33671
|
+
const BROKER_METHOD_NAME_CLEAR = "BrokerAdapter.clear";
|
|
33508
33672
|
const BROKER_BASE_METHOD_NAME_WAIT_FOR_INIT = "BrokerBase.waitForInit";
|
|
33509
33673
|
const BROKER_BASE_METHOD_NAME_ON_SIGNAL_OPEN = "BrokerBase.onSignalOpenCommit";
|
|
33510
33674
|
const BROKER_BASE_METHOD_NAME_ON_SIGNAL_CLOSE = "BrokerBase.onSignalCloseCommit";
|
|
@@ -34104,6 +34268,16 @@ class BrokerAdapter {
|
|
|
34104
34268
|
lastSubscription();
|
|
34105
34269
|
}
|
|
34106
34270
|
};
|
|
34271
|
+
/**
|
|
34272
|
+
* Clears the cached broker instance and resets the enable singleshot.
|
|
34273
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
34274
|
+
* so a new broker instance is created with the updated base path.
|
|
34275
|
+
*/
|
|
34276
|
+
this.clear = () => {
|
|
34277
|
+
bt.loggerService.info(BROKER_METHOD_NAME_CLEAR, {});
|
|
34278
|
+
this._brokerInstance = null;
|
|
34279
|
+
this.enable.clear();
|
|
34280
|
+
};
|
|
34107
34281
|
}
|
|
34108
34282
|
}
|
|
34109
34283
|
/**
|
|
@@ -43397,6 +43571,7 @@ const MEMORY_ADAPTER_METHOD_NAME_READ = "MemoryAdapter.readMemory";
|
|
|
43397
43571
|
const MEMORY_ADAPTER_METHOD_NAME_USE_LOCAL = "MemoryAdapter.useLocal";
|
|
43398
43572
|
const MEMORY_ADAPTER_METHOD_NAME_USE_PERSIST = "MemoryAdapter.usePersist";
|
|
43399
43573
|
const MEMORY_ADAPTER_METHOD_NAME_USE_DUMMY = "MemoryAdapter.useDummy";
|
|
43574
|
+
const MEMORY_ADAPTER_METHOD_NAME_CLEAR = "MemoryAdapter.clear";
|
|
43400
43575
|
/**
|
|
43401
43576
|
* In-memory BM25 search index backed instance.
|
|
43402
43577
|
* All data lives in the process memory only - no disk persistence.
|
|
@@ -43619,7 +43794,7 @@ class MemoryPersistInstance {
|
|
|
43619
43794
|
signalId: this.signalId,
|
|
43620
43795
|
bucketName: this.bucketName,
|
|
43621
43796
|
});
|
|
43622
|
-
PersistMemoryAdapter.
|
|
43797
|
+
PersistMemoryAdapter.dispose(this.signalId, this.bucketName);
|
|
43623
43798
|
}
|
|
43624
43799
|
}
|
|
43625
43800
|
/**
|
|
@@ -43857,6 +44032,15 @@ class MemoryAdapter {
|
|
|
43857
44032
|
bt.loggerService.info(MEMORY_ADAPTER_METHOD_NAME_USE_DUMMY);
|
|
43858
44033
|
this.MemoryFactory = MemoryDummyInstance;
|
|
43859
44034
|
};
|
|
44035
|
+
/**
|
|
44036
|
+
* Clears the memoized instance cache.
|
|
44037
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
44038
|
+
* so new instances are created with the updated base path.
|
|
44039
|
+
*/
|
|
44040
|
+
this.clear = () => {
|
|
44041
|
+
bt.loggerService.info(MEMORY_ADAPTER_METHOD_NAME_CLEAR);
|
|
44042
|
+
this.getInstance.clear();
|
|
44043
|
+
};
|
|
43860
44044
|
/**
|
|
43861
44045
|
* Releases resources held by this adapter.
|
|
43862
44046
|
* Delegates to disable() to unsubscribe from signal lifecycle events.
|
|
@@ -44144,6 +44328,7 @@ const DUMP_ADAPTER_METHOD_NAME_USE_MEMORY = "DumpAdapter.useMemory";
|
|
|
44144
44328
|
const DUMP_ADAPTER_METHOD_NAME_USE_DUMMY = "DumpAdapter.useDummy";
|
|
44145
44329
|
const DUMP_ADAPTER_METHOD_NAME_USE_BOTH = "DumpAdapter.useMarkdownMemoryBoth";
|
|
44146
44330
|
const DUMP_ADAPTER_METHOD_NAME_USE_ADAPTER = "DumpAdapter.useDumpAdapter";
|
|
44331
|
+
const DUMP_ADAPTER_METHOD_NAME_CLEAR = "DumpAdapter.clear";
|
|
44147
44332
|
/**
|
|
44148
44333
|
* Renders a single MessageModel as a markdown section.
|
|
44149
44334
|
* tool_calls are rendered as a fenced JSON block.
|
|
@@ -44901,6 +45086,15 @@ class DumpAdapter {
|
|
|
44901
45086
|
bt.loggerService.info(DUMP_ADAPTER_METHOD_NAME_USE_ADAPTER);
|
|
44902
45087
|
this.DumpFactory = Ctor;
|
|
44903
45088
|
};
|
|
45089
|
+
/**
|
|
45090
|
+
* Clears the memoized instance cache.
|
|
45091
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
45092
|
+
* so new instances are created with the updated base path.
|
|
45093
|
+
*/
|
|
45094
|
+
this.clear = () => {
|
|
45095
|
+
bt.loggerService.info(DUMP_ADAPTER_METHOD_NAME_CLEAR);
|
|
45096
|
+
this.getInstance.clear();
|
|
45097
|
+
};
|
|
44904
45098
|
}
|
|
44905
45099
|
}
|
|
44906
45100
|
const Dump = new DumpAdapter();
|
|
@@ -45221,6 +45415,7 @@ const LOG_ADAPTER_METHOD_NAME_USE_PERSIST = "LogAdapter.usePersist";
|
|
|
45221
45415
|
const LOG_ADAPTER_METHOD_NAME_USE_MEMORY = "LogAdapter.useMemory";
|
|
45222
45416
|
const LOG_ADAPTER_METHOD_NAME_USE_DUMMY = "LogAdapter.useDummy";
|
|
45223
45417
|
const LOG_ADAPTER_METHOD_NAME_USE_JSONL = "LogAdapter.useJsonl";
|
|
45418
|
+
const LOG_ADAPTER_METHOD_NAME_CLEAR = "LogAdapter.clear";
|
|
45224
45419
|
const LOG_JSONL_METHOD_NAME_LOG = "LogJsonlUtils.log";
|
|
45225
45420
|
const LOG_JSONL_METHOD_NAME_DEBUG = "LogJsonlUtils.debug";
|
|
45226
45421
|
const LOG_JSONL_METHOD_NAME_INFO = "LogJsonlUtils.info";
|
|
@@ -45842,6 +46037,15 @@ class LogAdapter {
|
|
|
45842
46037
|
bt.loggerService.info(LOG_ADAPTER_METHOD_NAME_USE_JSONL);
|
|
45843
46038
|
this._log = new LogJsonlUtils(fileName, dirName);
|
|
45844
46039
|
};
|
|
46040
|
+
/**
|
|
46041
|
+
* Clears the cached log instance by resetting to the default in-memory adapter.
|
|
46042
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
46043
|
+
* so a new adapter instance is created with the updated base path.
|
|
46044
|
+
*/
|
|
46045
|
+
this.clear = () => {
|
|
46046
|
+
bt.loggerService.info(LOG_ADAPTER_METHOD_NAME_CLEAR);
|
|
46047
|
+
this._log = new LogMemoryUtils();
|
|
46048
|
+
};
|
|
45845
46049
|
}
|
|
45846
46050
|
}
|
|
45847
46051
|
/**
|
|
@@ -47569,10 +47773,12 @@ const STORAGE_BACKTEST_ADAPTER_METHOD_NAME_USE_ADAPTER = "StorageBacktestAdapter
|
|
|
47569
47773
|
const STORAGE_BACKTEST_ADAPTER_METHOD_NAME_USE_DUMMY = "StorageBacktestAdapter.useDummy";
|
|
47570
47774
|
const STORAGE_BACKTEST_ADAPTER_METHOD_NAME_USE_PERSIST = "StorageBacktestAdapter.usePersist";
|
|
47571
47775
|
const STORAGE_BACKTEST_ADAPTER_METHOD_NAME_USE_MEMORY = "StorageBacktestAdapter.useMemory";
|
|
47776
|
+
const STORAGE_BACKTEST_ADAPTER_METHOD_NAME_CLEAR = "StorageBacktestAdapter.clear";
|
|
47572
47777
|
const STORAGE_LIVE_ADAPTER_METHOD_NAME_USE_ADAPTER = "StorageLiveAdapter.useStorageAdapter";
|
|
47573
47778
|
const STORAGE_LIVE_ADAPTER_METHOD_NAME_USE_DUMMY = "StorageLiveAdapter.useDummy";
|
|
47574
47779
|
const STORAGE_LIVE_ADAPTER_METHOD_NAME_USE_PERSIST = "StorageLiveAdapter.usePersist";
|
|
47575
47780
|
const STORAGE_LIVE_ADAPTER_METHOD_NAME_USE_MEMORY = "StorageLiveAdapter.useMemory";
|
|
47781
|
+
const STORAGE_LIVE_ADAPTER_METHOD_NAME_CLEAR = "StorageLiveAdapter.clear";
|
|
47576
47782
|
/**
|
|
47577
47783
|
* Persistent storage adapter for backtest signals.
|
|
47578
47784
|
*
|
|
@@ -48559,6 +48765,15 @@ class StorageBacktestAdapter {
|
|
|
48559
48765
|
bt.loggerService.info(STORAGE_BACKTEST_ADAPTER_METHOD_NAME_USE_MEMORY);
|
|
48560
48766
|
this._signalBacktestUtils = new StorageMemoryBacktestUtils();
|
|
48561
48767
|
};
|
|
48768
|
+
/**
|
|
48769
|
+
* Clears the cached utils instance by resetting to the default in-memory adapter.
|
|
48770
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
48771
|
+
* so a new instance is created with the updated base path.
|
|
48772
|
+
*/
|
|
48773
|
+
this.clear = () => {
|
|
48774
|
+
bt.loggerService.info(STORAGE_BACKTEST_ADAPTER_METHOD_NAME_CLEAR);
|
|
48775
|
+
this._signalBacktestUtils = new StorageMemoryBacktestUtils();
|
|
48776
|
+
};
|
|
48562
48777
|
}
|
|
48563
48778
|
}
|
|
48564
48779
|
/**
|
|
@@ -48663,6 +48878,15 @@ class StorageLiveAdapter {
|
|
|
48663
48878
|
bt.loggerService.info(STORAGE_LIVE_ADAPTER_METHOD_NAME_USE_MEMORY);
|
|
48664
48879
|
this._signalLiveUtils = new StorageMemoryLiveUtils();
|
|
48665
48880
|
};
|
|
48881
|
+
/**
|
|
48882
|
+
* Clears the cached utils instance by resetting to the default persistent adapter.
|
|
48883
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
48884
|
+
* so a new instance is created with the updated base path.
|
|
48885
|
+
*/
|
|
48886
|
+
this.clear = () => {
|
|
48887
|
+
bt.loggerService.info(STORAGE_LIVE_ADAPTER_METHOD_NAME_CLEAR);
|
|
48888
|
+
this._signalLiveUtils = new StoragePersistLiveUtils();
|
|
48889
|
+
};
|
|
48666
48890
|
}
|
|
48667
48891
|
}
|
|
48668
48892
|
/**
|
|
@@ -49483,7 +49707,7 @@ const NOTIFICATION_MEMORY_BACKTEST_METHOD_NAME_HANDLE_ERROR = "NotificationMemor
|
|
|
49483
49707
|
const NOTIFICATION_MEMORY_BACKTEST_METHOD_NAME_HANDLE_CRITICAL_ERROR = "NotificationMemoryBacktestUtils.handleCriticalError";
|
|
49484
49708
|
const NOTIFICATION_MEMORY_BACKTEST_METHOD_NAME_HANDLE_VALIDATION_ERROR = "NotificationMemoryBacktestUtils.handleValidationError";
|
|
49485
49709
|
const NOTIFICATION_MEMORY_BACKTEST_METHOD_NAME_GET_DATA = "NotificationMemoryBacktestUtils.getData";
|
|
49486
|
-
const
|
|
49710
|
+
const NOTIFICATION_MEMORY_BACKTEST_METHOD_NAME_DISPOSE = "NotificationMemoryBacktestUtils.dispose";
|
|
49487
49711
|
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_HANDLE_SIGNAL = "NotificationMemoryLiveUtils.handleSignal";
|
|
49488
49712
|
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_HANDLE_PARTIAL_PROFIT = "NotificationMemoryLiveUtils.handlePartialProfit";
|
|
49489
49713
|
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_HANDLE_PARTIAL_LOSS = "NotificationMemoryLiveUtils.handlePartialLoss";
|
|
@@ -49495,19 +49719,21 @@ const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_HANDLE_ERROR = "NotificationMemoryLiv
|
|
|
49495
49719
|
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_HANDLE_CRITICAL_ERROR = "NotificationMemoryLiveUtils.handleCriticalError";
|
|
49496
49720
|
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_HANDLE_VALIDATION_ERROR = "NotificationMemoryLiveUtils.handleValidationError";
|
|
49497
49721
|
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_GET_DATA = "NotificationMemoryLiveUtils.getData";
|
|
49498
|
-
const
|
|
49722
|
+
const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_DISPOSE = "NotificationMemoryLiveUtils.clear";
|
|
49499
49723
|
const NOTIFICATION_ADAPTER_METHOD_NAME_ENABLE = "NotificationAdapter.enable";
|
|
49500
49724
|
const NOTIFICATION_ADAPTER_METHOD_NAME_DISABLE = "NotificationAdapter.disable";
|
|
49501
49725
|
const NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST = "NotificationAdapter.getDataBacktest";
|
|
49502
|
-
const
|
|
49726
|
+
const NOTIFICATION_ADAPTER_METHOD_NAME_DISPOSE_LIVE = "NotificationAdapter.disposeLive";
|
|
49503
49727
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_ADAPTER = "NotificationBacktestAdapter.useNotificationAdapter";
|
|
49504
49728
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_DUMMY = "NotificationBacktestAdapter.useDummy";
|
|
49505
49729
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_MEMORY = "NotificationBacktestAdapter.useMemory";
|
|
49506
49730
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_PERSIST = "NotificationBacktestAdapter.usePersist";
|
|
49731
|
+
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_CLEAR = "NotificationBacktestAdapter.clear";
|
|
49507
49732
|
const NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_USE_ADAPTER = "NotificationLiveAdapter.useNotificationAdapter";
|
|
49508
49733
|
const NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_USE_DUMMY = "NotificationLiveAdapter.useDummy";
|
|
49509
49734
|
const NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_USE_MEMORY = "NotificationLiveAdapter.useMemory";
|
|
49510
49735
|
const NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_USE_PERSIST = "NotificationLiveAdapter.usePersist";
|
|
49736
|
+
const NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_CLEAR = "NotificationLiveAdapter.clear";
|
|
49511
49737
|
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_WAIT_FOR_INIT = "NotificationPersistBacktestUtils.waitForInit";
|
|
49512
49738
|
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_UPDATE_NOTIFICATIONS = "NotificationPersistBacktestUtils._updateNotifications";
|
|
49513
49739
|
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_HANDLE_SIGNAL = "NotificationPersistBacktestUtils.handleSignal";
|
|
@@ -49521,7 +49747,7 @@ const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_HANDLE_ERROR = "NotificationPers
|
|
|
49521
49747
|
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_HANDLE_CRITICAL_ERROR = "NotificationPersistBacktestUtils.handleCriticalError";
|
|
49522
49748
|
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_HANDLE_VALIDATION_ERROR = "NotificationPersistBacktestUtils.handleValidationError";
|
|
49523
49749
|
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_GET_DATA = "NotificationPersistBacktestUtils.getData";
|
|
49524
|
-
const
|
|
49750
|
+
const NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_DISPOSE = "NotificationPersistBacktestUtils.clear";
|
|
49525
49751
|
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_WAIT_FOR_INIT = "NotificationPersistLiveUtils.waitForInit";
|
|
49526
49752
|
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_UPDATE_NOTIFICATIONS = "NotificationPersistLiveUtils._updateNotifications";
|
|
49527
49753
|
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_HANDLE_SIGNAL = "NotificationPersistLiveUtils.handleSignal";
|
|
@@ -49535,7 +49761,7 @@ const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_HANDLE_ERROR = "NotificationPersistL
|
|
|
49535
49761
|
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_HANDLE_CRITICAL_ERROR = "NotificationPersistLiveUtils.handleCriticalError";
|
|
49536
49762
|
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_HANDLE_VALIDATION_ERROR = "NotificationPersistLiveUtils.handleValidationError";
|
|
49537
49763
|
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_GET_DATA = "NotificationPersistLiveUtils.getData";
|
|
49538
|
-
const
|
|
49764
|
+
const NOTIFICATION_PERSIST_LIVE_METHOD_NAME_DISPOSE = "NotificationPersistLiveUtils.clear";
|
|
49539
49765
|
/**
|
|
49540
49766
|
* In-memory notification adapter for backtest signals.
|
|
49541
49767
|
*
|
|
@@ -49678,8 +49904,8 @@ class NotificationMemoryBacktestUtils {
|
|
|
49678
49904
|
/**
|
|
49679
49905
|
* Clears all stored notifications.
|
|
49680
49906
|
*/
|
|
49681
|
-
this.
|
|
49682
|
-
bt.loggerService.info(
|
|
49907
|
+
this.dispose = async () => {
|
|
49908
|
+
bt.loggerService.info(NOTIFICATION_MEMORY_BACKTEST_METHOD_NAME_DISPOSE);
|
|
49683
49909
|
this._notifications = [];
|
|
49684
49910
|
};
|
|
49685
49911
|
}
|
|
@@ -49768,7 +49994,7 @@ class NotificationDummyBacktestUtils {
|
|
|
49768
49994
|
/**
|
|
49769
49995
|
* No-op clear operation.
|
|
49770
49996
|
*/
|
|
49771
|
-
this.
|
|
49997
|
+
this.dispose = async () => {
|
|
49772
49998
|
};
|
|
49773
49999
|
}
|
|
49774
50000
|
}
|
|
@@ -49948,8 +50174,8 @@ class NotificationPersistBacktestUtils {
|
|
|
49948
50174
|
/**
|
|
49949
50175
|
* Clears all stored notifications.
|
|
49950
50176
|
*/
|
|
49951
|
-
this.
|
|
49952
|
-
bt.loggerService.info(
|
|
50177
|
+
this.dispose = async () => {
|
|
50178
|
+
bt.loggerService.info(NOTIFICATION_PERSIST_BACKTEST_METHOD_NAME_DISPOSE);
|
|
49953
50179
|
await this.waitForInit();
|
|
49954
50180
|
this._notifications.clear();
|
|
49955
50181
|
await this._updateNotifications();
|
|
@@ -50130,8 +50356,8 @@ class NotificationMemoryLiveUtils {
|
|
|
50130
50356
|
/**
|
|
50131
50357
|
* Clears all stored notifications.
|
|
50132
50358
|
*/
|
|
50133
|
-
this.
|
|
50134
|
-
bt.loggerService.info(
|
|
50359
|
+
this.dispose = async () => {
|
|
50360
|
+
bt.loggerService.info(NOTIFICATION_MEMORY_LIVE_METHOD_NAME_DISPOSE);
|
|
50135
50361
|
this._notifications = [];
|
|
50136
50362
|
};
|
|
50137
50363
|
}
|
|
@@ -50220,7 +50446,7 @@ class NotificationDummyLiveUtils {
|
|
|
50220
50446
|
/**
|
|
50221
50447
|
* No-op clear operation.
|
|
50222
50448
|
*/
|
|
50223
|
-
this.
|
|
50449
|
+
this.dispose = async () => {
|
|
50224
50450
|
};
|
|
50225
50451
|
}
|
|
50226
50452
|
}
|
|
@@ -50401,8 +50627,8 @@ class NotificationPersistLiveUtils {
|
|
|
50401
50627
|
/**
|
|
50402
50628
|
* Clears all stored notifications.
|
|
50403
50629
|
*/
|
|
50404
|
-
this.
|
|
50405
|
-
bt.loggerService.info(
|
|
50630
|
+
this.dispose = async () => {
|
|
50631
|
+
bt.loggerService.info(NOTIFICATION_PERSIST_LIVE_METHOD_NAME_DISPOSE);
|
|
50406
50632
|
await this.waitForInit();
|
|
50407
50633
|
this._notifications.clear();
|
|
50408
50634
|
await this._updateNotifications();
|
|
@@ -50550,8 +50776,8 @@ class NotificationBacktestAdapter {
|
|
|
50550
50776
|
* Clears all stored notifications.
|
|
50551
50777
|
* Proxies call to the underlying notification adapter.
|
|
50552
50778
|
*/
|
|
50553
|
-
this.
|
|
50554
|
-
return await this._notificationBacktestUtils.
|
|
50779
|
+
this.dispose = async () => {
|
|
50780
|
+
return await this._notificationBacktestUtils.dispose();
|
|
50555
50781
|
};
|
|
50556
50782
|
/**
|
|
50557
50783
|
* Sets the notification adapter constructor.
|
|
@@ -50587,6 +50813,15 @@ class NotificationBacktestAdapter {
|
|
|
50587
50813
|
bt.loggerService.info(NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_PERSIST);
|
|
50588
50814
|
this._notificationBacktestUtils = new NotificationPersistBacktestUtils();
|
|
50589
50815
|
};
|
|
50816
|
+
/**
|
|
50817
|
+
* Resets the cached utils instance to the default in-memory adapter.
|
|
50818
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
50819
|
+
* so a new instance is created with the updated base path.
|
|
50820
|
+
*/
|
|
50821
|
+
this.clear = () => {
|
|
50822
|
+
bt.loggerService.info(NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_CLEAR);
|
|
50823
|
+
this._notificationBacktestUtils = new NotificationMemoryBacktestUtils();
|
|
50824
|
+
};
|
|
50590
50825
|
}
|
|
50591
50826
|
}
|
|
50592
50827
|
/**
|
|
@@ -50696,8 +50931,8 @@ class NotificationLiveAdapter {
|
|
|
50696
50931
|
* Clears all stored notifications.
|
|
50697
50932
|
* Proxies call to the underlying notification adapter.
|
|
50698
50933
|
*/
|
|
50699
|
-
this.
|
|
50700
|
-
return await this._notificationLiveUtils.
|
|
50934
|
+
this.dispose = async () => {
|
|
50935
|
+
return await this._notificationLiveUtils.dispose();
|
|
50701
50936
|
};
|
|
50702
50937
|
/**
|
|
50703
50938
|
* Sets the notification adapter constructor.
|
|
@@ -50733,6 +50968,15 @@ class NotificationLiveAdapter {
|
|
|
50733
50968
|
bt.loggerService.info(NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_USE_PERSIST);
|
|
50734
50969
|
this._notificationLiveUtils = new NotificationPersistLiveUtils();
|
|
50735
50970
|
};
|
|
50971
|
+
/**
|
|
50972
|
+
* Resets the cached utils instance to the default in-memory adapter.
|
|
50973
|
+
* Call this when process.cwd() changes between strategy iterations
|
|
50974
|
+
* so a new instance is created with the updated base path.
|
|
50975
|
+
*/
|
|
50976
|
+
this.clear = () => {
|
|
50977
|
+
bt.loggerService.info(NOTIFICATION_LIVE_ADAPTER_METHOD_NAME_CLEAR);
|
|
50978
|
+
this._notificationLiveUtils = new NotificationMemoryLiveUtils();
|
|
50979
|
+
};
|
|
50736
50980
|
}
|
|
50737
50981
|
}
|
|
50738
50982
|
/**
|
|
@@ -50846,17 +51090,17 @@ class NotificationAdapter {
|
|
|
50846
51090
|
*
|
|
50847
51091
|
* @throws Error if NotificationAdapter is not enabled
|
|
50848
51092
|
*/
|
|
50849
|
-
this.
|
|
50850
|
-
bt.loggerService.info(
|
|
51093
|
+
this.dispose = async (isBacktest) => {
|
|
51094
|
+
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_DISPOSE_LIVE, {
|
|
50851
51095
|
backtest: isBacktest,
|
|
50852
51096
|
});
|
|
50853
51097
|
if (!this.enable.hasValue()) {
|
|
50854
51098
|
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
50855
51099
|
}
|
|
50856
51100
|
if (isBacktest) {
|
|
50857
|
-
return await NotificationBacktest.
|
|
51101
|
+
return await NotificationBacktest.dispose();
|
|
50858
51102
|
}
|
|
50859
|
-
return await NotificationLive.
|
|
51103
|
+
return await NotificationLive.dispose();
|
|
50860
51104
|
};
|
|
50861
51105
|
}
|
|
50862
51106
|
}
|