@backtest-kit/cli 7.8.0 → 8.0.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
@@ -430,10 +430,10 @@ const ALLOWED_EXTENSIONS = [
430
430
  const DISALLOWED_PATHS = [
431
431
  "node_modules",
432
432
  "@backtest-kit",
433
- "build/index.mjs",
434
- "build/index.js",
435
- "build\\index.mjs",
436
- "build\\index.js",
433
+ "cli/build/index.mjs",
434
+ "cli/build/index.js",
435
+ "cli\\build\\index.mjs",
436
+ "cli\\build\\index.js",
437
437
  ];
438
438
  const getArgs = singleshot(() => {
439
439
  const { values, positionals } = parseArgs({
@@ -2972,10 +2972,10 @@ init();
2972
2972
 
2973
2973
  const MODES = ["backtest", "walker", "paper", "live", "pine", "editor", "dump", "pnldebug", "flush", "init", "help", "version"];
2974
2974
  const ENTRY_PATH$1 = "./node_modules/@backtest-kit/cli/build/index.mjs";
2975
- const HELP_TEXT$1 = `
2976
- Example:
2977
-
2978
- node ${ENTRY_PATH$1} --help
2975
+ const HELP_TEXT$1 = `
2976
+ Example:
2977
+
2978
+ node ${ENTRY_PATH$1} --help
2979
2979
  `.trimStart();
2980
2980
  const main$e = async () => {
2981
2981
  if (!getEntry(import.meta.url)) {
@@ -2985,7 +2985,7 @@ const main$e = async () => {
2985
2985
  if (MODES.some((mode) => values[mode])) {
2986
2986
  return;
2987
2987
  }
2988
- process.stdout.write(`@backtest-kit/cli ${"7.8.0"}\n`);
2988
+ process.stdout.write(`@backtest-kit/cli ${"8.0.0"}\n`);
2989
2989
  process.stdout.write("\n");
2990
2990
  process.stdout.write(`Run with --help to see available commands.\n`);
2991
2991
  process.stdout.write("\n");
@@ -3603,158 +3603,158 @@ const main$2 = async () => {
3603
3603
  main$2();
3604
3604
 
3605
3605
  const ENTRY_PATH = "./node_modules/@backtest-kit/cli/build/index.mjs";
3606
- const HELP_TEXT = `
3607
- Usage:
3608
- node index.mjs --<mode> [flags] [entry-point]
3609
-
3610
- Modes:
3611
-
3612
- --backtest <entry> Run strategy against historical candle data
3613
- --walker <entry...> Run Walker A/B strategy comparison across multiple strategies
3614
- --paper <entry> Paper trading (live prices, no real orders)
3615
- --live <entry> Live trading with real orders
3616
- --pine <entry> Execute a local .pine indicator file
3617
- --editor Open the Pine Script visual editor in the browser
3618
- --dump Fetch and save raw OHLCV candles
3619
- --pnldebug Simulate PnL per minute for a given entry price and direction
3620
- --flush <entry...> Delete report/log/markdown/agent folders from strategy dump dir
3621
- --init Scaffold a new project in the current directory
3622
- --help Print this help message
3623
-
3624
- Backtest flags:
3625
-
3626
- --symbol <string> Trading pair (default: BTCUSDT)
3627
- --strategy <string> Strategy name from addStrategySchema (default: first registered)
3628
- --exchange <string> Exchange name from addExchangeSchema (default: first registered)
3629
- --frame <string> Frame name from addFrameSchema (default: first registered)
3630
- --cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
3631
- --noCache Skip candle cache warming before the run
3632
- --noFlush Skip removing report/log/markdown/agent folders before backtest run
3633
- --verbose Log every candle fetch to stdout
3634
- --ui Start web dashboard at http://localhost:60050
3635
- --telegram Send trade notifications to Telegram
3636
-
3637
- Walker flags (--walker):
3638
-
3639
- --symbol <string> Trading pair (default: BTCUSDT)
3640
- --cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
3641
- --noCache Skip candle cache warming before the run
3642
- --noFlush Skip removing report/log/markdown/agent folders before walker run
3643
- --verbose Log every candle fetch to stdout
3644
- --output <string> Output file base name (default: walker_{SYMBOL}_{TIMESTAMP})
3645
- --json Save results as JSON to ./dump/<output>.json
3646
- --markdown Save report as Markdown to ./dump/<output>.md
3647
-
3648
- Each positional argument is a strategy entry point. All strategy files are loaded without
3649
- changing process.cwd() — .env is read from the working directory only.
3650
- addWalkerSchema is called automatically using the registered exchange and frame.
3651
- After comparison completes the report is printed to stdout (or saved if --json/--markdown).
3652
-
3653
- Module file ./modules/walker.module is loaded automatically if it exists.
3654
-
3655
- Paper / Live flags:
3656
-
3657
- --symbol <string> Trading pair (default: BTCUSDT)
3658
- --strategy <string> Strategy name (default: first registered)
3659
- --exchange <string> Exchange name (default: first registered)
3660
- --verbose Log every candle fetch to stdout
3661
- --ui Start web dashboard
3662
- --telegram Send Telegram notifications
3663
-
3664
- PineScript flags (--pine):
3665
-
3666
- --symbol <string> Trading pair (default: BTCUSDT)
3667
- --timeframe <string> Candle interval (default: 15m)
3668
- --limit <string> Number of candles to fetch (default: 250)
3669
- --when <string> End date — ISO 8601 or Unix ms (default: now)
3670
- --exchange <string> Exchange name (default: first registered)
3671
- --output <string> Output file base name without extension
3672
- --json Save output as JSON array to <pine-dir>/dump/<output>.json
3673
- --jsonl Save output as JSONL to <pine-dir>/dump/<output>.jsonl
3674
- --markdown Save output as Markdown table to <pine-dir>/dump/<output>.md
3675
-
3676
- Only plot() calls with display=display.data_window produce output columns.
3677
- Module file ./modules/pine.module is loaded automatically if it exists.
3678
-
3679
- Candle dump flags (--dump):
3680
-
3681
- --symbol <string> Trading pair (default: BTCUSDT)
3682
- --timeframe <string> Candle interval (default: 15m)
3683
- --limit <string> Number of candles (default: 250)
3684
- --when <string> End date — ISO 8601 or Unix ms (default: now)
3685
- --exchange <string> Exchange name (default: first registered)
3686
- --output <string> Output file base name (default: {SYMBOL}_{LIMIT}_{TIMEFRAME}_{TIMESTAMP})
3687
- --json Save as JSON array to ./dump/<output>.json
3688
- --jsonl Save as JSONL to ./dump/<output>.jsonl
3689
-
3690
- Module file ./modules/dump.module is loaded automatically if it exists.
3691
-
3692
- PnL debug flags (--pnldebug):
3693
-
3694
- --symbol <string> Trading pair (default: BTCUSDT)
3695
- --priceopen <number> Entry price (required)
3696
- --direction <string> Position direction: long or short (default: long)
3697
- --when <string> Start timestamp — ISO 8601 or Unix ms (default: now)
3698
- --minutes <string> Number of 1m candles to simulate (default: 60)
3699
- --exchange <string> Exchange name (default: first registered)
3700
- --output <string> Output file base name (default: {SYMBOL}_{DIRECTION}_{PRICEOPEN}_{TIMESTAMP})
3701
- --json Save as JSON array to ./dump/<output>.json
3702
- --jsonl Save as JSONL to ./dump/<output>.jsonl
3703
- --markdown Save as Markdown table to ./dump/<output>.md
3704
-
3705
- Module file ./modules/pnldebug.module is loaded automatically if it exists.
3706
-
3707
- Flush flags (--flush):
3708
-
3709
- One or more positional entry points. For each entry point the following
3710
- subdirectories are removed from <entry-dir>/dump/:
3711
-
3712
- report log markdown agent
3713
-
3714
- Init flags (--init):
3715
-
3716
- --output <string> Target directory name (default: backtest-kit-project)
3717
-
3718
- Scaffolds a project and runs scripts/fetch_docs.mjs to download library docs.
3719
-
3720
- Module hooks (loaded automatically by each mode):
3721
-
3722
- modules/backtest.module --backtest Broker adapter for backtest
3723
- modules/walker.module --walker Broker adapter for walker comparison
3724
- modules/paper.module --paper Broker adapter for paper trading
3725
- modules/live.module --live Broker adapter for live trading
3726
- modules/pine.module --pine Exchange schema for PineScript runs
3727
- modules/editor.module --editor Exchange schema for the visual Pine editor
3728
- modules/dump.module --dump Exchange schema for candle dumps
3729
- modules/pnldebug.module --pnldebug Exchange schema for PnL debug runs
3730
-
3731
- --flush has no associated module. It only removes dump subdirectories.
3732
-
3733
- Extensions .ts, .mjs, .cjs are tried automatically. Missing module = soft warning.
3734
-
3735
- Environment variables:
3736
-
3737
- CC_TELEGRAM_TOKEN Telegram bot token (required for --telegram)
3738
- CC_TELEGRAM_CHANNEL Telegram channel or chat ID (required for --telegram)
3739
- CC_WWWROOT_HOST UI server bind address (default: 0.0.0.0)
3740
- CC_WWWROOT_PORT UI server port (default: 60050)
3741
-
3742
- Examples:
3743
-
3744
- node ${ENTRY_PATH} --backtest ./content/feb_2026.strategy.ts
3745
- node ${ENTRY_PATH} --backtest --symbol BTCUSDT --noCache --noFlush --ui ./content/feb_2026.strategy.ts
3746
- node ${ENTRY_PATH} --walker ./content/feb_2026_v1.strategy.ts ./content/feb_2026_v2.strategy.ts ./content/feb_2026_v3.strategy.ts
3747
- node ${ENTRY_PATH} --walker --symbol BTCUSDT --noCache --noFlush --markdown ./content/feb_2026_v1.ts ./content/feb_2026_v2.ts
3748
- node ${ENTRY_PATH} --paper --symbol ETHUSDT ./content/feb_2026.strategy.ts
3749
- node ${ENTRY_PATH} --live --ui --telegram ./content/feb_2026.strategy.ts
3750
- node ${ENTRY_PATH} --pine ./math/feb_2026.pine --timeframe 15m --limit 500 --jsonl
3751
- node ${ENTRY_PATH} --editor
3752
- node ${ENTRY_PATH} --dump --symbol BTCUSDT --timeframe 15m --limit 500 --jsonl
3753
- node ${ENTRY_PATH} --pnldebug --symbol BTCUSDT --priceopen 64069.50 --direction short --when "2025-02-25" --minutes 120
3754
- node ${ENTRY_PATH} --pnldebug --priceopen 67956.73 --direction long --when 1772064000000 --minutes 60 --markdown
3755
- node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts
3756
- node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts ./content/feb_2026.strategy/feb_2026.test.ts
3757
- node ${ENTRY_PATH} --init --output my-trading-bot
3606
+ const HELP_TEXT = `
3607
+ Usage:
3608
+ node index.mjs --<mode> [flags] [entry-point]
3609
+
3610
+ Modes:
3611
+
3612
+ --backtest <entry> Run strategy against historical candle data
3613
+ --walker <entry...> Run Walker A/B strategy comparison across multiple strategies
3614
+ --paper <entry> Paper trading (live prices, no real orders)
3615
+ --live <entry> Live trading with real orders
3616
+ --pine <entry> Execute a local .pine indicator file
3617
+ --editor Open the Pine Script visual editor in the browser
3618
+ --dump Fetch and save raw OHLCV candles
3619
+ --pnldebug Simulate PnL per minute for a given entry price and direction
3620
+ --flush <entry...> Delete report/log/markdown/agent folders from strategy dump dir
3621
+ --init Scaffold a new project in the current directory
3622
+ --help Print this help message
3623
+
3624
+ Backtest flags:
3625
+
3626
+ --symbol <string> Trading pair (default: BTCUSDT)
3627
+ --strategy <string> Strategy name from addStrategySchema (default: first registered)
3628
+ --exchange <string> Exchange name from addExchangeSchema (default: first registered)
3629
+ --frame <string> Frame name from addFrameSchema (default: first registered)
3630
+ --cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
3631
+ --noCache Skip candle cache warming before the run
3632
+ --noFlush Skip removing report/log/markdown/agent folders before backtest run
3633
+ --verbose Log every candle fetch to stdout
3634
+ --ui Start web dashboard at http://localhost:60050
3635
+ --telegram Send trade notifications to Telegram
3636
+
3637
+ Walker flags (--walker):
3638
+
3639
+ --symbol <string> Trading pair (default: BTCUSDT)
3640
+ --cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
3641
+ --noCache Skip candle cache warming before the run
3642
+ --noFlush Skip removing report/log/markdown/agent folders before walker run
3643
+ --verbose Log every candle fetch to stdout
3644
+ --output <string> Output file base name (default: walker_{SYMBOL}_{TIMESTAMP})
3645
+ --json Save results as JSON to ./dump/<output>.json
3646
+ --markdown Save report as Markdown to ./dump/<output>.md
3647
+
3648
+ Each positional argument is a strategy entry point. All strategy files are loaded without
3649
+ changing process.cwd() — .env is read from the working directory only.
3650
+ addWalkerSchema is called automatically using the registered exchange and frame.
3651
+ After comparison completes the report is printed to stdout (or saved if --json/--markdown).
3652
+
3653
+ Module file ./modules/walker.module is loaded automatically if it exists.
3654
+
3655
+ Paper / Live flags:
3656
+
3657
+ --symbol <string> Trading pair (default: BTCUSDT)
3658
+ --strategy <string> Strategy name (default: first registered)
3659
+ --exchange <string> Exchange name (default: first registered)
3660
+ --verbose Log every candle fetch to stdout
3661
+ --ui Start web dashboard
3662
+ --telegram Send Telegram notifications
3663
+
3664
+ PineScript flags (--pine):
3665
+
3666
+ --symbol <string> Trading pair (default: BTCUSDT)
3667
+ --timeframe <string> Candle interval (default: 15m)
3668
+ --limit <string> Number of candles to fetch (default: 250)
3669
+ --when <string> End date — ISO 8601 or Unix ms (default: now)
3670
+ --exchange <string> Exchange name (default: first registered)
3671
+ --output <string> Output file base name without extension
3672
+ --json Save output as JSON array to <pine-dir>/dump/<output>.json
3673
+ --jsonl Save output as JSONL to <pine-dir>/dump/<output>.jsonl
3674
+ --markdown Save output as Markdown table to <pine-dir>/dump/<output>.md
3675
+
3676
+ Only plot() calls with display=display.data_window produce output columns.
3677
+ Module file ./modules/pine.module is loaded automatically if it exists.
3678
+
3679
+ Candle dump flags (--dump):
3680
+
3681
+ --symbol <string> Trading pair (default: BTCUSDT)
3682
+ --timeframe <string> Candle interval (default: 15m)
3683
+ --limit <string> Number of candles (default: 250)
3684
+ --when <string> End date — ISO 8601 or Unix ms (default: now)
3685
+ --exchange <string> Exchange name (default: first registered)
3686
+ --output <string> Output file base name (default: {SYMBOL}_{LIMIT}_{TIMEFRAME}_{TIMESTAMP})
3687
+ --json Save as JSON array to ./dump/<output>.json
3688
+ --jsonl Save as JSONL to ./dump/<output>.jsonl
3689
+
3690
+ Module file ./modules/dump.module is loaded automatically if it exists.
3691
+
3692
+ PnL debug flags (--pnldebug):
3693
+
3694
+ --symbol <string> Trading pair (default: BTCUSDT)
3695
+ --priceopen <number> Entry price (required)
3696
+ --direction <string> Position direction: long or short (default: long)
3697
+ --when <string> Start timestamp — ISO 8601 or Unix ms (default: now)
3698
+ --minutes <string> Number of 1m candles to simulate (default: 60)
3699
+ --exchange <string> Exchange name (default: first registered)
3700
+ --output <string> Output file base name (default: {SYMBOL}_{DIRECTION}_{PRICEOPEN}_{TIMESTAMP})
3701
+ --json Save as JSON array to ./dump/<output>.json
3702
+ --jsonl Save as JSONL to ./dump/<output>.jsonl
3703
+ --markdown Save as Markdown table to ./dump/<output>.md
3704
+
3705
+ Module file ./modules/pnldebug.module is loaded automatically if it exists.
3706
+
3707
+ Flush flags (--flush):
3708
+
3709
+ One or more positional entry points. For each entry point the following
3710
+ subdirectories are removed from <entry-dir>/dump/:
3711
+
3712
+ report log markdown agent
3713
+
3714
+ Init flags (--init):
3715
+
3716
+ --output <string> Target directory name (default: backtest-kit-project)
3717
+
3718
+ Scaffolds a project and runs scripts/fetch_docs.mjs to download library docs.
3719
+
3720
+ Module hooks (loaded automatically by each mode):
3721
+
3722
+ modules/backtest.module --backtest Broker adapter for backtest
3723
+ modules/walker.module --walker Broker adapter for walker comparison
3724
+ modules/paper.module --paper Broker adapter for paper trading
3725
+ modules/live.module --live Broker adapter for live trading
3726
+ modules/pine.module --pine Exchange schema for PineScript runs
3727
+ modules/editor.module --editor Exchange schema for the visual Pine editor
3728
+ modules/dump.module --dump Exchange schema for candle dumps
3729
+ modules/pnldebug.module --pnldebug Exchange schema for PnL debug runs
3730
+
3731
+ --flush has no associated module. It only removes dump subdirectories.
3732
+
3733
+ Extensions .ts, .mjs, .cjs are tried automatically. Missing module = soft warning.
3734
+
3735
+ Environment variables:
3736
+
3737
+ CC_TELEGRAM_TOKEN Telegram bot token (required for --telegram)
3738
+ CC_TELEGRAM_CHANNEL Telegram channel or chat ID (required for --telegram)
3739
+ CC_WWWROOT_HOST UI server bind address (default: 0.0.0.0)
3740
+ CC_WWWROOT_PORT UI server port (default: 60050)
3741
+
3742
+ Examples:
3743
+
3744
+ node ${ENTRY_PATH} --backtest ./content/feb_2026.strategy.ts
3745
+ node ${ENTRY_PATH} --backtest --symbol BTCUSDT --noCache --noFlush --ui ./content/feb_2026.strategy.ts
3746
+ node ${ENTRY_PATH} --walker ./content/feb_2026_v1.strategy.ts ./content/feb_2026_v2.strategy.ts ./content/feb_2026_v3.strategy.ts
3747
+ node ${ENTRY_PATH} --walker --symbol BTCUSDT --noCache --noFlush --markdown ./content/feb_2026_v1.ts ./content/feb_2026_v2.ts
3748
+ node ${ENTRY_PATH} --paper --symbol ETHUSDT ./content/feb_2026.strategy.ts
3749
+ node ${ENTRY_PATH} --live --ui --telegram ./content/feb_2026.strategy.ts
3750
+ node ${ENTRY_PATH} --pine ./math/feb_2026.pine --timeframe 15m --limit 500 --jsonl
3751
+ node ${ENTRY_PATH} --editor
3752
+ node ${ENTRY_PATH} --dump --symbol BTCUSDT --timeframe 15m --limit 500 --jsonl
3753
+ node ${ENTRY_PATH} --pnldebug --symbol BTCUSDT --priceopen 64069.50 --direction short --when "2025-02-25" --minutes 120
3754
+ node ${ENTRY_PATH} --pnldebug --priceopen 67956.73 --direction long --when 1772064000000 --minutes 60 --markdown
3755
+ node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts
3756
+ node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts ./content/feb_2026.strategy/feb_2026.test.ts
3757
+ node ${ENTRY_PATH} --init --output my-trading-bot
3758
3758
  `.trimStart();
3759
3759
  const main$1 = async () => {
3760
3760
  if (!getEntry(import.meta.url)) {
@@ -3764,7 +3764,7 @@ const main$1 = async () => {
3764
3764
  if (!values.help) {
3765
3765
  return;
3766
3766
  }
3767
- process.stdout.write(`@backtest-kit/cli ${"7.8.0"}\n\n`);
3767
+ process.stdout.write(`@backtest-kit/cli ${"8.0.0"}\n\n`);
3768
3768
  process.stdout.write(HELP_TEXT);
3769
3769
  process.exit(0);
3770
3770
  };
@@ -3778,7 +3778,7 @@ const main = async () => {
3778
3778
  if (!values.version) {
3779
3779
  return;
3780
3780
  }
3781
- process.stdout.write(`@backtest-kit/cli ${"7.8.0"}\n`);
3781
+ process.stdout.write(`@backtest-kit/cli ${"8.0.0"}\n`);
3782
3782
  process.exit(0);
3783
3783
  };
3784
3784
  main();
@@ -1,13 +1,13 @@
1
- export default {
2
- signal: true,
3
- risk: true,
4
- info: true,
5
- breakeven: true,
6
- common_error: true,
7
- critical_error: true,
8
- validation_error: true,
9
- partial_loss: false,
10
- partial_profit: false,
11
- signal_sync: false,
12
- strategy_commit: true,
13
- };
1
+ export default {
2
+ signal: true,
3
+ risk: true,
4
+ info: true,
5
+ breakeven: true,
6
+ common_error: true,
7
+ critical_error: true,
8
+ validation_error: true,
9
+ partial_loss: false,
10
+ partial_profit: false,
11
+ signal_sync: false,
12
+ strategy_commit: true,
13
+ };