@backtest-kit/cli 6.12.0 → 6.14.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
@@ -778,6 +778,7 @@ class WalkerMainService {
778
778
  this.run = functoolsKit.singleshot(async (payload) => {
779
779
  this.loggerService.log("walkerMainService run", { payload });
780
780
  const strategyMap = new Map();
781
+ const sessionMap = new Map();
781
782
  const cwd = process.cwd();
782
783
  for (const entryPoint of payload.entryPoints) {
783
784
  process.chdir(cwd);
@@ -801,6 +802,7 @@ class WalkerMainService {
801
802
  }
802
803
  strategyMap.set(strategyName, entryPoint);
803
804
  }
805
+ sessionMap.set(entryPoint, BacktestKit.Session.createSnapshot());
804
806
  BacktestKit.Cache.resetCounter();
805
807
  BacktestKit.Interval.resetCounter();
806
808
  }
@@ -846,6 +848,10 @@ class WalkerMainService {
846
848
  if (!entryPoint) {
847
849
  return;
848
850
  }
851
+ const restoreSnapshot = sessionMap.get(entryPoint);
852
+ if (!restoreSnapshot) {
853
+ return;
854
+ }
849
855
  process.chdir(cwd);
850
856
  const absolutePath = path.resolve(entryPoint);
851
857
  const moduleRoot = path.dirname(absolutePath);
@@ -854,6 +860,7 @@ class WalkerMainService {
854
860
  Setup.clear();
855
861
  Setup.enable();
856
862
  }
863
+ restoreSnapshot();
857
864
  {
858
865
  cwd !== moduleRoot && BacktestKit.Log.useJsonl();
859
866
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
@@ -2459,6 +2466,7 @@ class SetupUtils {
2459
2466
  this.enable = functoolsKit.singleshot(() => {
2460
2467
  cli.loggerService.debug("SetupUtils enable");
2461
2468
  {
2469
+ BacktestKit.Recent.enable();
2462
2470
  BacktestKit.Storage.enable();
2463
2471
  BacktestKit.Notification.enable();
2464
2472
  }
@@ -2476,6 +2484,10 @@ class SetupUtils {
2476
2484
  BacktestKit.StorageLive.usePersist();
2477
2485
  BacktestKit.StorageBacktest.useMemory();
2478
2486
  }
2487
+ {
2488
+ BacktestKit.RecentLive.usePersist();
2489
+ BacktestKit.RecentBacktest.useMemory();
2490
+ }
2479
2491
  {
2480
2492
  BacktestKit.NotificationLive.usePersist();
2481
2493
  BacktestKit.NotificationBacktest.useMemory();
@@ -2491,6 +2503,23 @@ class SetupUtils {
2491
2503
  return;
2492
2504
  }
2493
2505
  this.enable.clear();
2506
+ {
2507
+ BacktestKit.Recent.disable();
2508
+ BacktestKit.Storage.disable();
2509
+ BacktestKit.Notification.disable();
2510
+ }
2511
+ {
2512
+ BacktestKit.Markdown.disable();
2513
+ BacktestKit.Report.disable();
2514
+ BacktestKit.Dump.disable();
2515
+ BacktestKit.Memory.disable();
2516
+ }
2517
+ {
2518
+ BacktestKit.Markdown.clear();
2519
+ BacktestKit.Report.clear();
2520
+ BacktestKit.MarkdownWriter.clear();
2521
+ BacktestKit.ReportWriter.clear();
2522
+ }
2494
2523
  {
2495
2524
  BacktestKit.PersistSignalAdapter.clear();
2496
2525
  BacktestKit.PersistRiskAdapter.clear();
@@ -2502,14 +2531,14 @@ class SetupUtils {
2502
2531
  BacktestKit.PersistNotificationAdapter.clear();
2503
2532
  BacktestKit.PersistLogAdapter.clear();
2504
2533
  BacktestKit.PersistMeasureAdapter.clear();
2534
+ BacktestKit.PersistIntervalAdapter.clear();
2505
2535
  BacktestKit.PersistMemoryAdapter.clear();
2536
+ BacktestKit.PersistRecentAdapter.clear();
2506
2537
  }
2507
2538
  {
2508
2539
  BacktestKit.Dump.clear();
2509
2540
  BacktestKit.Log.clear();
2510
2541
  BacktestKit.Markdown.clear();
2511
- BacktestKit.Memory.clear();
2512
- BacktestKit.Report.clear();
2513
2542
  }
2514
2543
  {
2515
2544
  BacktestKit.StorageLive.clear();
@@ -2519,6 +2548,10 @@ class SetupUtils {
2519
2548
  BacktestKit.NotificationLive.clear();
2520
2549
  BacktestKit.NotificationBacktest.clear();
2521
2550
  }
2551
+ {
2552
+ BacktestKit.RecentLive.clear();
2553
+ BacktestKit.RecentBacktest.clear();
2554
+ }
2522
2555
  };
2523
2556
  }
2524
2557
  }
@@ -2572,7 +2605,7 @@ const main$b = async () => {
2572
2605
  if (MODES.some((mode) => values[mode])) {
2573
2606
  return;
2574
2607
  }
2575
- process.stdout.write(`@backtest-kit/cli ${"6.12.0"}\n`);
2608
+ process.stdout.write(`@backtest-kit/cli ${"6.14.0"}\n`);
2576
2609
  process.stdout.write("\n");
2577
2610
  process.stdout.write(`Run with --help to see available commands.\n`);
2578
2611
  process.stdout.write("\n");
@@ -3140,7 +3173,7 @@ const main$1 = async () => {
3140
3173
  if (!values.help) {
3141
3174
  return;
3142
3175
  }
3143
- process.stdout.write(`@backtest-kit/cli ${"6.12.0"}\n\n`);
3176
+ process.stdout.write(`@backtest-kit/cli ${"6.14.0"}\n\n`);
3144
3177
  process.stdout.write(HELP_TEXT);
3145
3178
  process.exit(0);
3146
3179
  };
@@ -3154,7 +3187,7 @@ const main = async () => {
3154
3187
  if (!values.version) {
3155
3188
  return;
3156
3189
  }
3157
- process.stdout.write(`@backtest-kit/cli ${"6.12.0"}\n`);
3190
+ process.stdout.write(`@backtest-kit/cli ${"6.14.0"}\n`);
3158
3191
  process.exit(0);
3159
3192
  };
3160
3193
  main();
package/build/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import * as BacktestKit from 'backtest-kit';
3
- import { Log, listExchangeSchema, addExchangeSchema, roundTicks, listFrameSchema, addFrameSchema, listenDoneLive, listenDoneBacktest, shutdown, listenSignal, listStrategySchema, overrideExchangeSchema, Backtest, Cache, Interval, alignToInterval, addWalkerSchema, overrideWalkerSchema, Walker, listenDoneWalker, Live, getCandles, checkCandles, warmCandles, listenRisk, listenStrategyCommit, listenSync, Storage, Notification, Markdown, Report, Dump, Memory, StorageLive, StorageBacktest, NotificationLive, NotificationBacktest, PersistSignalAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistPartialAdapter, PersistBreakevenAdapter, PersistCandleAdapter, PersistStorageAdapter, PersistNotificationAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, setConfig, Exchange } from 'backtest-kit';
3
+ import { Log, listExchangeSchema, addExchangeSchema, roundTicks, listFrameSchema, addFrameSchema, listenDoneLive, listenDoneBacktest, shutdown, listenSignal, listStrategySchema, overrideExchangeSchema, Backtest, Session, Cache, Interval, alignToInterval, addWalkerSchema, overrideWalkerSchema, Walker, listenDoneWalker, Live, getCandles, checkCandles, warmCandles, listenRisk, listenStrategyCommit, listenSync, Recent, Storage, Notification, Markdown, Report, Dump, Memory, StorageLive, StorageBacktest, RecentLive, RecentBacktest, NotificationLive, NotificationBacktest, MarkdownWriter, ReportWriter, PersistSignalAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistPartialAdapter, PersistBreakevenAdapter, PersistCandleAdapter, PersistStorageAdapter, PersistNotificationAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistIntervalAdapter, PersistMemoryAdapter, PersistRecentAdapter, setConfig, Exchange } from 'backtest-kit';
4
4
  import { getErrorMessage, errorData, singleshot, str, BehaviorSubject, compose, createAwaiter, execpool, queued, sleep, randomString, TIMEOUT_SYMBOL, typo, retry, trycatch, memoize } from 'functools-kit';
5
5
  import fs, { constants } from 'fs';
6
6
  import * as stackTrace from 'stack-trace';
@@ -753,6 +753,7 @@ class WalkerMainService {
753
753
  this.run = singleshot(async (payload) => {
754
754
  this.loggerService.log("walkerMainService run", { payload });
755
755
  const strategyMap = new Map();
756
+ const sessionMap = new Map();
756
757
  const cwd = process.cwd();
757
758
  for (const entryPoint of payload.entryPoints) {
758
759
  process.chdir(cwd);
@@ -776,6 +777,7 @@ class WalkerMainService {
776
777
  }
777
778
  strategyMap.set(strategyName, entryPoint);
778
779
  }
780
+ sessionMap.set(entryPoint, Session.createSnapshot());
779
781
  Cache.resetCounter();
780
782
  Interval.resetCounter();
781
783
  }
@@ -821,6 +823,10 @@ class WalkerMainService {
821
823
  if (!entryPoint) {
822
824
  return;
823
825
  }
826
+ const restoreSnapshot = sessionMap.get(entryPoint);
827
+ if (!restoreSnapshot) {
828
+ return;
829
+ }
824
830
  process.chdir(cwd);
825
831
  const absolutePath = path.resolve(entryPoint);
826
832
  const moduleRoot = path.dirname(absolutePath);
@@ -829,6 +835,7 @@ class WalkerMainService {
829
835
  Setup.clear();
830
836
  Setup.enable();
831
837
  }
838
+ restoreSnapshot();
832
839
  {
833
840
  cwd !== moduleRoot && Log.useJsonl();
834
841
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
@@ -2430,6 +2437,7 @@ class SetupUtils {
2430
2437
  this.enable = singleshot(() => {
2431
2438
  cli.loggerService.debug("SetupUtils enable");
2432
2439
  {
2440
+ Recent.enable();
2433
2441
  Storage.enable();
2434
2442
  Notification.enable();
2435
2443
  }
@@ -2447,6 +2455,10 @@ class SetupUtils {
2447
2455
  StorageLive.usePersist();
2448
2456
  StorageBacktest.useMemory();
2449
2457
  }
2458
+ {
2459
+ RecentLive.usePersist();
2460
+ RecentBacktest.useMemory();
2461
+ }
2450
2462
  {
2451
2463
  NotificationLive.usePersist();
2452
2464
  NotificationBacktest.useMemory();
@@ -2462,6 +2474,23 @@ class SetupUtils {
2462
2474
  return;
2463
2475
  }
2464
2476
  this.enable.clear();
2477
+ {
2478
+ Recent.disable();
2479
+ Storage.disable();
2480
+ Notification.disable();
2481
+ }
2482
+ {
2483
+ Markdown.disable();
2484
+ Report.disable();
2485
+ Dump.disable();
2486
+ Memory.disable();
2487
+ }
2488
+ {
2489
+ Markdown.clear();
2490
+ Report.clear();
2491
+ MarkdownWriter.clear();
2492
+ ReportWriter.clear();
2493
+ }
2465
2494
  {
2466
2495
  PersistSignalAdapter.clear();
2467
2496
  PersistRiskAdapter.clear();
@@ -2473,14 +2502,14 @@ class SetupUtils {
2473
2502
  PersistNotificationAdapter.clear();
2474
2503
  PersistLogAdapter.clear();
2475
2504
  PersistMeasureAdapter.clear();
2505
+ PersistIntervalAdapter.clear();
2476
2506
  PersistMemoryAdapter.clear();
2507
+ PersistRecentAdapter.clear();
2477
2508
  }
2478
2509
  {
2479
2510
  Dump.clear();
2480
2511
  Log.clear();
2481
2512
  Markdown.clear();
2482
- Memory.clear();
2483
- Report.clear();
2484
2513
  }
2485
2514
  {
2486
2515
  StorageLive.clear();
@@ -2490,6 +2519,10 @@ class SetupUtils {
2490
2519
  NotificationLive.clear();
2491
2520
  NotificationBacktest.clear();
2492
2521
  }
2522
+ {
2523
+ RecentLive.clear();
2524
+ RecentBacktest.clear();
2525
+ }
2493
2526
  };
2494
2527
  }
2495
2528
  }
@@ -2543,7 +2576,7 @@ const main$b = async () => {
2543
2576
  if (MODES.some((mode) => values[mode])) {
2544
2577
  return;
2545
2578
  }
2546
- process.stdout.write(`@backtest-kit/cli ${"6.12.0"}\n`);
2579
+ process.stdout.write(`@backtest-kit/cli ${"6.14.0"}\n`);
2547
2580
  process.stdout.write("\n");
2548
2581
  process.stdout.write(`Run with --help to see available commands.\n`);
2549
2582
  process.stdout.write("\n");
@@ -3111,7 +3144,7 @@ const main$1 = async () => {
3111
3144
  if (!values.help) {
3112
3145
  return;
3113
3146
  }
3114
- process.stdout.write(`@backtest-kit/cli ${"6.12.0"}\n\n`);
3147
+ process.stdout.write(`@backtest-kit/cli ${"6.14.0"}\n\n`);
3115
3148
  process.stdout.write(HELP_TEXT);
3116
3149
  process.exit(0);
3117
3150
  };
@@ -3125,7 +3158,7 @@ const main = async () => {
3125
3158
  if (!values.version) {
3126
3159
  return;
3127
3160
  }
3128
- process.stdout.write(`@backtest-kit/cli ${"6.12.0"}\n`);
3161
+ process.stdout.write(`@backtest-kit/cli ${"6.14.0"}\n`);
3129
3162
  process.exit(0);
3130
3163
  };
3131
3164
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backtest-kit/cli",
3
- "version": "6.12.0",
3
+ "version": "6.14.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",
@@ -61,11 +61,11 @@
61
61
  "devDependencies": {
62
62
  "@babel/plugin-transform-modules-umd": "7.27.1",
63
63
  "@babel/standalone": "7.29.1",
64
- "@backtest-kit/ui": "6.12.0",
65
- "@backtest-kit/graph": "6.12.0",
66
- "@backtest-kit/ollama": "6.12.0",
67
- "@backtest-kit/pinets": "6.12.0",
68
- "@backtest-kit/signals": "6.12.0",
64
+ "@backtest-kit/ui": "6.14.0",
65
+ "@backtest-kit/graph": "6.14.0",
66
+ "@backtest-kit/ollama": "6.14.0",
67
+ "@backtest-kit/pinets": "6.14.0",
68
+ "@backtest-kit/signals": "6.14.0",
69
69
  "@rollup/plugin-replace": "6.0.3",
70
70
  "@rollup/plugin-typescript": "11.1.6",
71
71
  "@types/image-size": "0.7.0",
@@ -73,7 +73,7 @@
73
73
  "@types/mustache": "4.2.6",
74
74
  "@types/node": "22.9.0",
75
75
  "@types/stack-trace": "0.0.33",
76
- "backtest-kit": "6.12.0",
76
+ "backtest-kit": "6.14.0",
77
77
  "glob": "11.0.1",
78
78
  "markdown-it": "14.1.1",
79
79
  "rimraf": "6.0.1",
@@ -88,12 +88,12 @@
88
88
  "peerDependencies": {
89
89
  "@babel/plugin-transform-modules-umd": "^7.27.1",
90
90
  "@babel/standalone": "^7.29.1",
91
- "@backtest-kit/ui": "^6.12.0",
92
- "@backtest-kit/graph": "^6.12.0",
93
- "@backtest-kit/ollama": "^6.12.0",
94
- "@backtest-kit/pinets": "^6.12.0",
95
- "@backtest-kit/signals": "^6.12.0",
96
- "backtest-kit": "^6.12.0",
91
+ "@backtest-kit/ui": "^6.14.0",
92
+ "@backtest-kit/graph": "^6.14.0",
93
+ "@backtest-kit/ollama": "^6.14.0",
94
+ "@backtest-kit/pinets": "^6.14.0",
95
+ "@backtest-kit/signals": "^6.14.0",
96
+ "backtest-kit": "^6.14.0",
97
97
  "markdown-it": "^14.1.1",
98
98
  "typescript": "^5.0.0"
99
99
  },
@@ -102,7 +102,7 @@
102
102
  "di-kit": "1.1.1",
103
103
  "di-scoped": "1.0.21",
104
104
  "dotenv": "17.3.1",
105
- "functools-kit": "2.0.2",
105
+ "functools-kit": "2.2.0",
106
106
  "get-moment-stamp": "1.1.2",
107
107
  "image-size": "1.1.1",
108
108
  "jsdom": "26.1.0",
@@ -12,13 +12,13 @@
12
12
  "license": "ISC",
13
13
  "type": "commonjs",
14
14
  "dependencies": {
15
- "@backtest-kit/cli": "^6.12.0",
16
- "@backtest-kit/graph": "^6.12.0",
17
- "@backtest-kit/pinets": "^6.12.0",
18
- "@backtest-kit/ui": "^6.12.0",
19
- "agent-swarm-kit": "^2.2.0",
20
- "backtest-kit": "^6.12.0",
21
- "functools-kit": "^2.0.2",
15
+ "@backtest-kit/cli": "^6.14.0",
16
+ "@backtest-kit/graph": "^6.14.0",
17
+ "@backtest-kit/pinets": "^6.14.0",
18
+ "@backtest-kit/ui": "^6.14.0",
19
+ "agent-swarm-kit": "^2.5.0",
20
+ "backtest-kit": "^6.14.0",
21
+ "functools-kit": "^2.2.0",
22
22
  "garch": "^1.2.3",
23
23
  "get-moment-stamp": "^1.1.2",
24
24
  "ollama": "^0.6.3",