backtest-kit 7.0.1 → 7.1.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
@@ -46713,20 +46713,13 @@ class RecentAdapter {
46713
46713
  if (!this.enable.hasValue()) {
46714
46714
  throw new Error("RecentAdapter is not enabled. Call enable() first.");
46715
46715
  }
46716
- if (await RecentBacktest.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, true)) {
46716
+ let signal = null;
46717
+ if (signal = await RecentBacktest.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, true)) {
46717
46718
  const timestamp = await backtest.timeMetaService.getTimestamp(symbol, context, true);
46718
- const signal = await this.getLatestSignal(symbol, context);
46719
- if (!signal) {
46720
- return null;
46721
- }
46722
46719
  return Math.floor((timestamp - signal.timestamp) / (1000 * 60));
46723
46720
  }
46724
- if (await RecentLive.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, false)) {
46721
+ if (signal = await RecentLive.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, false)) {
46725
46722
  const timestamp = await backtest.timeMetaService.getTimestamp(symbol, context, false);
46726
- const signal = await this.getLatestSignal(symbol, context);
46727
- if (!signal) {
46728
- return null;
46729
- }
46730
46723
  return Math.floor((timestamp - signal.timestamp) / (1000 * 60));
46731
46724
  }
46732
46725
  return null;
package/build/index.mjs CHANGED
@@ -46693,20 +46693,13 @@ class RecentAdapter {
46693
46693
  if (!this.enable.hasValue()) {
46694
46694
  throw new Error("RecentAdapter is not enabled. Call enable() first.");
46695
46695
  }
46696
- if (await RecentBacktest.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, true)) {
46696
+ let signal = null;
46697
+ if (signal = await RecentBacktest.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, true)) {
46697
46698
  const timestamp = await backtest.timeMetaService.getTimestamp(symbol, context, true);
46698
- const signal = await this.getLatestSignal(symbol, context);
46699
- if (!signal) {
46700
- return null;
46701
- }
46702
46699
  return Math.floor((timestamp - signal.timestamp) / (1000 * 60));
46703
46700
  }
46704
- if (await RecentLive.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, false)) {
46701
+ if (signal = await RecentLive.getLatestSignal(symbol, context.strategyName, context.exchangeName, context.frameName, false)) {
46705
46702
  const timestamp = await backtest.timeMetaService.getTimestamp(symbol, context, false);
46706
- const signal = await this.getLatestSignal(symbol, context);
46707
- if (!signal) {
46708
- return null;
46709
- }
46710
46703
  return Math.floor((timestamp - signal.timestamp) / (1000 * 60));
46711
46704
  }
46712
46705
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",