backtest-kit 3.0.8 → 3.0.10

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
@@ -2602,8 +2602,10 @@ class ClientExchange {
2602
2602
  symbol,
2603
2603
  depth,
2604
2604
  });
2605
- const to = new Date(this.params.execution.context.when.getTime());
2606
- const from = new Date(to.getTime() -
2605
+ const whenTimestamp = this.params.execution.context.when.getTime();
2606
+ const alignedTo = ALIGN_TO_INTERVAL_FN$1(whenTimestamp, GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES);
2607
+ const to = new Date(alignedTo);
2608
+ const from = new Date(alignedTo -
2607
2609
  GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES * MS_PER_MINUTE$2);
2608
2610
  return await this.params.getOrderBook(symbol, depth, from, to, this.params.execution.context.backtest);
2609
2611
  }
@@ -35930,8 +35932,10 @@ class ExchangeInstance {
35930
35932
  symbol,
35931
35933
  depth,
35932
35934
  });
35933
- const to = await GET_TIMESTAMP_FN();
35934
- const from = new Date(to.getTime() - GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES * MS_PER_MINUTE$1);
35935
+ const when = await GET_TIMESTAMP_FN();
35936
+ const alignedTo = ALIGN_TO_INTERVAL_FN(when.getTime(), GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES);
35937
+ const to = new Date(alignedTo);
35938
+ const from = new Date(alignedTo - GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES * MS_PER_MINUTE$1);
35935
35939
  const isBacktest = await GET_BACKTEST_FN();
35936
35940
  return await this._methods.getOrderBook(symbol, depth, from, to, isBacktest);
35937
35941
  };
package/build/index.mjs CHANGED
@@ -2582,8 +2582,10 @@ class ClientExchange {
2582
2582
  symbol,
2583
2583
  depth,
2584
2584
  });
2585
- const to = new Date(this.params.execution.context.when.getTime());
2586
- const from = new Date(to.getTime() -
2585
+ const whenTimestamp = this.params.execution.context.when.getTime();
2586
+ const alignedTo = ALIGN_TO_INTERVAL_FN$1(whenTimestamp, GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES);
2587
+ const to = new Date(alignedTo);
2588
+ const from = new Date(alignedTo -
2587
2589
  GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES * MS_PER_MINUTE$2);
2588
2590
  return await this.params.getOrderBook(symbol, depth, from, to, this.params.execution.context.backtest);
2589
2591
  }
@@ -35910,8 +35912,10 @@ class ExchangeInstance {
35910
35912
  symbol,
35911
35913
  depth,
35912
35914
  });
35913
- const to = await GET_TIMESTAMP_FN();
35914
- const from = new Date(to.getTime() - GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES * MS_PER_MINUTE$1);
35915
+ const when = await GET_TIMESTAMP_FN();
35916
+ const alignedTo = ALIGN_TO_INTERVAL_FN(when.getTime(), GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES);
35917
+ const to = new Date(alignedTo);
35918
+ const from = new Date(alignedTo - GLOBAL_CONFIG.CC_ORDER_BOOK_TIME_OFFSET_MINUTES * MS_PER_MINUTE$1);
35915
35919
  const isBacktest = await GET_BACKTEST_FN();
35916
35920
  return await this._methods.getOrderBook(symbol, depth, from, to, isBacktest);
35917
35921
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
@@ -43,7 +43,7 @@
43
43
  "build:docs": "rimraf docs && mkdir docs && node ./scripts/dts-docs.cjs ./types.d.ts ./docs",
44
44
  "docs:gpt": "npm run build && node ./tools/gpt-docs/index.mjs",
45
45
  "docs:uml": "npm run build && node ./scripts/uml.mjs",
46
- "docs:www": "rimraf docs/wwwroot && typedoc && node ./tools/typedoc-yandex-metrica/index.mjs",
46
+ "docs:www": "rimraf docs/wwwroot && node ./tools/typedoc-packages-docs/index.mjs && typedoc && node ./tools/typedoc-yandex-metrica/index.mjs",
47
47
  "repl": "dotenv -e .env -- npm run build && node -e \"import('./scripts/repl.mjs')\" --interactive"
48
48
  },
49
49
  "main": "build/index.cjs",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "di-kit": "^1.0.18",
78
- "di-scoped": "^1.0.20",
78
+ "di-scoped": "^1.0.21",
79
79
  "functools-kit": "^1.0.95",
80
80
  "get-moment-stamp": "^1.1.1"
81
81
  },