backtest-kit 1.2.1 → 1.2.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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <img src="./assets/triangle.svg" height="105px" align="right">
2
+
1
3
  # 🧿 Backtest Kit
2
4
 
3
5
  > **A production-ready TypeScript framework for backtesting and live trading strategies with crash-safe state persistence, signal validation, and memory-optimized architecture.**
package/build/index.cjs CHANGED
@@ -131,12 +131,14 @@ const globalServices$1 = {
131
131
  exchangeGlobalService: Symbol('exchangeGlobalService'),
132
132
  strategyGlobalService: Symbol('strategyGlobalService'),
133
133
  frameGlobalService: Symbol('frameGlobalService'),
134
- liveGlobalService: Symbol('liveGlobalService'),
135
- backtestGlobalService: Symbol('backtestGlobalService'),
136
- walkerGlobalService: Symbol('walkerGlobalService'),
137
134
  sizingGlobalService: Symbol('sizingGlobalService'),
138
135
  riskGlobalService: Symbol('riskGlobalService'),
139
136
  };
137
+ const commandServices$1 = {
138
+ liveCommandService: Symbol('liveCommandService'),
139
+ backtestCommandService: Symbol('backtestCommandService'),
140
+ walkerCommandService: Symbol('walkerCommandService'),
141
+ };
140
142
  const logicPrivateServices$1 = {
141
143
  backtestLogicPrivateService: Symbol('backtestLogicPrivateService'),
142
144
  liveLogicPrivateService: Symbol('liveLogicPrivateService'),
@@ -169,6 +171,7 @@ const TYPES = {
169
171
  ...connectionServices$1,
170
172
  ...schemaServices$1,
171
173
  ...globalServices$1,
174
+ ...commandServices$1,
172
175
  ...logicPrivateServices$1,
173
176
  ...logicPublicServices$1,
174
177
  ...markdownServices$1,
@@ -4795,14 +4798,14 @@ class WalkerLogicPublicService {
4795
4798
  }
4796
4799
  }
4797
4800
 
4798
- const METHOD_NAME_RUN$2 = "liveGlobalService run";
4801
+ const METHOD_NAME_RUN$2 = "liveCommandService run";
4799
4802
  /**
4800
4803
  * Global service providing access to live trading functionality.
4801
4804
  *
4802
4805
  * Simple wrapper around LiveLogicPublicService for dependency injection.
4803
4806
  * Used by public API exports.
4804
4807
  */
4805
- class LiveGlobalService {
4808
+ class LiveCommandService {
4806
4809
  constructor() {
4807
4810
  this.loggerService = inject(TYPES.loggerService);
4808
4811
  this.liveLogicPublicService = inject(TYPES.liveLogicPublicService);
@@ -4839,14 +4842,14 @@ class LiveGlobalService {
4839
4842
  }
4840
4843
  }
4841
4844
 
4842
- const METHOD_NAME_RUN$1 = "backtestGlobalService run";
4845
+ const METHOD_NAME_RUN$1 = "backtestCommandService run";
4843
4846
  /**
4844
4847
  * Global service providing access to backtest functionality.
4845
4848
  *
4846
4849
  * Simple wrapper around BacktestLogicPublicService for dependency injection.
4847
4850
  * Used by public API exports.
4848
4851
  */
4849
- class BacktestGlobalService {
4852
+ class BacktestCommandService {
4850
4853
  constructor() {
4851
4854
  this.loggerService = inject(TYPES.loggerService);
4852
4855
  this.strategySchemaService = inject(TYPES.strategySchemaService);
@@ -4882,14 +4885,14 @@ class BacktestGlobalService {
4882
4885
  }
4883
4886
  }
4884
4887
 
4885
- const METHOD_NAME_RUN = "walkerGlobalService run";
4888
+ const METHOD_NAME_RUN = "walkerCommandService run";
4886
4889
  /**
4887
4890
  * Global service providing access to walker functionality.
4888
4891
  *
4889
4892
  * Simple wrapper around WalkerLogicPublicService for dependency injection.
4890
4893
  * Used by public API exports.
4891
4894
  */
4892
- class WalkerGlobalService {
4895
+ class WalkerCommandService {
4893
4896
  constructor() {
4894
4897
  this.loggerService = inject(TYPES.loggerService);
4895
4898
  this.walkerLogicPublicService = inject(TYPES.walkerLogicPublicService);
@@ -7764,12 +7767,14 @@ class RiskValidationService {
7764
7767
  provide(TYPES.exchangeGlobalService, () => new ExchangeGlobalService());
7765
7768
  provide(TYPES.strategyGlobalService, () => new StrategyGlobalService());
7766
7769
  provide(TYPES.frameGlobalService, () => new FrameGlobalService());
7767
- provide(TYPES.liveGlobalService, () => new LiveGlobalService());
7768
- provide(TYPES.backtestGlobalService, () => new BacktestGlobalService());
7769
- provide(TYPES.walkerGlobalService, () => new WalkerGlobalService());
7770
7770
  provide(TYPES.sizingGlobalService, () => new SizingGlobalService());
7771
7771
  provide(TYPES.riskGlobalService, () => new RiskGlobalService());
7772
7772
  }
7773
+ {
7774
+ provide(TYPES.liveCommandService, () => new LiveCommandService());
7775
+ provide(TYPES.backtestCommandService, () => new BacktestCommandService());
7776
+ provide(TYPES.walkerCommandService, () => new WalkerCommandService());
7777
+ }
7773
7778
  {
7774
7779
  provide(TYPES.backtestLogicPrivateService, () => new BacktestLogicPrivateService());
7775
7780
  provide(TYPES.liveLogicPrivateService, () => new LiveLogicPrivateService());
@@ -7823,12 +7828,14 @@ const globalServices = {
7823
7828
  exchangeGlobalService: inject(TYPES.exchangeGlobalService),
7824
7829
  strategyGlobalService: inject(TYPES.strategyGlobalService),
7825
7830
  frameGlobalService: inject(TYPES.frameGlobalService),
7826
- liveGlobalService: inject(TYPES.liveGlobalService),
7827
- backtestGlobalService: inject(TYPES.backtestGlobalService),
7828
- walkerGlobalService: inject(TYPES.walkerGlobalService),
7829
7831
  sizingGlobalService: inject(TYPES.sizingGlobalService),
7830
7832
  riskGlobalService: inject(TYPES.riskGlobalService),
7831
7833
  };
7834
+ const commandServices = {
7835
+ liveCommandService: inject(TYPES.liveCommandService),
7836
+ backtestCommandService: inject(TYPES.backtestCommandService),
7837
+ walkerCommandService: inject(TYPES.walkerCommandService),
7838
+ };
7832
7839
  const logicPrivateServices = {
7833
7840
  backtestLogicPrivateService: inject(TYPES.backtestLogicPrivateService),
7834
7841
  liveLogicPrivateService: inject(TYPES.liveLogicPrivateService),
@@ -7861,6 +7868,7 @@ const backtest = {
7861
7868
  ...connectionServices,
7862
7869
  ...schemaServices,
7863
7870
  ...globalServices,
7871
+ ...commandServices,
7864
7872
  ...logicPrivateServices,
7865
7873
  ...logicPublicServices,
7866
7874
  ...markdownServices,
@@ -9155,7 +9163,7 @@ const BACKTEST_METHOD_NAME_DUMP = "BacktestUtils.dump";
9155
9163
  /**
9156
9164
  * Utility class for backtest operations.
9157
9165
  *
9158
- * Provides simplified access to backtestGlobalService.run() with logging.
9166
+ * Provides simplified access to backtestCommandService.run() with logging.
9159
9167
  * Exported as singleton instance for convenient usage.
9160
9168
  *
9161
9169
  * @example
@@ -9196,7 +9204,7 @@ class BacktestUtils {
9196
9204
  const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
9197
9205
  riskName && backtest$1.riskGlobalService.clear(riskName);
9198
9206
  }
9199
- return backtest$1.backtestGlobalService.run(symbol, context);
9207
+ return backtest$1.backtestCommandService.run(symbol, context);
9200
9208
  };
9201
9209
  /**
9202
9210
  * Runs backtest in background without yielding results.
@@ -9331,7 +9339,7 @@ const LIVE_METHOD_NAME_DUMP = "LiveUtils.dump";
9331
9339
  /**
9332
9340
  * Utility class for live trading operations.
9333
9341
  *
9334
- * Provides simplified access to liveGlobalService.run() with logging.
9342
+ * Provides simplified access to liveCommandService.run() with logging.
9335
9343
  * Exported as singleton instance for convenient usage.
9336
9344
  *
9337
9345
  * Features:
@@ -9385,7 +9393,7 @@ class LiveUtils {
9385
9393
  const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
9386
9394
  riskName && backtest$1.riskGlobalService.clear(riskName);
9387
9395
  }
9388
- return backtest$1.liveGlobalService.run(symbol, context);
9396
+ return backtest$1.liveCommandService.run(symbol, context);
9389
9397
  };
9390
9398
  /**
9391
9399
  * Runs live trading in background without yielding results.
@@ -9771,7 +9779,7 @@ const WALKER_METHOD_NAME_DUMP = "WalkerUtils.dump";
9771
9779
  /**
9772
9780
  * Utility class for walker operations.
9773
9781
  *
9774
- * Provides simplified access to walkerGlobalService.run() with logging.
9782
+ * Provides simplified access to walkerCommandService.run() with logging.
9775
9783
  * Automatically pulls exchangeName and frameName from walker schema.
9776
9784
  * Exported as singleton instance for convenient usage.
9777
9785
  *
@@ -9823,7 +9831,7 @@ class WalkerUtils {
9823
9831
  riskName && backtest$1.riskGlobalService.clear(riskName);
9824
9832
  }
9825
9833
  }
9826
- return backtest$1.walkerGlobalService.run(symbol, {
9834
+ return backtest$1.walkerCommandService.run(symbol, {
9827
9835
  walkerName: context.walkerName,
9828
9836
  exchangeName: walkerSchema.exchangeName,
9829
9837
  frameName: walkerSchema.frameName,
package/build/index.mjs CHANGED
@@ -129,12 +129,14 @@ const globalServices$1 = {
129
129
  exchangeGlobalService: Symbol('exchangeGlobalService'),
130
130
  strategyGlobalService: Symbol('strategyGlobalService'),
131
131
  frameGlobalService: Symbol('frameGlobalService'),
132
- liveGlobalService: Symbol('liveGlobalService'),
133
- backtestGlobalService: Symbol('backtestGlobalService'),
134
- walkerGlobalService: Symbol('walkerGlobalService'),
135
132
  sizingGlobalService: Symbol('sizingGlobalService'),
136
133
  riskGlobalService: Symbol('riskGlobalService'),
137
134
  };
135
+ const commandServices$1 = {
136
+ liveCommandService: Symbol('liveCommandService'),
137
+ backtestCommandService: Symbol('backtestCommandService'),
138
+ walkerCommandService: Symbol('walkerCommandService'),
139
+ };
138
140
  const logicPrivateServices$1 = {
139
141
  backtestLogicPrivateService: Symbol('backtestLogicPrivateService'),
140
142
  liveLogicPrivateService: Symbol('liveLogicPrivateService'),
@@ -167,6 +169,7 @@ const TYPES = {
167
169
  ...connectionServices$1,
168
170
  ...schemaServices$1,
169
171
  ...globalServices$1,
172
+ ...commandServices$1,
170
173
  ...logicPrivateServices$1,
171
174
  ...logicPublicServices$1,
172
175
  ...markdownServices$1,
@@ -4793,14 +4796,14 @@ class WalkerLogicPublicService {
4793
4796
  }
4794
4797
  }
4795
4798
 
4796
- const METHOD_NAME_RUN$2 = "liveGlobalService run";
4799
+ const METHOD_NAME_RUN$2 = "liveCommandService run";
4797
4800
  /**
4798
4801
  * Global service providing access to live trading functionality.
4799
4802
  *
4800
4803
  * Simple wrapper around LiveLogicPublicService for dependency injection.
4801
4804
  * Used by public API exports.
4802
4805
  */
4803
- class LiveGlobalService {
4806
+ class LiveCommandService {
4804
4807
  constructor() {
4805
4808
  this.loggerService = inject(TYPES.loggerService);
4806
4809
  this.liveLogicPublicService = inject(TYPES.liveLogicPublicService);
@@ -4837,14 +4840,14 @@ class LiveGlobalService {
4837
4840
  }
4838
4841
  }
4839
4842
 
4840
- const METHOD_NAME_RUN$1 = "backtestGlobalService run";
4843
+ const METHOD_NAME_RUN$1 = "backtestCommandService run";
4841
4844
  /**
4842
4845
  * Global service providing access to backtest functionality.
4843
4846
  *
4844
4847
  * Simple wrapper around BacktestLogicPublicService for dependency injection.
4845
4848
  * Used by public API exports.
4846
4849
  */
4847
- class BacktestGlobalService {
4850
+ class BacktestCommandService {
4848
4851
  constructor() {
4849
4852
  this.loggerService = inject(TYPES.loggerService);
4850
4853
  this.strategySchemaService = inject(TYPES.strategySchemaService);
@@ -4880,14 +4883,14 @@ class BacktestGlobalService {
4880
4883
  }
4881
4884
  }
4882
4885
 
4883
- const METHOD_NAME_RUN = "walkerGlobalService run";
4886
+ const METHOD_NAME_RUN = "walkerCommandService run";
4884
4887
  /**
4885
4888
  * Global service providing access to walker functionality.
4886
4889
  *
4887
4890
  * Simple wrapper around WalkerLogicPublicService for dependency injection.
4888
4891
  * Used by public API exports.
4889
4892
  */
4890
- class WalkerGlobalService {
4893
+ class WalkerCommandService {
4891
4894
  constructor() {
4892
4895
  this.loggerService = inject(TYPES.loggerService);
4893
4896
  this.walkerLogicPublicService = inject(TYPES.walkerLogicPublicService);
@@ -7762,12 +7765,14 @@ class RiskValidationService {
7762
7765
  provide(TYPES.exchangeGlobalService, () => new ExchangeGlobalService());
7763
7766
  provide(TYPES.strategyGlobalService, () => new StrategyGlobalService());
7764
7767
  provide(TYPES.frameGlobalService, () => new FrameGlobalService());
7765
- provide(TYPES.liveGlobalService, () => new LiveGlobalService());
7766
- provide(TYPES.backtestGlobalService, () => new BacktestGlobalService());
7767
- provide(TYPES.walkerGlobalService, () => new WalkerGlobalService());
7768
7768
  provide(TYPES.sizingGlobalService, () => new SizingGlobalService());
7769
7769
  provide(TYPES.riskGlobalService, () => new RiskGlobalService());
7770
7770
  }
7771
+ {
7772
+ provide(TYPES.liveCommandService, () => new LiveCommandService());
7773
+ provide(TYPES.backtestCommandService, () => new BacktestCommandService());
7774
+ provide(TYPES.walkerCommandService, () => new WalkerCommandService());
7775
+ }
7771
7776
  {
7772
7777
  provide(TYPES.backtestLogicPrivateService, () => new BacktestLogicPrivateService());
7773
7778
  provide(TYPES.liveLogicPrivateService, () => new LiveLogicPrivateService());
@@ -7821,12 +7826,14 @@ const globalServices = {
7821
7826
  exchangeGlobalService: inject(TYPES.exchangeGlobalService),
7822
7827
  strategyGlobalService: inject(TYPES.strategyGlobalService),
7823
7828
  frameGlobalService: inject(TYPES.frameGlobalService),
7824
- liveGlobalService: inject(TYPES.liveGlobalService),
7825
- backtestGlobalService: inject(TYPES.backtestGlobalService),
7826
- walkerGlobalService: inject(TYPES.walkerGlobalService),
7827
7829
  sizingGlobalService: inject(TYPES.sizingGlobalService),
7828
7830
  riskGlobalService: inject(TYPES.riskGlobalService),
7829
7831
  };
7832
+ const commandServices = {
7833
+ liveCommandService: inject(TYPES.liveCommandService),
7834
+ backtestCommandService: inject(TYPES.backtestCommandService),
7835
+ walkerCommandService: inject(TYPES.walkerCommandService),
7836
+ };
7830
7837
  const logicPrivateServices = {
7831
7838
  backtestLogicPrivateService: inject(TYPES.backtestLogicPrivateService),
7832
7839
  liveLogicPrivateService: inject(TYPES.liveLogicPrivateService),
@@ -7859,6 +7866,7 @@ const backtest = {
7859
7866
  ...connectionServices,
7860
7867
  ...schemaServices,
7861
7868
  ...globalServices,
7869
+ ...commandServices,
7862
7870
  ...logicPrivateServices,
7863
7871
  ...logicPublicServices,
7864
7872
  ...markdownServices,
@@ -9153,7 +9161,7 @@ const BACKTEST_METHOD_NAME_DUMP = "BacktestUtils.dump";
9153
9161
  /**
9154
9162
  * Utility class for backtest operations.
9155
9163
  *
9156
- * Provides simplified access to backtestGlobalService.run() with logging.
9164
+ * Provides simplified access to backtestCommandService.run() with logging.
9157
9165
  * Exported as singleton instance for convenient usage.
9158
9166
  *
9159
9167
  * @example
@@ -9194,7 +9202,7 @@ class BacktestUtils {
9194
9202
  const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
9195
9203
  riskName && backtest$1.riskGlobalService.clear(riskName);
9196
9204
  }
9197
- return backtest$1.backtestGlobalService.run(symbol, context);
9205
+ return backtest$1.backtestCommandService.run(symbol, context);
9198
9206
  };
9199
9207
  /**
9200
9208
  * Runs backtest in background without yielding results.
@@ -9329,7 +9337,7 @@ const LIVE_METHOD_NAME_DUMP = "LiveUtils.dump";
9329
9337
  /**
9330
9338
  * Utility class for live trading operations.
9331
9339
  *
9332
- * Provides simplified access to liveGlobalService.run() with logging.
9340
+ * Provides simplified access to liveCommandService.run() with logging.
9333
9341
  * Exported as singleton instance for convenient usage.
9334
9342
  *
9335
9343
  * Features:
@@ -9383,7 +9391,7 @@ class LiveUtils {
9383
9391
  const { riskName } = backtest$1.strategySchemaService.get(context.strategyName);
9384
9392
  riskName && backtest$1.riskGlobalService.clear(riskName);
9385
9393
  }
9386
- return backtest$1.liveGlobalService.run(symbol, context);
9394
+ return backtest$1.liveCommandService.run(symbol, context);
9387
9395
  };
9388
9396
  /**
9389
9397
  * Runs live trading in background without yielding results.
@@ -9769,7 +9777,7 @@ const WALKER_METHOD_NAME_DUMP = "WalkerUtils.dump";
9769
9777
  /**
9770
9778
  * Utility class for walker operations.
9771
9779
  *
9772
- * Provides simplified access to walkerGlobalService.run() with logging.
9780
+ * Provides simplified access to walkerCommandService.run() with logging.
9773
9781
  * Automatically pulls exchangeName and frameName from walker schema.
9774
9782
  * Exported as singleton instance for convenient usage.
9775
9783
  *
@@ -9821,7 +9829,7 @@ class WalkerUtils {
9821
9829
  riskName && backtest$1.riskGlobalService.clear(riskName);
9822
9830
  }
9823
9831
  }
9824
- return backtest$1.walkerGlobalService.run(symbol, {
9832
+ return backtest$1.walkerCommandService.run(symbol, {
9825
9833
  walkerName: context.walkerName,
9826
9834
  exchangeName: walkerSchema.exchangeName,
9827
9835
  frameName: walkerSchema.frameName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -3595,7 +3595,7 @@ declare const PersistRiskAdapter: PersistRiskUtils;
3595
3595
  /**
3596
3596
  * Utility class for backtest operations.
3597
3597
  *
3598
- * Provides simplified access to backtestGlobalService.run() with logging.
3598
+ * Provides simplified access to backtestCommandService.run() with logging.
3599
3599
  * Exported as singleton instance for convenient usage.
3600
3600
  *
3601
3601
  * @example
@@ -3716,7 +3716,7 @@ declare const Backtest: BacktestUtils;
3716
3716
  /**
3717
3717
  * Utility class for live trading operations.
3718
3718
  *
3719
- * Provides simplified access to liveGlobalService.run() with logging.
3719
+ * Provides simplified access to liveCommandService.run() with logging.
3720
3720
  * Exported as singleton instance for convenient usage.
3721
3721
  *
3722
3722
  * Features:
@@ -4063,7 +4063,7 @@ declare class Performance {
4063
4063
  /**
4064
4064
  * Utility class for walker operations.
4065
4065
  *
4066
- * Provides simplified access to walkerGlobalService.run() with logging.
4066
+ * Provides simplified access to walkerCommandService.run() with logging.
4067
4067
  * Automatically pulls exchangeName and frameName from walker schema.
4068
4068
  * Exported as singleton instance for convenient usage.
4069
4069
  *
@@ -5315,7 +5315,7 @@ declare class RiskGlobalService {
5315
5315
  * Simple wrapper around WalkerLogicPublicService for dependency injection.
5316
5316
  * Used by public API exports.
5317
5317
  */
5318
- declare class WalkerGlobalService {
5318
+ declare class WalkerCommandService {
5319
5319
  private readonly loggerService;
5320
5320
  private readonly walkerLogicPublicService;
5321
5321
  private readonly walkerSchemaService;
@@ -5898,7 +5898,7 @@ declare class WalkerLogicPublicService {
5898
5898
  * Simple wrapper around LiveLogicPublicService for dependency injection.
5899
5899
  * Used by public API exports.
5900
5900
  */
5901
- declare class LiveGlobalService {
5901
+ declare class LiveCommandService {
5902
5902
  private readonly loggerService;
5903
5903
  private readonly liveLogicPublicService;
5904
5904
  private readonly strategyValidationService;
@@ -5926,7 +5926,7 @@ declare class LiveGlobalService {
5926
5926
  * Simple wrapper around BacktestLogicPublicService for dependency injection.
5927
5927
  * Used by public API exports.
5928
5928
  */
5929
- declare class BacktestGlobalService {
5929
+ declare class BacktestCommandService {
5930
5930
  private readonly loggerService;
5931
5931
  private readonly strategySchemaService;
5932
5932
  private readonly riskValidationService;
@@ -6338,12 +6338,12 @@ declare const backtest: {
6338
6338
  backtestLogicPrivateService: BacktestLogicPrivateService;
6339
6339
  liveLogicPrivateService: LiveLogicPrivateService;
6340
6340
  walkerLogicPrivateService: WalkerLogicPrivateService;
6341
+ liveCommandService: LiveCommandService;
6342
+ backtestCommandService: BacktestCommandService;
6343
+ walkerCommandService: WalkerCommandService;
6341
6344
  exchangeGlobalService: ExchangeGlobalService;
6342
6345
  strategyGlobalService: StrategyGlobalService;
6343
6346
  frameGlobalService: FrameGlobalService;
6344
- liveGlobalService: LiveGlobalService;
6345
- backtestGlobalService: BacktestGlobalService;
6346
- walkerGlobalService: WalkerGlobalService;
6347
6347
  sizingGlobalService: SizingGlobalService;
6348
6348
  riskGlobalService: RiskGlobalService;
6349
6349
  exchangeSchemaService: ExchangeSchemaService;