@backtest-kit/cli 12.5.0 → 12.7.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
@@ -97,10 +97,16 @@ const getEntrySubject = functoolsKit.singleshot(() => {
97
97
  }
98
98
  return new functoolsKit.BehaviorSubject();
99
99
  });
100
+ const getReadySubject = functoolsKit.singleshot(() => {
101
+ return new functoolsKit.Subject();
102
+ });
100
103
 
101
104
  const main$i = () => {
102
105
  const entrySubject = getEntrySubject();
103
- entrySubject.subscribe((path) => console.log("Running", path));
106
+ entrySubject.subscribe(async (path) => {
107
+ console.log("Running", path);
108
+ await getReadySubject().next();
109
+ });
104
110
  };
105
111
  main$i();
106
112
 
@@ -1615,6 +1621,8 @@ const getEnv = functoolsKit.singleshot(() => {
1615
1621
  };
1616
1622
  });
1617
1623
 
1624
+ const READY_SUBJECT = new functoolsKit.BehaviorSubject();
1625
+ const MAX_WAIT_TIME = 5000;
1618
1626
  const GET_SYMBOL_EXPORTS_FN = async (self) => {
1619
1627
  const exports = await self.configConnectionService.loadConfig("symbol.config");
1620
1628
  if (!exports) {
@@ -1659,6 +1667,17 @@ const MAP_SYMBOL_CONFIG_FN = (config) => {
1659
1667
  symbolList.sort(({ priority: a_p, index: a_x }, { priority: b_p, index: b_x }) => b_p - a_p || a_x - b_x);
1660
1668
  return symbolList;
1661
1669
  };
1670
+ const CREATE_LISTEN_FN = (self) => async () => {
1671
+ const promise = READY_SUBJECT.toPromise();
1672
+ self.enable();
1673
+ if (READY_SUBJECT.data) {
1674
+ return;
1675
+ }
1676
+ await Promise.race([
1677
+ promise,
1678
+ functoolsKit.sleep(MAX_WAIT_TIME),
1679
+ ]);
1680
+ };
1662
1681
  class FrontendProviderService {
1663
1682
  constructor() {
1664
1683
  this.loggerService = inject(TYPES.loggerService);
@@ -1676,7 +1695,7 @@ class FrontendProviderService {
1676
1695
  BacktestKitUi.lib.symbolConnectionService.getSymbolList.setValue(Promise.resolve(symbolList));
1677
1696
  }
1678
1697
  }
1679
- unServer = BacktestKitUi.serve(CC_WWWROOT_HOST, CC_WWWROOT_PORT, this.resolveService.PROJECT_ROOT_DIR);
1698
+ unServer = BacktestKitUi.serve(CC_WWWROOT_HOST, CC_WWWROOT_PORT, this.resolveService.PROJECT_ROOT_DIR, () => READY_SUBJECT.next(true));
1680
1699
  };
1681
1700
  init();
1682
1701
  return () => {
@@ -1696,7 +1715,7 @@ class FrontendProviderService {
1696
1715
  if (!getArgs().values.ui) {
1697
1716
  return;
1698
1717
  }
1699
- return getEntrySubject().subscribe(this.enable);
1718
+ return getReadySubject().subscribe(CREATE_LISTEN_FN(this));
1700
1719
  });
1701
1720
  }
1702
1721
  }
@@ -1732,7 +1751,7 @@ class TelegramProviderService {
1732
1751
  if (!getArgs().values.telegram) {
1733
1752
  return;
1734
1753
  }
1735
- return getEntrySubject().subscribe(this.enable);
1754
+ return getReadySubject().subscribe(this.enable);
1736
1755
  });
1737
1756
  }
1738
1757
  }
@@ -3377,7 +3396,7 @@ const main$h = async () => {
3377
3396
  if (MODES.some((mode) => values[mode])) {
3378
3397
  return;
3379
3398
  }
3380
- process.stdout.write(`@backtest-kit/cli ${"12.5.0"}\n`);
3399
+ process.stdout.write(`@backtest-kit/cli ${"12.7.0"}\n`);
3381
3400
  process.stdout.write("\n");
3382
3401
  process.stdout.write(`Run with --help to see available commands.\n`);
3383
3402
  process.stdout.write("\n");
@@ -4683,7 +4702,7 @@ const main$1 = async () => {
4683
4702
  if (!values.help) {
4684
4703
  return;
4685
4704
  }
4686
- process.stdout.write(`@backtest-kit/cli ${"12.5.0"}\n\n`);
4705
+ process.stdout.write(`@backtest-kit/cli ${"12.7.0"}\n\n`);
4687
4706
  process.stdout.write(HELP_TEXT);
4688
4707
  process.exit(0);
4689
4708
  };
@@ -4697,7 +4716,7 @@ const main = async () => {
4697
4716
  if (!values.version) {
4698
4717
  return;
4699
4718
  }
4700
- process.stdout.write(`@backtest-kit/cli ${"12.5.0"}\n`);
4719
+ process.stdout.write(`@backtest-kit/cli ${"12.7.0"}\n`);
4701
4720
  process.exit(0);
4702
4721
  };
4703
4722
  main();
package/build/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import * as BacktestKit from 'backtest-kit';
3
3
  import { setConfig, emitters, Notification, Cron, Recent, Storage, Markdown, Report, Dump, State, Memory, MarkdownWriter, ReportWriter, PersistSignalAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistPartialAdapter, PersistBreakevenAdapter, PersistCandleAdapter, PersistStorageAdapter, PersistNotificationAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistIntervalAdapter, PersistMemoryAdapter, PersistRecentAdapter, PersistStateAdapter, PersistSessionAdapter, Log, StorageLive, StorageBacktest, NotificationLive, NotificationBacktest, RecentLive, RecentBacktest, Broker, SessionLive, SessionBacktest, MemoryLive, MemoryBacktest, StateLive, StateBacktest, listExchangeSchema, addExchangeSchema, roundTicks, listFrameSchema, addFrameSchema, listenDoneLive, listenDoneBacktest, shutdown, listenSignal, listStrategySchema, overrideExchangeSchema, Backtest, System, Cache, Interval, alignToInterval, addWalkerSchema, overrideWalkerSchema, Walker, listenDoneWalker, Live, getCandles, checkCandles, warmCandles, listenRisk, listenStrategyCommit, listenSync, listenSignalNotify, Exchange } from 'backtest-kit';
4
- import { singleshot, BehaviorSubject, getErrorMessage, errorData, str, compose, sleep, createAwaiter, execpool, queued, randomString, TIMEOUT_SYMBOL, typo, retry, trycatch, memoize, isObject } from 'functools-kit';
4
+ import { singleshot, BehaviorSubject, Subject, getErrorMessage, errorData, str, compose, sleep, createAwaiter, execpool, queued, randomString, TIMEOUT_SYMBOL, typo, retry, trycatch, memoize, isObject } from 'functools-kit';
5
5
  import fs, { constants, realpathSync } from 'fs';
6
6
  import * as stackTrace from 'stack-trace';
7
7
  import path, { join, resolve, dirname, basename, extname } from 'path';
@@ -72,10 +72,16 @@ const getEntrySubject = singleshot(() => {
72
72
  }
73
73
  return new BehaviorSubject();
74
74
  });
75
+ const getReadySubject = singleshot(() => {
76
+ return new Subject();
77
+ });
75
78
 
76
79
  const main$i = () => {
77
80
  const entrySubject = getEntrySubject();
78
- entrySubject.subscribe((path) => console.log("Running", path));
81
+ entrySubject.subscribe(async (path) => {
82
+ console.log("Running", path);
83
+ await getReadySubject().next();
84
+ });
79
85
  };
80
86
  main$i();
81
87
 
@@ -1590,6 +1596,8 @@ const getEnv = singleshot(() => {
1590
1596
  };
1591
1597
  });
1592
1598
 
1599
+ const READY_SUBJECT = new BehaviorSubject();
1600
+ const MAX_WAIT_TIME = 5000;
1593
1601
  const GET_SYMBOL_EXPORTS_FN = async (self) => {
1594
1602
  const exports = await self.configConnectionService.loadConfig("symbol.config");
1595
1603
  if (!exports) {
@@ -1634,6 +1642,17 @@ const MAP_SYMBOL_CONFIG_FN = (config) => {
1634
1642
  symbolList.sort(({ priority: a_p, index: a_x }, { priority: b_p, index: b_x }) => b_p - a_p || a_x - b_x);
1635
1643
  return symbolList;
1636
1644
  };
1645
+ const CREATE_LISTEN_FN = (self) => async () => {
1646
+ const promise = READY_SUBJECT.toPromise();
1647
+ self.enable();
1648
+ if (READY_SUBJECT.data) {
1649
+ return;
1650
+ }
1651
+ await Promise.race([
1652
+ promise,
1653
+ sleep(MAX_WAIT_TIME),
1654
+ ]);
1655
+ };
1637
1656
  class FrontendProviderService {
1638
1657
  constructor() {
1639
1658
  this.loggerService = inject(TYPES.loggerService);
@@ -1651,7 +1670,7 @@ class FrontendProviderService {
1651
1670
  lib.symbolConnectionService.getSymbolList.setValue(Promise.resolve(symbolList));
1652
1671
  }
1653
1672
  }
1654
- unServer = serve(CC_WWWROOT_HOST, CC_WWWROOT_PORT, this.resolveService.PROJECT_ROOT_DIR);
1673
+ unServer = serve(CC_WWWROOT_HOST, CC_WWWROOT_PORT, this.resolveService.PROJECT_ROOT_DIR, () => READY_SUBJECT.next(true));
1655
1674
  };
1656
1675
  init();
1657
1676
  return () => {
@@ -1671,7 +1690,7 @@ class FrontendProviderService {
1671
1690
  if (!getArgs().values.ui) {
1672
1691
  return;
1673
1692
  }
1674
- return getEntrySubject().subscribe(this.enable);
1693
+ return getReadySubject().subscribe(CREATE_LISTEN_FN(this));
1675
1694
  });
1676
1695
  }
1677
1696
  }
@@ -1707,7 +1726,7 @@ class TelegramProviderService {
1707
1726
  if (!getArgs().values.telegram) {
1708
1727
  return;
1709
1728
  }
1710
- return getEntrySubject().subscribe(this.enable);
1729
+ return getReadySubject().subscribe(this.enable);
1711
1730
  });
1712
1731
  }
1713
1732
  }
@@ -3348,7 +3367,7 @@ const main$h = async () => {
3348
3367
  if (MODES.some((mode) => values[mode])) {
3349
3368
  return;
3350
3369
  }
3351
- process.stdout.write(`@backtest-kit/cli ${"12.5.0"}\n`);
3370
+ process.stdout.write(`@backtest-kit/cli ${"12.7.0"}\n`);
3352
3371
  process.stdout.write("\n");
3353
3372
  process.stdout.write(`Run with --help to see available commands.\n`);
3354
3373
  process.stdout.write("\n");
@@ -4654,7 +4673,7 @@ const main$1 = async () => {
4654
4673
  if (!values.help) {
4655
4674
  return;
4656
4675
  }
4657
- process.stdout.write(`@backtest-kit/cli ${"12.5.0"}\n\n`);
4676
+ process.stdout.write(`@backtest-kit/cli ${"12.7.0"}\n\n`);
4658
4677
  process.stdout.write(HELP_TEXT);
4659
4678
  process.exit(0);
4660
4679
  };
@@ -4668,7 +4687,7 @@ const main = async () => {
4668
4687
  if (!values.version) {
4669
4688
  return;
4670
4689
  }
4671
- process.stdout.write(`@backtest-kit/cli ${"12.5.0"}\n`);
4690
+ process.stdout.write(`@backtest-kit/cli ${"12.7.0"}\n`);
4672
4691
  process.exit(0);
4673
4692
  };
4674
4693
  main();
@@ -15,17 +15,17 @@
15
15
  "@types/node": "25.6.0"
16
16
  },
17
17
  "dependencies": {
18
- "@backtest-kit/cli": "12.5.0",
19
- "@backtest-kit/graph": "12.5.0",
20
- "@backtest-kit/pinets": "12.5.0",
21
- "@backtest-kit/signals": "12.5.0",
22
- "@backtest-kit/ui": "12.5.0",
18
+ "@backtest-kit/cli": "12.7.0",
19
+ "@backtest-kit/graph": "12.7.0",
20
+ "@backtest-kit/pinets": "12.7.0",
21
+ "@backtest-kit/signals": "12.7.0",
22
+ "@backtest-kit/ui": "12.7.0",
23
23
  "@tavily/core": "0.7.2",
24
24
  "@tensorflow/tfjs": "4.22.0",
25
25
  "@tensorflow/tfjs-backend-wasm": "4.22.0",
26
26
  "@tensorflow/tfjs-core": "4.22.0",
27
27
  "agent-swarm-kit": "2.7.0",
28
- "backtest-kit": "12.5.0",
28
+ "backtest-kit": "12.7.0",
29
29
  "dayjs": "1.11.20",
30
30
  "functools-kit": "2.3.0",
31
31
  "garch": "1.2.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backtest-kit/cli",
3
- "version": "12.5.0",
3
+ "version": "12.7.0",
4
4
  "description": "Zero-boilerplate CLI runner for backtest-kit strategies. Run backtests, paper trading, and live bots with candle cache warming, web dashboard, and Telegram notifications — no setup code required.",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
@@ -63,11 +63,11 @@
63
63
  "devDependencies": {
64
64
  "@babel/plugin-transform-modules-umd": "7.27.1",
65
65
  "@babel/standalone": "7.29.1",
66
- "@backtest-kit/graph": "12.5.0",
67
- "@backtest-kit/ollama": "12.5.0",
68
- "@backtest-kit/pinets": "12.5.0",
69
- "@backtest-kit/signals": "12.5.0",
70
- "@backtest-kit/ui": "12.5.0",
66
+ "@backtest-kit/graph": "12.7.0",
67
+ "@backtest-kit/ollama": "12.7.0",
68
+ "@backtest-kit/pinets": "12.7.0",
69
+ "@backtest-kit/signals": "12.7.0",
70
+ "@backtest-kit/ui": "12.7.0",
71
71
  "@rollup/plugin-replace": "6.0.3",
72
72
  "@rollup/plugin-typescript": "11.1.6",
73
73
  "@types/image-size": "0.7.0",
@@ -75,7 +75,7 @@
75
75
  "@types/mustache": "4.2.6",
76
76
  "@types/node": "22.9.0",
77
77
  "@types/stack-trace": "0.0.33",
78
- "backtest-kit": "12.5.0",
78
+ "backtest-kit": "12.7.0",
79
79
  "glob": "11.0.1",
80
80
  "markdown-it": "14.1.1",
81
81
  "rimraf": "6.0.1",
@@ -90,12 +90,12 @@
90
90
  "peerDependencies": {
91
91
  "@babel/plugin-transform-modules-umd": "^7.27.1",
92
92
  "@babel/standalone": "^7.29.1",
93
- "@backtest-kit/graph": "^12.5.0",
94
- "@backtest-kit/ollama": "^12.5.0",
95
- "@backtest-kit/pinets": "^12.5.0",
96
- "@backtest-kit/signals": "^12.5.0",
97
- "@backtest-kit/ui": "^12.5.0",
98
- "backtest-kit": "^12.5.0",
93
+ "@backtest-kit/graph": "^12.7.0",
94
+ "@backtest-kit/ollama": "^12.7.0",
95
+ "@backtest-kit/pinets": "^12.7.0",
96
+ "@backtest-kit/signals": "^12.7.0",
97
+ "@backtest-kit/ui": "^12.7.0",
98
+ "backtest-kit": "^12.7.0",
99
99
  "markdown-it": "^14.1.1",
100
100
  "typescript": "^5.0.0"
101
101
  },
@@ -13,12 +13,12 @@
13
13
  "license": "ISC",
14
14
  "type": "commonjs",
15
15
  "dependencies": {
16
- "@backtest-kit/cli": "^12.5.0",
17
- "@backtest-kit/graph": "^12.5.0",
18
- "@backtest-kit/pinets": "^12.5.0",
19
- "@backtest-kit/ui": "^12.5.0",
16
+ "@backtest-kit/cli": "^12.7.0",
17
+ "@backtest-kit/graph": "^12.7.0",
18
+ "@backtest-kit/pinets": "^12.7.0",
19
+ "@backtest-kit/ui": "^12.7.0",
20
20
  "agent-swarm-kit": "^2.7.0",
21
- "backtest-kit": "^12.5.0",
21
+ "backtest-kit": "^12.7.0",
22
22
  "functools-kit": "^2.3.0",
23
23
  "garch": "^1.2.3",
24
24
  "get-moment-stamp": "^2.0.0",