@backtest-kit/cli 9.2.0 → 9.4.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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import * as BacktestKit from 'backtest-kit';
3
- import { setConfig, Log, listExchangeSchema, addExchangeSchema, roundTicks, listFrameSchema, addFrameSchema, listenDoneLive, listenDoneBacktest, shutdown, listenSignal, Notification, Recent, Storage, Markdown, Report, Dump, State, Memory, SessionLive, SessionBacktest, StorageLive, StorageBacktest, RecentLive, RecentBacktest, NotificationLive, NotificationBacktest, MemoryLive, MemoryBacktest, StateLive, StateBacktest, MarkdownWriter, ReportWriter, PersistSignalAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistPartialAdapter, PersistBreakevenAdapter, PersistCandleAdapter, PersistStorageAdapter, PersistNotificationAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistIntervalAdapter, PersistMemoryAdapter, PersistRecentAdapter, PersistStateAdapter, PersistSessionAdapter, listStrategySchema, overrideExchangeSchema, Backtest, System, Cache, Interval, alignToInterval, addWalkerSchema, overrideWalkerSchema, Walker, listenDoneWalker, Live, getCandles, checkCandles, warmCandles, listenRisk, listenStrategyCommit, listenSync, listenSignalNotify, Exchange } from 'backtest-kit';
3
+ import { setConfig, Notification, 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, 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
4
  import { getErrorMessage, errorData, singleshot, str, BehaviorSubject, compose, createAwaiter, execpool, queued, sleep, 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';
@@ -24,7 +24,7 @@ import { JSDOM } from 'jsdom';
24
24
  import Mustache from 'mustache';
25
25
  import { registerPlugin, transform } from '@babel/standalone';
26
26
  import pluginUMD from '@babel/plugin-transform-modules-umd';
27
- import { createRequire } from 'module';
27
+ import Module, { createRequire } from 'module';
28
28
  import * as BacktestKitGraph from '@backtest-kit/graph';
29
29
  import * as BacktestKitOllama from '@backtest-kit/ollama';
30
30
  import * as BacktestKitPinets from '@backtest-kit/pinets';
@@ -241,6 +241,136 @@ const TYPES = {
241
241
 
242
242
  const entrySubject = new BehaviorSubject();
243
243
 
244
+ const SETUP_ADAPTER_FN = () => {
245
+ {
246
+ Dump.useMarkdown();
247
+ }
248
+ {
249
+ SessionLive.usePersist();
250
+ SessionBacktest.useLocal();
251
+ }
252
+ {
253
+ StorageLive.usePersist();
254
+ StorageBacktest.useMemory();
255
+ }
256
+ {
257
+ RecentLive.usePersist();
258
+ RecentBacktest.useMemory();
259
+ }
260
+ {
261
+ NotificationLive.usePersist();
262
+ NotificationBacktest.useMemory();
263
+ }
264
+ {
265
+ RecentLive.usePersist();
266
+ RecentBacktest.useMemory();
267
+ }
268
+ {
269
+ MemoryLive.usePersist();
270
+ MemoryBacktest.useLocal();
271
+ }
272
+ {
273
+ StateLive.usePersist();
274
+ StateBacktest.useLocal();
275
+ }
276
+ {
277
+ Markdown.useDummy();
278
+ Log.useJsonl();
279
+ }
280
+ };
281
+ class SetupUtils {
282
+ constructor() {
283
+ this.enable = singleshot(() => {
284
+ cli.loggerService.debug("SetupUtils enable");
285
+ {
286
+ const config = cli.configService.getNotificationConfig();
287
+ Notification.enable(config);
288
+ }
289
+ {
290
+ Recent.enable();
291
+ Storage.enable();
292
+ }
293
+ {
294
+ Markdown.enable();
295
+ Report.enable();
296
+ Dump.enable();
297
+ State.enable();
298
+ Memory.enable();
299
+ }
300
+ if (!cli.configConnectionService.hasConfig("setup.config")) {
301
+ SETUP_ADAPTER_FN();
302
+ }
303
+ });
304
+ this.clear = () => {
305
+ cli.loggerService.debug("SetupUtils clear");
306
+ if (!this.enable.hasValue()) {
307
+ return;
308
+ }
309
+ this.enable.clear();
310
+ {
311
+ Recent.disable();
312
+ Storage.disable();
313
+ Notification.disable();
314
+ }
315
+ {
316
+ Markdown.disable();
317
+ Report.disable();
318
+ Dump.disable();
319
+ Memory.disable();
320
+ }
321
+ {
322
+ Markdown.clear();
323
+ Report.clear();
324
+ MarkdownWriter.clear();
325
+ ReportWriter.clear();
326
+ }
327
+ {
328
+ PersistSignalAdapter.clear();
329
+ PersistRiskAdapter.clear();
330
+ PersistScheduleAdapter.clear();
331
+ PersistPartialAdapter.clear();
332
+ PersistBreakevenAdapter.clear();
333
+ PersistCandleAdapter.clear();
334
+ PersistStorageAdapter.clear();
335
+ PersistNotificationAdapter.clear();
336
+ PersistLogAdapter.clear();
337
+ PersistMeasureAdapter.clear();
338
+ PersistIntervalAdapter.clear();
339
+ PersistMemoryAdapter.clear();
340
+ PersistRecentAdapter.clear();
341
+ PersistStateAdapter.clear();
342
+ PersistSessionAdapter.clear();
343
+ }
344
+ {
345
+ Dump.clear();
346
+ Log.clear();
347
+ Markdown.clear();
348
+ }
349
+ {
350
+ StorageLive.clear();
351
+ StorageBacktest.clear();
352
+ }
353
+ {
354
+ NotificationLive.clear();
355
+ NotificationBacktest.clear();
356
+ }
357
+ {
358
+ RecentLive.clear();
359
+ RecentBacktest.clear();
360
+ }
361
+ };
362
+ this.update = () => {
363
+ cli.loggerService.debug("SetupUtils update");
364
+ if (cli.configConnectionService.hasConfig("setup.config")) {
365
+ return;
366
+ }
367
+ Log.useJsonl();
368
+ Dump.useMarkdown();
369
+ };
370
+ }
371
+ }
372
+ const Setup = new SetupUtils();
373
+
244
374
  const __filename$2 = fileURLToPath(import.meta.url);
245
375
  const __dirname$2 = path.dirname(__filename$2);
246
376
  let _is_launched = false;
@@ -302,7 +432,7 @@ class ResolveService {
302
432
  {
303
433
  const cwd = process.cwd();
304
434
  process.chdir(moduleRoot);
305
- cwd !== moduleRoot && Log.useJsonl();
435
+ cwd !== moduleRoot && Setup.update();
306
436
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
307
437
  dotenv.config({ path: path.join(moduleRoot, '.env'), override: true, quiet: true });
308
438
  this.loaderService.import(absolutePath);
@@ -728,123 +858,6 @@ const notifyVerbose = singleshot(() => {
728
858
  });
729
859
  });
730
860
 
731
- class SetupUtils {
732
- constructor() {
733
- this.enable = singleshot(() => {
734
- cli.loggerService.debug("SetupUtils enable");
735
- {
736
- const config = cli.configService.getNotificationConfig();
737
- Notification.enable(config);
738
- }
739
- {
740
- Recent.enable();
741
- Storage.enable();
742
- }
743
- {
744
- Markdown.enable();
745
- Report.enable();
746
- Dump.enable();
747
- State.enable();
748
- Memory.enable();
749
- }
750
- {
751
- Dump.useMarkdown();
752
- }
753
- {
754
- SessionLive.usePersist();
755
- SessionBacktest.useLocal();
756
- }
757
- {
758
- StorageLive.usePersist();
759
- StorageBacktest.useMemory();
760
- }
761
- {
762
- RecentLive.usePersist();
763
- RecentBacktest.useMemory();
764
- }
765
- {
766
- NotificationLive.usePersist();
767
- NotificationBacktest.useMemory();
768
- }
769
- {
770
- RecentLive.usePersist();
771
- RecentBacktest.useMemory();
772
- }
773
- {
774
- MemoryLive.usePersist();
775
- MemoryBacktest.useLocal();
776
- }
777
- {
778
- StateLive.usePersist();
779
- StateBacktest.useLocal();
780
- }
781
- {
782
- Markdown.useDummy();
783
- Log.useJsonl();
784
- }
785
- });
786
- this.clear = () => {
787
- cli.loggerService.debug("SetupUtils clear");
788
- if (!this.enable.hasValue()) {
789
- return;
790
- }
791
- this.enable.clear();
792
- {
793
- Recent.disable();
794
- Storage.disable();
795
- Notification.disable();
796
- }
797
- {
798
- Markdown.disable();
799
- Report.disable();
800
- Dump.disable();
801
- Memory.disable();
802
- }
803
- {
804
- Markdown.clear();
805
- Report.clear();
806
- MarkdownWriter.clear();
807
- ReportWriter.clear();
808
- }
809
- {
810
- PersistSignalAdapter.clear();
811
- PersistRiskAdapter.clear();
812
- PersistScheduleAdapter.clear();
813
- PersistPartialAdapter.clear();
814
- PersistBreakevenAdapter.clear();
815
- PersistCandleAdapter.clear();
816
- PersistStorageAdapter.clear();
817
- PersistNotificationAdapter.clear();
818
- PersistLogAdapter.clear();
819
- PersistMeasureAdapter.clear();
820
- PersistIntervalAdapter.clear();
821
- PersistMemoryAdapter.clear();
822
- PersistRecentAdapter.clear();
823
- PersistStateAdapter.clear();
824
- PersistSessionAdapter.clear();
825
- }
826
- {
827
- Dump.clear();
828
- Log.clear();
829
- Markdown.clear();
830
- }
831
- {
832
- StorageLive.clear();
833
- StorageBacktest.clear();
834
- }
835
- {
836
- NotificationLive.clear();
837
- NotificationBacktest.clear();
838
- }
839
- {
840
- RecentLive.clear();
841
- RecentBacktest.clear();
842
- }
843
- };
844
- }
845
- }
846
- const Setup = new SetupUtils();
847
-
848
861
  const DEFAULT_CACHE_LIST$1 = ["1m", "15m", "30m", "1h", "4h"];
849
862
  const GET_CACHE_INTERVAL_LIST_FN$1 = () => {
850
863
  const { values } = getArgs();
@@ -867,10 +880,12 @@ class BacktestMainService {
867
880
  this.frontendProviderService = inject(TYPES.frontendProviderService);
868
881
  this.telegramProviderService = inject(TYPES.telegramProviderService);
869
882
  this.moduleConnectionService = inject(TYPES.moduleConnectionService);
883
+ this.configConnectionService = inject(TYPES.configConnectionService);
870
884
  this.run = singleshot(async (payload) => {
871
885
  this.loggerService.log("backtestMainService run", {
872
886
  payload,
873
887
  });
888
+ await this.configConnectionService.loadConfig("setup.config");
874
889
  {
875
890
  await this.configService.waitForInit();
876
891
  Setup.enable();
@@ -885,7 +900,7 @@ class BacktestMainService {
885
900
  }
886
901
  {
887
902
  await this.resolveService.attachJavascript(payload.entryPoint);
888
- await this.moduleConnectionService.loadModule("./backtest.module");
903
+ await this.moduleConnectionService.loadModule("backtest.module");
889
904
  }
890
905
  {
891
906
  this.exchangeSchemaService.addSchema();
@@ -986,8 +1001,10 @@ class WalkerMainService {
986
1001
  this.symbolSchemaService = inject(TYPES.symbolSchemaService);
987
1002
  this.cacheLogicService = inject(TYPES.cacheLogicService);
988
1003
  this.moduleConnectionService = inject(TYPES.moduleConnectionService);
1004
+ this.configConnectionService = inject(TYPES.configConnectionService);
989
1005
  this.run = singleshot(async (payload) => {
990
1006
  this.loggerService.log("walkerMainService run", { payload });
1007
+ await this.configConnectionService.loadConfig("setup.config");
991
1008
  {
992
1009
  await this.configService.waitForInit();
993
1010
  Setup.enable();
@@ -1006,7 +1023,7 @@ class WalkerMainService {
1006
1023
  Setup.enable();
1007
1024
  }
1008
1025
  {
1009
- cwd !== moduleRoot && Log.useJsonl();
1026
+ cwd !== moduleRoot && Setup.update();
1010
1027
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
1011
1028
  dotenv.config({ path: path.join(moduleRoot, '.env'), override: true, quiet: true });
1012
1029
  }
@@ -1025,7 +1042,7 @@ class WalkerMainService {
1025
1042
  const cwd = process.cwd();
1026
1043
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
1027
1044
  }
1028
- await this.moduleConnectionService.loadModule("./walker.module");
1045
+ await this.moduleConnectionService.loadModule("walker.module");
1029
1046
  {
1030
1047
  this.exchangeSchemaService.addSchema();
1031
1048
  this.symbolSchemaService.addSchema();
@@ -1081,7 +1098,7 @@ class WalkerMainService {
1081
1098
  }
1082
1099
  restoreSnapshot();
1083
1100
  {
1084
- cwd !== moduleRoot && Log.useJsonl();
1101
+ cwd !== moduleRoot && Setup.update();
1085
1102
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
1086
1103
  dotenv.config({ path: path.join(moduleRoot, '.env'), override: true, quiet: true });
1087
1104
  }
@@ -1207,10 +1224,12 @@ class LiveMainService {
1207
1224
  this.frontendProviderService = inject(TYPES.frontendProviderService);
1208
1225
  this.telegramProviderService = inject(TYPES.telegramProviderService);
1209
1226
  this.moduleConnectionService = inject(TYPES.moduleConnectionService);
1227
+ this.configConnectionService = inject(TYPES.configConnectionService);
1210
1228
  this.run = singleshot(async (payload) => {
1211
1229
  this.loggerService.log("liveMainService run", {
1212
1230
  payload,
1213
1231
  });
1232
+ await this.configConnectionService.loadConfig("setup.config");
1214
1233
  {
1215
1234
  await this.configService.waitForInit();
1216
1235
  Setup.enable();
@@ -1225,7 +1244,7 @@ class LiveMainService {
1225
1244
  }
1226
1245
  {
1227
1246
  await this.resolveService.attachJavascript(payload.entryPoint);
1228
- await this.moduleConnectionService.loadModule("./live.module");
1247
+ await this.moduleConnectionService.loadModule("live.module");
1229
1248
  }
1230
1249
  {
1231
1250
  this.exchangeSchemaService.addSchema();
@@ -1293,8 +1312,10 @@ class PaperMainService {
1293
1312
  this.frontendProviderService = inject(TYPES.frontendProviderService);
1294
1313
  this.telegramProviderService = inject(TYPES.telegramProviderService);
1295
1314
  this.moduleConnectionService = inject(TYPES.moduleConnectionService);
1315
+ this.configConnectionService = inject(TYPES.configConnectionService);
1296
1316
  this.run = singleshot(async (payload) => {
1297
1317
  this.loggerService.log("paperMainService init");
1318
+ await this.configConnectionService.loadConfig("setup.config");
1298
1319
  {
1299
1320
  await this.configService.waitForInit();
1300
1321
  Setup.enable();
@@ -1309,7 +1330,7 @@ class PaperMainService {
1309
1330
  }
1310
1331
  {
1311
1332
  await this.resolveService.attachJavascript(payload.entryPoint);
1312
- await this.moduleConnectionService.loadModule("./paper.module");
1333
+ await this.moduleConnectionService.loadModule("paper.module");
1313
1334
  }
1314
1335
  {
1315
1336
  this.exchangeSchemaService.addSchema();
@@ -2507,12 +2528,22 @@ class ModuleConnectionService {
2507
2528
  this.loggerService = inject(TYPES.loggerService);
2508
2529
  this.resolveService = inject(TYPES.resolveService);
2509
2530
  this.loaderService = inject(TYPES.loaderService);
2510
- this.loadModule = async (fileName) => {
2511
- this.loggerService.log("moduleConnectionService loadModule", {
2531
+ this.hasModule = (fileName) => {
2532
+ this.loggerService.log("moduleConnectionService hasModule", {
2512
2533
  fileName,
2513
2534
  });
2514
- return await LOAD_MODULE_MODULE_FN(fileName, this);
2535
+ return this.loadModule.has(fileName);
2515
2536
  };
2537
+ this.loadModule = memoize(([fileName]) => `${fileName}`, async (fileName) => {
2538
+ this.loggerService.log("moduleConnectionService loadModule", {
2539
+ fileName,
2540
+ });
2541
+ const module = await LOAD_MODULE_MODULE_FN(fileName, this);
2542
+ if (!module) {
2543
+ this.loadModule.clear(fileName);
2544
+ }
2545
+ return module;
2546
+ });
2516
2547
  }
2517
2548
  }
2518
2549
 
@@ -2555,6 +2586,18 @@ class BabelService {
2555
2586
  }
2556
2587
  }
2557
2588
 
2589
+ const require = createRequire(import.meta.url);
2590
+ const ModuleWithCache = Module;
2591
+ function overrideModule(moduleName, newExports) {
2592
+ const cache = ModuleWithCache._cache;
2593
+ const key = require.resolve(moduleName);
2594
+ if (!cache[key]) {
2595
+ cache[key] = new ModuleWithCache(key);
2596
+ cache[key].loaded = true;
2597
+ }
2598
+ cache[key].exports = newExports;
2599
+ }
2600
+
2558
2601
  /**
2559
2602
  * This file is used to define any aliases for imports in the client code. This is useful for mocking modules during testing or for providing alternative implementations of certain modules.
2560
2603
  * For example, if we want to mock the "pinets" module during testing, we can add an entry to the IMPORT_ALIAS object that points to our mock implementation. Then, when the client code tries to import "pinets", it will receive our mock implementation instead of the actual "pinets" module.
@@ -2569,7 +2612,7 @@ class BabelService {
2569
2612
  const IMPORT_ALIAS = {};
2570
2613
 
2571
2614
  const USE_ESMODULE_DEFAULT = false;
2572
- const IMPORT_PATHS_EXCLUDE = new Set(["dump", "logs", "modules", "node_modules"]);
2615
+ const IMPORT_PATHS_EXCLUDE = new Set(["dump", "logs", "modules", "config", "node_modules"]);
2573
2616
  const TRANSPILE_FN = memoize(([path]) => `${path}`, (path, code, self, require) => {
2574
2617
  const __filename = self.__filename;
2575
2618
  const __dirname = self.__dirname;
@@ -2787,16 +2830,21 @@ globalThis.BacktestKitGraph = BacktestKitGraph;
2787
2830
  globalThis.BacktestKitOllama = BacktestKitOllama;
2788
2831
  globalThis.BacktestKitPinets = BacktestKitPinets;
2789
2832
  globalThis.BacktestKitSignals = BacktestKitSignals;
2833
+ overrideModule('backtest-kit', BacktestKit);
2834
+ overrideModule('@backtest-kit/cli', BacktestKitCli);
2835
+ overrideModule('@backtest-kit/ui', BacktestKitUi);
2836
+ overrideModule('@backtest-kit/graph', BacktestKitGraph);
2837
+ overrideModule('@backtest-kit/ollama', BacktestKitOllama);
2838
+ overrideModule('@backtest-kit/pinets', BacktestKitPinets);
2839
+ overrideModule('@backtest-kit/signals', BacktestKitSignals);
2790
2840
 
2791
2841
  const GET_ALIAS_EXPORTS_FN = (self) => {
2792
2842
  const instance = self.getInstance(self.resolveService.OVERRIDE_CONFIG_DIR);
2793
- if (!instance.check("alias.module")) {
2843
+ if (!instance.check("alias.config")) {
2794
2844
  return null;
2795
2845
  }
2796
- const exports = instance.import("alias.module");
2797
- return "default" in exports
2798
- ? exports.default
2799
- : exports;
2846
+ const exports = instance.import("alias.config");
2847
+ return "default" in exports ? exports.default : exports;
2800
2848
  };
2801
2849
  const INIT_ALIAS_FN = (self) => {
2802
2850
  const alias = GET_ALIAS_EXPORTS_FN(self);
@@ -2806,7 +2854,10 @@ const INIT_ALIAS_FN = (self) => {
2806
2854
  if (!isObject(alias)) {
2807
2855
  return;
2808
2856
  }
2809
- Object.assign(IMPORT_ALIAS, alias);
2857
+ {
2858
+ Object.entries(alias).forEach(([name, module]) => overrideModule(name, module));
2859
+ Object.assign(IMPORT_ALIAS, alias);
2860
+ }
2810
2861
  };
2811
2862
  class LoaderService {
2812
2863
  constructor() {
@@ -2877,12 +2928,22 @@ class ConfigConnectionService {
2877
2928
  this.loggerService = inject(TYPES.loggerService);
2878
2929
  this.resolveService = inject(TYPES.resolveService);
2879
2930
  this.loaderService = inject(TYPES.loaderService);
2880
- this.loadConfig = (fileName) => {
2881
- this.loggerService.log("configConnectionService loadConfig", {
2931
+ this.hasConfig = (fileName) => {
2932
+ this.loggerService.log("configConnectionService hasConfig", {
2882
2933
  fileName,
2883
2934
  });
2884
- return LOAD_CONFIG_CONFIG_FN(fileName, this);
2935
+ return this.loadConfig.has(fileName);
2885
2936
  };
2937
+ this.loadConfig = memoize(([fileName]) => `${fileName}`, async (fileName) => {
2938
+ this.loggerService.log("configConnectionService loadConfig", {
2939
+ fileName,
2940
+ });
2941
+ const config = await LOAD_CONFIG_CONFIG_FN(fileName, this);
2942
+ if (!config) {
2943
+ this.loadConfig.clear(fileName);
2944
+ }
2945
+ return config;
2946
+ });
2886
2947
  }
2887
2948
  }
2888
2949
 
@@ -3038,7 +3099,7 @@ const main$g = async () => {
3038
3099
  if (MODES.some((mode) => values[mode])) {
3039
3100
  return;
3040
3101
  }
3041
- process.stdout.write(`@backtest-kit/cli ${"9.2.0"}\n`);
3102
+ process.stdout.write(`@backtest-kit/cli ${"9.3.0"}\n`);
3042
3103
  process.stdout.write("\n");
3043
3104
  process.stdout.write(`Run with --help to see available commands.\n`);
3044
3105
  process.stdout.write("\n");
@@ -3228,10 +3289,10 @@ const main$b = async () => {
3228
3289
  main$b();
3229
3290
 
3230
3291
  const MODE_MODULE = {
3231
- backtest: "./backtest.module",
3232
- live: "./live.module",
3233
- paper: "./paper.module",
3234
- walker: "./walker.module",
3292
+ backtest: "backtest.module",
3293
+ live: "live.module",
3294
+ paper: "paper.module",
3295
+ walker: "walker.module",
3235
3296
  };
3236
3297
  const resolveMode = (values) => {
3237
3298
  const enabled = ["backtest", "live", "paper", "walker"].filter((mode) => Boolean(values[mode]));
@@ -3326,8 +3387,11 @@ const main$a = async () => {
3326
3387
  if (!values.noFlush) {
3327
3388
  await flush(entryPoint);
3328
3389
  }
3329
- await cli.configService.waitForInit();
3330
- Setup.enable();
3390
+ await cli.configConnectionService.loadConfig("setup.config");
3391
+ {
3392
+ await cli.configService.waitForInit();
3393
+ Setup.enable();
3394
+ }
3331
3395
  cli.frontendProviderService.connect();
3332
3396
  cli.telegramProviderService.connect();
3333
3397
  {
@@ -3422,7 +3486,8 @@ const main$7 = async () => {
3422
3486
  const cwd = process.cwd();
3423
3487
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
3424
3488
  }
3425
- await cli.moduleConnectionService.loadModule("./pine.module");
3489
+ await cli.configConnectionService.loadConfig("setup.config");
3490
+ await cli.moduleConnectionService.loadModule("pine.module");
3426
3491
  {
3427
3492
  await cli.exchangeSchemaService.addSchema();
3428
3493
  await cli.symbolSchemaService.addSchema();
@@ -3499,6 +3564,7 @@ const main$6 = async () => {
3499
3564
  console.warn("--editor and --pine are mutually exclusive. Use one at a time.");
3500
3565
  process.exit(1);
3501
3566
  }
3567
+ await cli.configConnectionService.loadConfig("setup.config");
3502
3568
  {
3503
3569
  await cli.configService.waitForInit();
3504
3570
  Setup.enable();
@@ -3507,7 +3573,7 @@ const main$6 = async () => {
3507
3573
  const cwd = process.cwd();
3508
3574
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
3509
3575
  }
3510
- await cli.moduleConnectionService.loadModule("./editor.module");
3576
+ await cli.moduleConnectionService.loadModule("editor.module");
3511
3577
  {
3512
3578
  await cli.exchangeSchemaService.addSchema();
3513
3579
  }
@@ -3540,7 +3606,8 @@ const main$5 = async () => {
3540
3606
  const cwd = process.cwd();
3541
3607
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
3542
3608
  }
3543
- await cli.moduleConnectionService.loadModule("./dump.module");
3609
+ await cli.configConnectionService.loadConfig("setup.config");
3610
+ await cli.moduleConnectionService.loadModule("dump.module");
3544
3611
  {
3545
3612
  await cli.exchangeSchemaService.addSchema();
3546
3613
  await cli.symbolSchemaService.addSchema();
@@ -3607,7 +3674,8 @@ const main$4 = async () => {
3607
3674
  const cwd = process.cwd();
3608
3675
  dotenv.config({ path: path.join(cwd, '.env'), override: true, quiet: true });
3609
3676
  }
3610
- await cli.moduleConnectionService.loadModule("./pnldebug.module");
3677
+ await cli.configConnectionService.loadConfig("setup.config");
3678
+ await cli.moduleConnectionService.loadModule("pnldebug.module");
3611
3679
  {
3612
3680
  await cli.exchangeSchemaService.addSchema();
3613
3681
  await cli.symbolSchemaService.addSchema();
@@ -4061,7 +4129,7 @@ const main$1 = async () => {
4061
4129
  if (!values.help) {
4062
4130
  return;
4063
4131
  }
4064
- process.stdout.write(`@backtest-kit/cli ${"9.2.0"}\n\n`);
4132
+ process.stdout.write(`@backtest-kit/cli ${"9.3.0"}\n\n`);
4065
4133
  process.stdout.write(HELP_TEXT);
4066
4134
  process.exit(0);
4067
4135
  };
@@ -4075,7 +4143,7 @@ const main = async () => {
4075
4143
  if (!values.version) {
4076
4144
  return;
4077
4145
  }
4078
- process.stdout.write(`@backtest-kit/cli ${"9.2.0"}\n`);
4146
+ process.stdout.write(`@backtest-kit/cli ${"9.3.0"}\n`);
4079
4147
  process.exit(0);
4080
4148
  };
4081
4149
  main();
@@ -15,17 +15,17 @@
15
15
  "@types/node": "25.6.0"
16
16
  },
17
17
  "dependencies": {
18
- "@backtest-kit/cli": "9.2.0",
19
- "@backtest-kit/graph": "9.2.0",
20
- "@backtest-kit/pinets": "9.2.0",
21
- "@backtest-kit/signals": "9.2.0",
22
- "@backtest-kit/ui": "9.2.0",
18
+ "@backtest-kit/cli": "9.4.0",
19
+ "@backtest-kit/graph": "9.4.0",
20
+ "@backtest-kit/pinets": "9.4.0",
21
+ "@backtest-kit/signals": "9.4.0",
22
+ "@backtest-kit/ui": "9.4.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.6.0",
28
- "backtest-kit": "9.2.0",
28
+ "backtest-kit": "9.4.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": "9.2.0",
3
+ "version": "9.4.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": "9.2.0",
67
- "@backtest-kit/ollama": "9.2.0",
68
- "@backtest-kit/pinets": "9.2.0",
69
- "@backtest-kit/signals": "9.2.0",
70
- "@backtest-kit/ui": "9.2.0",
66
+ "@backtest-kit/graph": "9.4.0",
67
+ "@backtest-kit/ollama": "9.4.0",
68
+ "@backtest-kit/pinets": "9.4.0",
69
+ "@backtest-kit/signals": "9.4.0",
70
+ "@backtest-kit/ui": "9.4.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": "9.2.0",
78
+ "backtest-kit": "9.4.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": "^9.2.0",
94
- "@backtest-kit/ollama": "^9.2.0",
95
- "@backtest-kit/pinets": "^9.2.0",
96
- "@backtest-kit/signals": "^9.2.0",
97
- "@backtest-kit/ui": "^9.2.0",
98
- "backtest-kit": "^9.2.0",
93
+ "@backtest-kit/graph": "^9.4.0",
94
+ "@backtest-kit/ollama": "^9.4.0",
95
+ "@backtest-kit/pinets": "^9.4.0",
96
+ "@backtest-kit/signals": "^9.4.0",
97
+ "@backtest-kit/ui": "^9.4.0",
98
+ "backtest-kit": "^9.4.0",
99
99
  "markdown-it": "^14.1.1",
100
100
  "typescript": "^5.0.0"
101
101
  },