backtest-kit 1.5.5 → 1.5.7

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
@@ -3179,17 +3179,15 @@ class ClientStrategy {
3179
3179
  backtest,
3180
3180
  });
3181
3181
  this._isStopped = true;
3182
- if (!this._pendingSignal) {
3182
+ // Clear scheduled signal if exists
3183
+ if (!this._scheduledSignal) {
3183
3184
  return;
3184
3185
  }
3185
- this._pendingSignal = null;
3186
- if (this.params.callbacks?.onWrite) {
3187
- this.params.callbacks.onWrite(symbol, this._pendingSignal, backtest);
3188
- }
3186
+ this._scheduledSignal = null;
3189
3187
  if (backtest) {
3190
3188
  return;
3191
3189
  }
3192
- await PersistScheduleAdapter.writeScheduleData(this._pendingSignal, symbol, strategyName);
3190
+ await PersistScheduleAdapter.writeScheduleData(this._scheduledSignal, symbol, strategyName);
3193
3191
  }
3194
3192
  }
3195
3193
 
@@ -13519,6 +13517,13 @@ class BacktestInstance {
13519
13517
  symbol,
13520
13518
  context,
13521
13519
  });
13520
+ backtest$1.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_RUN);
13521
+ backtest$1.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_RUN);
13522
+ backtest$1.frameValidationService.validate(context.frameName, BACKTEST_METHOD_NAME_RUN);
13523
+ {
13524
+ const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
13525
+ riskName && backtest$1.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_RUN);
13526
+ }
13522
13527
  {
13523
13528
  backtest$1.backtestMarkdownService.clear({ symbol, strategyName: context.strategyName });
13524
13529
  backtest$1.scheduleMarkdownService.clear({ symbol, strategyName: context.strategyName });
@@ -13972,6 +13977,12 @@ class LiveInstance {
13972
13977
  symbol,
13973
13978
  context,
13974
13979
  });
13980
+ backtest$1.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_RUN);
13981
+ backtest$1.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_RUN);
13982
+ {
13983
+ const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
13984
+ riskName && backtest$1.riskValidationService.validate(riskName, LIVE_METHOD_NAME_RUN);
13985
+ }
13975
13986
  {
13976
13987
  backtest$1.liveMarkdownService.clear({ symbol, strategyName: context.strategyName });
13977
13988
  backtest$1.scheduleMarkdownService.clear({ symbol, strategyName: context.strategyName });
package/build/index.mjs CHANGED
@@ -3177,17 +3177,15 @@ class ClientStrategy {
3177
3177
  backtest,
3178
3178
  });
3179
3179
  this._isStopped = true;
3180
- if (!this._pendingSignal) {
3180
+ // Clear scheduled signal if exists
3181
+ if (!this._scheduledSignal) {
3181
3182
  return;
3182
3183
  }
3183
- this._pendingSignal = null;
3184
- if (this.params.callbacks?.onWrite) {
3185
- this.params.callbacks.onWrite(symbol, this._pendingSignal, backtest);
3186
- }
3184
+ this._scheduledSignal = null;
3187
3185
  if (backtest) {
3188
3186
  return;
3189
3187
  }
3190
- await PersistScheduleAdapter.writeScheduleData(this._pendingSignal, symbol, strategyName);
3188
+ await PersistScheduleAdapter.writeScheduleData(this._scheduledSignal, symbol, strategyName);
3191
3189
  }
3192
3190
  }
3193
3191
 
@@ -13517,6 +13515,13 @@ class BacktestInstance {
13517
13515
  symbol,
13518
13516
  context,
13519
13517
  });
13518
+ backtest$1.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_RUN);
13519
+ backtest$1.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_RUN);
13520
+ backtest$1.frameValidationService.validate(context.frameName, BACKTEST_METHOD_NAME_RUN);
13521
+ {
13522
+ const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
13523
+ riskName && backtest$1.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_RUN);
13524
+ }
13520
13525
  {
13521
13526
  backtest$1.backtestMarkdownService.clear({ symbol, strategyName: context.strategyName });
13522
13527
  backtest$1.scheduleMarkdownService.clear({ symbol, strategyName: context.strategyName });
@@ -13970,6 +13975,12 @@ class LiveInstance {
13970
13975
  symbol,
13971
13976
  context,
13972
13977
  });
13978
+ backtest$1.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_RUN);
13979
+ backtest$1.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_RUN);
13980
+ {
13981
+ const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
13982
+ riskName && backtest$1.riskValidationService.validate(riskName, LIVE_METHOD_NAME_RUN);
13983
+ }
13973
13984
  {
13974
13985
  backtest$1.liveMarkdownService.clear({ symbol, strategyName: context.strategyName });
13975
13986
  backtest$1.scheduleMarkdownService.clear({ symbol, strategyName: context.strategyName });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",