backtest-kit 3.0.2 → 3.0.3
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 +14 -31
- package/build/index.mjs +14 -31
- package/package.json +1 -1
- package/types.d.ts +4 -17
package/build/index.cjs
CHANGED
|
@@ -34167,8 +34167,6 @@ const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_CLEAR = "NotificationMemoryLiveUtils.
|
|
|
34167
34167
|
const NOTIFICATION_ADAPTER_METHOD_NAME_ENABLE = "NotificationAdapter.enable";
|
|
34168
34168
|
const NOTIFICATION_ADAPTER_METHOD_NAME_DISABLE = "NotificationAdapter.disable";
|
|
34169
34169
|
const NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST = "NotificationAdapter.getDataBacktest";
|
|
34170
|
-
const NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_LIVE = "NotificationAdapter.getDataLive";
|
|
34171
|
-
const NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_BACKTEST = "NotificationAdapter.clearBacktest";
|
|
34172
34170
|
const NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_LIVE = "NotificationAdapter.clearLive";
|
|
34173
34171
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_ADAPTER = "NotificationBacktestAdapter.useNotificationAdapter";
|
|
34174
34172
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_DUMMY = "NotificationBacktestAdapter.useDummy";
|
|
@@ -35396,52 +35394,37 @@ class NotificationAdapter {
|
|
|
35396
35394
|
}
|
|
35397
35395
|
};
|
|
35398
35396
|
/**
|
|
35399
|
-
* Gets all backtest notifications from storage.
|
|
35397
|
+
* Gets all backtest/live notifications from storage.
|
|
35400
35398
|
*
|
|
35401
35399
|
* @returns Array of all backtest notification models
|
|
35402
35400
|
* @throws Error if NotificationAdapter is not enabled
|
|
35403
35401
|
*/
|
|
35404
|
-
this.
|
|
35405
|
-
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST
|
|
35402
|
+
this.getData = async (isBacktest) => {
|
|
35403
|
+
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST, {
|
|
35404
|
+
backtest: isBacktest,
|
|
35405
|
+
});
|
|
35406
35406
|
if (!this.enable.hasValue()) {
|
|
35407
35407
|
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35408
35408
|
}
|
|
35409
|
-
|
|
35410
|
-
|
|
35411
|
-
/**
|
|
35412
|
-
* Gets all live notifications from storage.
|
|
35413
|
-
*
|
|
35414
|
-
* @returns Array of all live notification models
|
|
35415
|
-
* @throws Error if NotificationAdapter is not enabled
|
|
35416
|
-
*/
|
|
35417
|
-
this.getDataLive = async () => {
|
|
35418
|
-
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_LIVE);
|
|
35419
|
-
if (!this.enable.hasValue()) {
|
|
35420
|
-
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35409
|
+
if (isBacktest) {
|
|
35410
|
+
return await NotificationBacktest.getData();
|
|
35421
35411
|
}
|
|
35422
35412
|
return await NotificationLive.getData();
|
|
35423
35413
|
};
|
|
35424
35414
|
/**
|
|
35425
|
-
* Clears all backtest notifications from storage.
|
|
35415
|
+
* Clears all backtest/live notifications from storage.
|
|
35426
35416
|
*
|
|
35427
35417
|
* @throws Error if NotificationAdapter is not enabled
|
|
35428
35418
|
*/
|
|
35429
|
-
this.
|
|
35430
|
-
bt.loggerService.info(
|
|
35419
|
+
this.clear = async (isBacktest) => {
|
|
35420
|
+
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_LIVE, {
|
|
35421
|
+
backtest: isBacktest,
|
|
35422
|
+
});
|
|
35431
35423
|
if (!this.enable.hasValue()) {
|
|
35432
35424
|
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35433
35425
|
}
|
|
35434
|
-
|
|
35435
|
-
|
|
35436
|
-
/**
|
|
35437
|
-
* Clears all live notifications from storage.
|
|
35438
|
-
*
|
|
35439
|
-
* @throws Error if NotificationAdapter is not enabled
|
|
35440
|
-
*/
|
|
35441
|
-
this.clearLive = async () => {
|
|
35442
|
-
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_LIVE);
|
|
35443
|
-
if (!this.enable.hasValue()) {
|
|
35444
|
-
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35426
|
+
if (isBacktest) {
|
|
35427
|
+
return await NotificationBacktest.clear();
|
|
35445
35428
|
}
|
|
35446
35429
|
return await NotificationLive.clear();
|
|
35447
35430
|
};
|
package/build/index.mjs
CHANGED
|
@@ -34147,8 +34147,6 @@ const NOTIFICATION_MEMORY_LIVE_METHOD_NAME_CLEAR = "NotificationMemoryLiveUtils.
|
|
|
34147
34147
|
const NOTIFICATION_ADAPTER_METHOD_NAME_ENABLE = "NotificationAdapter.enable";
|
|
34148
34148
|
const NOTIFICATION_ADAPTER_METHOD_NAME_DISABLE = "NotificationAdapter.disable";
|
|
34149
34149
|
const NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST = "NotificationAdapter.getDataBacktest";
|
|
34150
|
-
const NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_LIVE = "NotificationAdapter.getDataLive";
|
|
34151
|
-
const NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_BACKTEST = "NotificationAdapter.clearBacktest";
|
|
34152
34150
|
const NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_LIVE = "NotificationAdapter.clearLive";
|
|
34153
34151
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_ADAPTER = "NotificationBacktestAdapter.useNotificationAdapter";
|
|
34154
34152
|
const NOTIFICATION_BACKTEST_ADAPTER_METHOD_NAME_USE_DUMMY = "NotificationBacktestAdapter.useDummy";
|
|
@@ -35376,52 +35374,37 @@ class NotificationAdapter {
|
|
|
35376
35374
|
}
|
|
35377
35375
|
};
|
|
35378
35376
|
/**
|
|
35379
|
-
* Gets all backtest notifications from storage.
|
|
35377
|
+
* Gets all backtest/live notifications from storage.
|
|
35380
35378
|
*
|
|
35381
35379
|
* @returns Array of all backtest notification models
|
|
35382
35380
|
* @throws Error if NotificationAdapter is not enabled
|
|
35383
35381
|
*/
|
|
35384
|
-
this.
|
|
35385
|
-
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST
|
|
35382
|
+
this.getData = async (isBacktest) => {
|
|
35383
|
+
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_BACKTEST, {
|
|
35384
|
+
backtest: isBacktest,
|
|
35385
|
+
});
|
|
35386
35386
|
if (!this.enable.hasValue()) {
|
|
35387
35387
|
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35388
35388
|
}
|
|
35389
|
-
|
|
35390
|
-
|
|
35391
|
-
/**
|
|
35392
|
-
* Gets all live notifications from storage.
|
|
35393
|
-
*
|
|
35394
|
-
* @returns Array of all live notification models
|
|
35395
|
-
* @throws Error if NotificationAdapter is not enabled
|
|
35396
|
-
*/
|
|
35397
|
-
this.getDataLive = async () => {
|
|
35398
|
-
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_GET_DATA_LIVE);
|
|
35399
|
-
if (!this.enable.hasValue()) {
|
|
35400
|
-
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35389
|
+
if (isBacktest) {
|
|
35390
|
+
return await NotificationBacktest.getData();
|
|
35401
35391
|
}
|
|
35402
35392
|
return await NotificationLive.getData();
|
|
35403
35393
|
};
|
|
35404
35394
|
/**
|
|
35405
|
-
* Clears all backtest notifications from storage.
|
|
35395
|
+
* Clears all backtest/live notifications from storage.
|
|
35406
35396
|
*
|
|
35407
35397
|
* @throws Error if NotificationAdapter is not enabled
|
|
35408
35398
|
*/
|
|
35409
|
-
this.
|
|
35410
|
-
bt.loggerService.info(
|
|
35399
|
+
this.clear = async (isBacktest) => {
|
|
35400
|
+
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_LIVE, {
|
|
35401
|
+
backtest: isBacktest,
|
|
35402
|
+
});
|
|
35411
35403
|
if (!this.enable.hasValue()) {
|
|
35412
35404
|
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35413
35405
|
}
|
|
35414
|
-
|
|
35415
|
-
|
|
35416
|
-
/**
|
|
35417
|
-
* Clears all live notifications from storage.
|
|
35418
|
-
*
|
|
35419
|
-
* @throws Error if NotificationAdapter is not enabled
|
|
35420
|
-
*/
|
|
35421
|
-
this.clearLive = async () => {
|
|
35422
|
-
bt.loggerService.info(NOTIFICATION_ADAPTER_METHOD_NAME_CLEAR_LIVE);
|
|
35423
|
-
if (!this.enable.hasValue()) {
|
|
35424
|
-
throw new Error("NotificationAdapter is not enabled. Call enable() first.");
|
|
35406
|
+
if (isBacktest) {
|
|
35407
|
+
return await NotificationBacktest.clear();
|
|
35425
35408
|
}
|
|
35426
35409
|
return await NotificationLive.clear();
|
|
35427
35410
|
};
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -13686,31 +13686,18 @@ declare class NotificationAdapter {
|
|
|
13686
13686
|
*/
|
|
13687
13687
|
disable: () => void;
|
|
13688
13688
|
/**
|
|
13689
|
-
* Gets all backtest notifications from storage.
|
|
13689
|
+
* Gets all backtest/live notifications from storage.
|
|
13690
13690
|
*
|
|
13691
13691
|
* @returns Array of all backtest notification models
|
|
13692
13692
|
* @throws Error if NotificationAdapter is not enabled
|
|
13693
13693
|
*/
|
|
13694
|
-
|
|
13694
|
+
getData: (isBacktest: boolean) => Promise<NotificationModel[]>;
|
|
13695
13695
|
/**
|
|
13696
|
-
*
|
|
13696
|
+
* Clears all backtest/live notifications from storage.
|
|
13697
13697
|
*
|
|
13698
|
-
* @returns Array of all live notification models
|
|
13699
13698
|
* @throws Error if NotificationAdapter is not enabled
|
|
13700
13699
|
*/
|
|
13701
|
-
|
|
13702
|
-
/**
|
|
13703
|
-
* Clears all backtest notifications from storage.
|
|
13704
|
-
*
|
|
13705
|
-
* @throws Error if NotificationAdapter is not enabled
|
|
13706
|
-
*/
|
|
13707
|
-
clearBacktest: () => Promise<void>;
|
|
13708
|
-
/**
|
|
13709
|
-
* Clears all live notifications from storage.
|
|
13710
|
-
*
|
|
13711
|
-
* @throws Error if NotificationAdapter is not enabled
|
|
13712
|
-
*/
|
|
13713
|
-
clearLive: () => Promise<void>;
|
|
13700
|
+
clear: (isBacktest: boolean) => Promise<void>;
|
|
13714
13701
|
}
|
|
13715
13702
|
/**
|
|
13716
13703
|
* Global singleton instance of NotificationAdapter.
|