backtest-kit 12.3.0 → 12.4.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 CHANGED
@@ -13060,8 +13060,8 @@ class StrategyConnectionService {
13060
13060
  await strategy.waitForInit();
13061
13061
  const tick = await strategy.tick(symbol, context.strategyName);
13062
13062
  {
13063
- this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
13064
- this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
13063
+ await this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
13064
+ await this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
13065
13065
  }
13066
13066
  {
13067
13067
  await CALL_SIGNAL_EMIT_FN(this, tick, context, backtest, symbol);
@@ -19607,6 +19607,10 @@ const RUN_INFINITY_CHUNK_LOOP_FN = async (self, symbol, when, context, initialRe
19607
19607
  if (chunkResult.action !== "active") {
19608
19608
  return chunkResult;
19609
19609
  }
19610
+ {
19611
+ await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
19612
+ await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
19613
+ }
19610
19614
  lastChunkCandles = chunkCandles;
19611
19615
  backtestResult = chunkResult;
19612
19616
  chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
@@ -19787,6 +19791,10 @@ const RUN_OPENED_CHUNK_LOOP_FN = async (self, symbol, when, context, bufferStart
19787
19791
  if (chunkResult.action !== "active") {
19788
19792
  return chunkResult;
19789
19793
  }
19794
+ {
19795
+ await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
19796
+ await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
19797
+ }
19790
19798
  lastChunkCandles = chunkCandles;
19791
19799
  chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
19792
19800
  }
@@ -19877,6 +19885,8 @@ class BacktestLogicPrivateService {
19877
19885
  this.frameCoreService = inject(TYPES.frameCoreService);
19878
19886
  this.methodContextService = inject(TYPES.methodContextService);
19879
19887
  this.actionCoreService = inject(TYPES.actionCoreService);
19888
+ this.timeMetaService = inject(TYPES.timeMetaService);
19889
+ this.priceMetaService = inject(TYPES.priceMetaService);
19880
19890
  }
19881
19891
  /**
19882
19892
  * Runs backtest for a symbol, streaming closed signals as async generator.
package/build/index.mjs CHANGED
@@ -13040,8 +13040,8 @@ class StrategyConnectionService {
13040
13040
  await strategy.waitForInit();
13041
13041
  const tick = await strategy.tick(symbol, context.strategyName);
13042
13042
  {
13043
- this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
13044
- this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
13043
+ await this.priceMetaService.next(symbol, tick.currentPrice, context, backtest);
13044
+ await this.timeMetaService.next(symbol, tick.createdAt, context, backtest);
13045
13045
  }
13046
13046
  {
13047
13047
  await CALL_SIGNAL_EMIT_FN(this, tick, context, backtest, symbol);
@@ -19587,6 +19587,10 @@ const RUN_INFINITY_CHUNK_LOOP_FN = async (self, symbol, when, context, initialRe
19587
19587
  if (chunkResult.action !== "active") {
19588
19588
  return chunkResult;
19589
19589
  }
19590
+ {
19591
+ await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
19592
+ await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
19593
+ }
19590
19594
  lastChunkCandles = chunkCandles;
19591
19595
  backtestResult = chunkResult;
19592
19596
  chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
@@ -19767,6 +19771,10 @@ const RUN_OPENED_CHUNK_LOOP_FN = async (self, symbol, when, context, bufferStart
19767
19771
  if (chunkResult.action !== "active") {
19768
19772
  return chunkResult;
19769
19773
  }
19774
+ {
19775
+ await self.priceMetaService.next(symbol, chunkResult.currentPrice, context, true);
19776
+ await self.timeMetaService.next(symbol, chunkResult._backtestLastTimestamp, context, true);
19777
+ }
19770
19778
  lastChunkCandles = chunkCandles;
19771
19779
  chunkStart = new Date(chunkResult._backtestLastTimestamp + 60000 - bufferMs);
19772
19780
  }
@@ -19857,6 +19865,8 @@ class BacktestLogicPrivateService {
19857
19865
  this.frameCoreService = inject(TYPES.frameCoreService);
19858
19866
  this.methodContextService = inject(TYPES.methodContextService);
19859
19867
  this.actionCoreService = inject(TYPES.actionCoreService);
19868
+ this.timeMetaService = inject(TYPES.timeMetaService);
19869
+ this.priceMetaService = inject(TYPES.priceMetaService);
19860
19870
  }
19861
19871
  /**
19862
19872
  * Runs backtest for a symbol, streaming closed signals as async generator.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "12.3.0",
3
+ "version": "12.4.0",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -34491,6 +34491,8 @@ declare class BacktestLogicPrivateService {
34491
34491
  readonly context: IMethodContext;
34492
34492
  };
34493
34493
  readonly actionCoreService: ActionCoreService;
34494
+ readonly timeMetaService: TimeMetaService;
34495
+ readonly priceMetaService: PriceMetaService;
34494
34496
  /**
34495
34497
  * Runs backtest for a symbol, streaming closed signals as async generator.
34496
34498
  *
@@ -34582,6 +34584,8 @@ type IBacktestLogicPrivateService = Omit<BacktestLogicPrivateService, keyof {
34582
34584
  frameCoreService: never;
34583
34585
  actionCoreService: never;
34584
34586
  methodContextService: never;
34587
+ priceMetaService: never;
34588
+ timeMetaService: never;
34585
34589
  }>;
34586
34590
  /**
34587
34591
  * Type definition for BacktestLogicPublicService.