@backtest-kit/cli 6.12.0 → 6.13.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 +21 -3
- package/build/index.mjs +22 -4
- package/package.json +13 -13
- package/template/project/package.mustache +5 -5
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();
|
|
@@ -2502,7 +2514,9 @@ class SetupUtils {
|
|
|
2502
2514
|
BacktestKit.PersistNotificationAdapter.clear();
|
|
2503
2515
|
BacktestKit.PersistLogAdapter.clear();
|
|
2504
2516
|
BacktestKit.PersistMeasureAdapter.clear();
|
|
2517
|
+
BacktestKit.PersistIntervalAdapter.clear();
|
|
2505
2518
|
BacktestKit.PersistMemoryAdapter.clear();
|
|
2519
|
+
BacktestKit.PersistRecentAdapter.clear();
|
|
2506
2520
|
}
|
|
2507
2521
|
{
|
|
2508
2522
|
BacktestKit.Dump.clear();
|
|
@@ -2519,6 +2533,10 @@ class SetupUtils {
|
|
|
2519
2533
|
BacktestKit.NotificationLive.clear();
|
|
2520
2534
|
BacktestKit.NotificationBacktest.clear();
|
|
2521
2535
|
}
|
|
2536
|
+
{
|
|
2537
|
+
BacktestKit.RecentLive.clear();
|
|
2538
|
+
BacktestKit.RecentBacktest.clear();
|
|
2539
|
+
}
|
|
2522
2540
|
};
|
|
2523
2541
|
}
|
|
2524
2542
|
}
|
|
@@ -2572,7 +2590,7 @@ const main$b = async () => {
|
|
|
2572
2590
|
if (MODES.some((mode) => values[mode])) {
|
|
2573
2591
|
return;
|
|
2574
2592
|
}
|
|
2575
|
-
process.stdout.write(`@backtest-kit/cli ${"6.
|
|
2593
|
+
process.stdout.write(`@backtest-kit/cli ${"6.13.0"}\n`);
|
|
2576
2594
|
process.stdout.write("\n");
|
|
2577
2595
|
process.stdout.write(`Run with --help to see available commands.\n`);
|
|
2578
2596
|
process.stdout.write("\n");
|
|
@@ -3140,7 +3158,7 @@ const main$1 = async () => {
|
|
|
3140
3158
|
if (!values.help) {
|
|
3141
3159
|
return;
|
|
3142
3160
|
}
|
|
3143
|
-
process.stdout.write(`@backtest-kit/cli ${"6.
|
|
3161
|
+
process.stdout.write(`@backtest-kit/cli ${"6.13.0"}\n\n`);
|
|
3144
3162
|
process.stdout.write(HELP_TEXT);
|
|
3145
3163
|
process.exit(0);
|
|
3146
3164
|
};
|
|
@@ -3154,7 +3172,7 @@ const main = async () => {
|
|
|
3154
3172
|
if (!values.version) {
|
|
3155
3173
|
return;
|
|
3156
3174
|
}
|
|
3157
|
-
process.stdout.write(`@backtest-kit/cli ${"6.
|
|
3175
|
+
process.stdout.write(`@backtest-kit/cli ${"6.13.0"}\n`);
|
|
3158
3176
|
process.exit(0);
|
|
3159
3177
|
};
|
|
3160
3178
|
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, 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();
|
|
@@ -2473,7 +2485,9 @@ class SetupUtils {
|
|
|
2473
2485
|
PersistNotificationAdapter.clear();
|
|
2474
2486
|
PersistLogAdapter.clear();
|
|
2475
2487
|
PersistMeasureAdapter.clear();
|
|
2488
|
+
PersistIntervalAdapter.clear();
|
|
2476
2489
|
PersistMemoryAdapter.clear();
|
|
2490
|
+
PersistRecentAdapter.clear();
|
|
2477
2491
|
}
|
|
2478
2492
|
{
|
|
2479
2493
|
Dump.clear();
|
|
@@ -2490,6 +2504,10 @@ class SetupUtils {
|
|
|
2490
2504
|
NotificationLive.clear();
|
|
2491
2505
|
NotificationBacktest.clear();
|
|
2492
2506
|
}
|
|
2507
|
+
{
|
|
2508
|
+
RecentLive.clear();
|
|
2509
|
+
RecentBacktest.clear();
|
|
2510
|
+
}
|
|
2493
2511
|
};
|
|
2494
2512
|
}
|
|
2495
2513
|
}
|
|
@@ -2543,7 +2561,7 @@ const main$b = async () => {
|
|
|
2543
2561
|
if (MODES.some((mode) => values[mode])) {
|
|
2544
2562
|
return;
|
|
2545
2563
|
}
|
|
2546
|
-
process.stdout.write(`@backtest-kit/cli ${"6.
|
|
2564
|
+
process.stdout.write(`@backtest-kit/cli ${"6.13.0"}\n`);
|
|
2547
2565
|
process.stdout.write("\n");
|
|
2548
2566
|
process.stdout.write(`Run with --help to see available commands.\n`);
|
|
2549
2567
|
process.stdout.write("\n");
|
|
@@ -3111,7 +3129,7 @@ const main$1 = async () => {
|
|
|
3111
3129
|
if (!values.help) {
|
|
3112
3130
|
return;
|
|
3113
3131
|
}
|
|
3114
|
-
process.stdout.write(`@backtest-kit/cli ${"6.
|
|
3132
|
+
process.stdout.write(`@backtest-kit/cli ${"6.13.0"}\n\n`);
|
|
3115
3133
|
process.stdout.write(HELP_TEXT);
|
|
3116
3134
|
process.exit(0);
|
|
3117
3135
|
};
|
|
@@ -3125,7 +3143,7 @@ const main = async () => {
|
|
|
3125
3143
|
if (!values.version) {
|
|
3126
3144
|
return;
|
|
3127
3145
|
}
|
|
3128
|
-
process.stdout.write(`@backtest-kit/cli ${"6.
|
|
3146
|
+
process.stdout.write(`@backtest-kit/cli ${"6.13.0"}\n`);
|
|
3129
3147
|
process.exit(0);
|
|
3130
3148
|
};
|
|
3131
3149
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtest-kit/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.13.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.
|
|
65
|
-
"@backtest-kit/graph": "6.
|
|
66
|
-
"@backtest-kit/ollama": "6.
|
|
67
|
-
"@backtest-kit/pinets": "6.
|
|
68
|
-
"@backtest-kit/signals": "6.
|
|
64
|
+
"@backtest-kit/ui": "6.13.0",
|
|
65
|
+
"@backtest-kit/graph": "6.13.0",
|
|
66
|
+
"@backtest-kit/ollama": "6.13.0",
|
|
67
|
+
"@backtest-kit/pinets": "6.13.0",
|
|
68
|
+
"@backtest-kit/signals": "6.13.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.
|
|
76
|
+
"backtest-kit": "6.13.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.
|
|
92
|
-
"@backtest-kit/graph": "^6.
|
|
93
|
-
"@backtest-kit/ollama": "^6.
|
|
94
|
-
"@backtest-kit/pinets": "^6.
|
|
95
|
-
"@backtest-kit/signals": "^6.
|
|
96
|
-
"backtest-kit": "^6.
|
|
91
|
+
"@backtest-kit/ui": "^6.13.0",
|
|
92
|
+
"@backtest-kit/graph": "^6.13.0",
|
|
93
|
+
"@backtest-kit/ollama": "^6.13.0",
|
|
94
|
+
"@backtest-kit/pinets": "^6.13.0",
|
|
95
|
+
"@backtest-kit/signals": "^6.13.0",
|
|
96
|
+
"backtest-kit": "^6.13.0",
|
|
97
97
|
"markdown-it": "^14.1.1",
|
|
98
98
|
"typescript": "^5.0.0"
|
|
99
99
|
},
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"type": "commonjs",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@backtest-kit/cli": "^6.
|
|
16
|
-
"@backtest-kit/graph": "^6.
|
|
17
|
-
"@backtest-kit/pinets": "^6.
|
|
18
|
-
"@backtest-kit/ui": "^6.
|
|
15
|
+
"@backtest-kit/cli": "^6.13.0",
|
|
16
|
+
"@backtest-kit/graph": "^6.13.0",
|
|
17
|
+
"@backtest-kit/pinets": "^6.13.0",
|
|
18
|
+
"@backtest-kit/ui": "^6.13.0",
|
|
19
19
|
"agent-swarm-kit": "^2.2.0",
|
|
20
|
-
"backtest-kit": "^6.
|
|
20
|
+
"backtest-kit": "^6.13.0",
|
|
21
21
|
"functools-kit": "^2.0.2",
|
|
22
22
|
"garch": "^1.2.3",
|
|
23
23
|
"get-moment-stamp": "^1.1.2",
|