@backtest-kit/cli 10.2.0 → 11.2.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
@@ -90,6 +90,20 @@ BacktestKit.setConfig({
90
90
  CC_WALKER_MARKDOWN_TOP_N: 10,
91
91
  });
92
92
 
93
+ const getEntrySubject = functoolsKit.singleshot(() => {
94
+ const entrySubject = BacktestKit.emitters["entrySubject"];
95
+ if (entrySubject) {
96
+ return entrySubject;
97
+ }
98
+ return new functoolsKit.BehaviorSubject();
99
+ });
100
+
101
+ const main$h = () => {
102
+ const entrySubject = getEntrySubject();
103
+ entrySubject.subscribe((path) => console.log("Running", path));
104
+ };
105
+ main$h();
106
+
93
107
  const ERROR_HANDLER_INSTALLED = Symbol.for("error-handler-installed");
94
108
  function dumpStackTrace() {
95
109
  const trace = stackTrace__namespace.get();
@@ -860,8 +874,6 @@ const notifyVerbose = functoolsKit.singleshot(() => {
860
874
  });
861
875
  });
862
876
 
863
- const entrySubject = new functoolsKit.BehaviorSubject();
864
-
865
877
  function killPid(pid, signal) {
866
878
  try {
867
879
  process.kill(pid, signal);
@@ -1085,7 +1097,7 @@ class BacktestMainService {
1085
1097
  });
1086
1098
  notifyVerbose();
1087
1099
  }
1088
- await entrySubject.next(absolutePath);
1100
+ await getEntrySubject().next(absolutePath);
1089
1101
  BacktestKit.Backtest.background(symbol, {
1090
1102
  strategyName,
1091
1103
  frameName,
@@ -1451,7 +1463,7 @@ class LiveMainService {
1451
1463
  });
1452
1464
  notifyVerbose();
1453
1465
  }
1454
- await entrySubject.next(absolutePath);
1466
+ await getEntrySubject().next(absolutePath);
1455
1467
  BacktestKit.Live.background(symbol, {
1456
1468
  strategyName,
1457
1469
  exchangeName,
@@ -1555,7 +1567,7 @@ class PaperMainService {
1555
1567
  });
1556
1568
  notifyVerbose();
1557
1569
  }
1558
- await entrySubject.next(absolutePath);
1570
+ await getEntrySubject().next(absolutePath);
1559
1571
  BacktestKit.Live.background(symbol, {
1560
1572
  strategyName,
1561
1573
  exchangeName,
@@ -1587,7 +1599,7 @@ class PaperMainService {
1587
1599
  }
1588
1600
 
1589
1601
  const getEnv = functoolsKit.singleshot(() => {
1590
- if (!entrySubject.data) {
1602
+ if (!getEntrySubject().data) {
1591
1603
  getEnv.clear();
1592
1604
  }
1593
1605
  return {
@@ -1680,7 +1692,7 @@ class FrontendProviderService {
1680
1692
  if (!getArgs().values.ui) {
1681
1693
  return;
1682
1694
  }
1683
- return entrySubject.subscribe(this.enable);
1695
+ return getEntrySubject().subscribe(this.enable);
1684
1696
  });
1685
1697
  }
1686
1698
  }
@@ -1716,7 +1728,7 @@ class TelegramProviderService {
1716
1728
  if (!getArgs().values.telegram) {
1717
1729
  return;
1718
1730
  }
1719
- return entrySubject.subscribe(this.enable);
1731
+ return getEntrySubject().subscribe(this.enable);
1720
1732
  });
1721
1733
  }
1722
1734
  }
@@ -3361,7 +3373,7 @@ const main$g = async () => {
3361
3373
  if (MODES.some((mode) => values[mode])) {
3362
3374
  return;
3363
3375
  }
3364
- process.stdout.write(`@backtest-kit/cli ${"10.2.0"}\n`);
3376
+ process.stdout.write(`@backtest-kit/cli ${"11.2.0"}\n`);
3365
3377
  process.stdout.write("\n");
3366
3378
  process.stdout.write(`Run with --help to see available commands.\n`);
3367
3379
  process.stdout.write("\n");
@@ -3701,7 +3713,7 @@ const main$a = async () => {
3701
3713
  absolutePath = path.resolve(cwd, entryPoint);
3702
3714
  await cli.resolveService.attachEntry(absolutePath);
3703
3715
  }
3704
- await entrySubject.next(absolutePath);
3716
+ await getEntrySubject().next(absolutePath);
3705
3717
  };
3706
3718
  main$a();
3707
3719
 
@@ -4498,7 +4510,7 @@ const main$1 = async () => {
4498
4510
  if (!values.help) {
4499
4511
  return;
4500
4512
  }
4501
- process.stdout.write(`@backtest-kit/cli ${"10.2.0"}\n\n`);
4513
+ process.stdout.write(`@backtest-kit/cli ${"11.2.0"}\n\n`);
4502
4514
  process.stdout.write(HELP_TEXT);
4503
4515
  process.exit(0);
4504
4516
  };
@@ -4512,7 +4524,7 @@ const main = async () => {
4512
4524
  if (!values.version) {
4513
4525
  return;
4514
4526
  }
4515
- process.stdout.write(`@backtest-kit/cli ${"10.2.0"}\n`);
4527
+ process.stdout.write(`@backtest-kit/cli ${"11.2.0"}\n`);
4516
4528
  process.exit(0);
4517
4529
  };
4518
4530
  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
- import { setConfig, 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 { getErrorMessage, errorData, singleshot, str, compose, BehaviorSubject, sleep, createAwaiter, execpool, queued, randomString, TIMEOUT_SYMBOL, typo, retry, trycatch, memoize, isObject } from 'functools-kit';
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';
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';
@@ -65,6 +65,20 @@ setConfig({
65
65
  CC_WALKER_MARKDOWN_TOP_N: 10,
66
66
  });
67
67
 
68
+ const getEntrySubject = singleshot(() => {
69
+ const entrySubject = emitters["entrySubject"];
70
+ if (entrySubject) {
71
+ return entrySubject;
72
+ }
73
+ return new BehaviorSubject();
74
+ });
75
+
76
+ const main$h = () => {
77
+ const entrySubject = getEntrySubject();
78
+ entrySubject.subscribe((path) => console.log("Running", path));
79
+ };
80
+ main$h();
81
+
68
82
  const ERROR_HANDLER_INSTALLED = Symbol.for("error-handler-installed");
69
83
  function dumpStackTrace() {
70
84
  const trace = stackTrace.get();
@@ -835,8 +849,6 @@ const notifyVerbose = singleshot(() => {
835
849
  });
836
850
  });
837
851
 
838
- const entrySubject = new BehaviorSubject();
839
-
840
852
  function killPid(pid, signal) {
841
853
  try {
842
854
  process.kill(pid, signal);
@@ -1060,7 +1072,7 @@ class BacktestMainService {
1060
1072
  });
1061
1073
  notifyVerbose();
1062
1074
  }
1063
- await entrySubject.next(absolutePath);
1075
+ await getEntrySubject().next(absolutePath);
1064
1076
  Backtest.background(symbol, {
1065
1077
  strategyName,
1066
1078
  frameName,
@@ -1426,7 +1438,7 @@ class LiveMainService {
1426
1438
  });
1427
1439
  notifyVerbose();
1428
1440
  }
1429
- await entrySubject.next(absolutePath);
1441
+ await getEntrySubject().next(absolutePath);
1430
1442
  Live.background(symbol, {
1431
1443
  strategyName,
1432
1444
  exchangeName,
@@ -1530,7 +1542,7 @@ class PaperMainService {
1530
1542
  });
1531
1543
  notifyVerbose();
1532
1544
  }
1533
- await entrySubject.next(absolutePath);
1545
+ await getEntrySubject().next(absolutePath);
1534
1546
  Live.background(symbol, {
1535
1547
  strategyName,
1536
1548
  exchangeName,
@@ -1562,7 +1574,7 @@ class PaperMainService {
1562
1574
  }
1563
1575
 
1564
1576
  const getEnv = singleshot(() => {
1565
- if (!entrySubject.data) {
1577
+ if (!getEntrySubject().data) {
1566
1578
  getEnv.clear();
1567
1579
  }
1568
1580
  return {
@@ -1655,7 +1667,7 @@ class FrontendProviderService {
1655
1667
  if (!getArgs().values.ui) {
1656
1668
  return;
1657
1669
  }
1658
- return entrySubject.subscribe(this.enable);
1670
+ return getEntrySubject().subscribe(this.enable);
1659
1671
  });
1660
1672
  }
1661
1673
  }
@@ -1691,7 +1703,7 @@ class TelegramProviderService {
1691
1703
  if (!getArgs().values.telegram) {
1692
1704
  return;
1693
1705
  }
1694
- return entrySubject.subscribe(this.enable);
1706
+ return getEntrySubject().subscribe(this.enable);
1695
1707
  });
1696
1708
  }
1697
1709
  }
@@ -3332,7 +3344,7 @@ const main$g = async () => {
3332
3344
  if (MODES.some((mode) => values[mode])) {
3333
3345
  return;
3334
3346
  }
3335
- process.stdout.write(`@backtest-kit/cli ${"10.2.0"}\n`);
3347
+ process.stdout.write(`@backtest-kit/cli ${"11.2.0"}\n`);
3336
3348
  process.stdout.write("\n");
3337
3349
  process.stdout.write(`Run with --help to see available commands.\n`);
3338
3350
  process.stdout.write("\n");
@@ -3672,7 +3684,7 @@ const main$a = async () => {
3672
3684
  absolutePath = path.resolve(cwd, entryPoint);
3673
3685
  await cli.resolveService.attachEntry(absolutePath);
3674
3686
  }
3675
- await entrySubject.next(absolutePath);
3687
+ await getEntrySubject().next(absolutePath);
3676
3688
  };
3677
3689
  main$a();
3678
3690
 
@@ -4469,7 +4481,7 @@ const main$1 = async () => {
4469
4481
  if (!values.help) {
4470
4482
  return;
4471
4483
  }
4472
- process.stdout.write(`@backtest-kit/cli ${"10.2.0"}\n\n`);
4484
+ process.stdout.write(`@backtest-kit/cli ${"11.2.0"}\n\n`);
4473
4485
  process.stdout.write(HELP_TEXT);
4474
4486
  process.exit(0);
4475
4487
  };
@@ -4483,7 +4495,7 @@ const main = async () => {
4483
4495
  if (!values.version) {
4484
4496
  return;
4485
4497
  }
4486
- process.stdout.write(`@backtest-kit/cli ${"10.2.0"}\n`);
4498
+ process.stdout.write(`@backtest-kit/cli ${"11.2.0"}\n`);
4487
4499
  process.exit(0);
4488
4500
  };
4489
4501
  main();
@@ -15,17 +15,17 @@
15
15
  "@types/node": "25.6.0"
16
16
  },
17
17
  "dependencies": {
18
- "@backtest-kit/cli": "10.2.0",
19
- "@backtest-kit/graph": "10.2.0",
20
- "@backtest-kit/pinets": "10.2.0",
21
- "@backtest-kit/signals": "10.2.0",
22
- "@backtest-kit/ui": "10.2.0",
18
+ "@backtest-kit/cli": "11.2.0",
19
+ "@backtest-kit/graph": "11.2.0",
20
+ "@backtest-kit/pinets": "11.2.0",
21
+ "@backtest-kit/signals": "11.2.0",
22
+ "@backtest-kit/ui": "11.2.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": "10.2.0",
28
+ "backtest-kit": "11.2.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": "10.2.0",
3
+ "version": "11.2.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": "10.2.0",
67
- "@backtest-kit/ollama": "10.2.0",
68
- "@backtest-kit/pinets": "10.2.0",
69
- "@backtest-kit/signals": "10.2.0",
70
- "@backtest-kit/ui": "10.2.0",
66
+ "@backtest-kit/graph": "11.2.0",
67
+ "@backtest-kit/ollama": "11.2.0",
68
+ "@backtest-kit/pinets": "11.2.0",
69
+ "@backtest-kit/signals": "11.2.0",
70
+ "@backtest-kit/ui": "11.2.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": "10.2.0",
78
+ "backtest-kit": "11.2.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": "^10.2.0",
94
- "@backtest-kit/ollama": "^10.2.0",
95
- "@backtest-kit/pinets": "^10.2.0",
96
- "@backtest-kit/signals": "^10.2.0",
97
- "@backtest-kit/ui": "^10.2.0",
98
- "backtest-kit": "^10.2.0",
93
+ "@backtest-kit/graph": "^11.2.0",
94
+ "@backtest-kit/ollama": "^11.2.0",
95
+ "@backtest-kit/pinets": "^11.2.0",
96
+ "@backtest-kit/signals": "^11.2.0",
97
+ "@backtest-kit/ui": "^11.2.0",
98
+ "backtest-kit": "^11.2.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": "^10.2.0",
17
- "@backtest-kit/graph": "^10.2.0",
18
- "@backtest-kit/pinets": "^10.2.0",
19
- "@backtest-kit/ui": "^10.2.0",
16
+ "@backtest-kit/cli": "^11.2.0",
17
+ "@backtest-kit/graph": "^11.2.0",
18
+ "@backtest-kit/pinets": "^11.2.0",
19
+ "@backtest-kit/ui": "^11.2.0",
20
20
  "agent-swarm-kit": "^2.7.0",
21
- "backtest-kit": "^10.2.0",
21
+ "backtest-kit": "^11.2.0",
22
22
  "functools-kit": "^2.3.0",
23
23
  "garch": "^1.2.3",
24
24
  "get-moment-stamp": "^2.0.0",