@backtest-kit/cli 13.2.0 → 13.3.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/README.md +1888 -1888
- package/build/index.cjs +205 -205
- package/build/index.mjs +205 -205
- package/config/notification.config.mjs +13 -13
- package/config/symbol.config.mjs +460 -460
- package/docker/.env.example +2 -2
- package/docker/content/feb_2026/feb_2026.strategy.ts +11 -11
- package/docker/content/feb_2026/modules/backtest.module.ts +83 -83
- package/docker/docker-compose.yaml +46 -46
- package/docker/package.json +39 -39
- package/docker/tsconfig.json +36 -36
- package/package.json +126 -126
- package/template/average-buy.mustache +22 -22
- package/template/breakeven.mustache +21 -21
- package/template/cancel-scheduled.mustache +14 -14
- package/template/cancelled.mustache +21 -21
- package/template/close-pending.mustache +16 -16
- package/template/closed.mustache +23 -23
- package/template/opened.mustache +22 -22
- package/template/partial-loss.mustache +22 -22
- package/template/partial-profit.mustache +22 -22
- package/template/project/config/symbol.config.ts +460 -460
- package/template/project/package.mustache +28 -28
- package/template/risk.mustache +19 -19
- package/template/scheduled.mustache +22 -22
- package/template/signal-close.mustache +22 -22
- package/template/signal-info.mustache +20 -20
- package/template/signal-open.mustache +22 -22
- package/template/source/CLAUDE.md +160 -160
- package/template/trailing-stop.mustache +21 -21
- package/template/trailing-take.mustache +21 -21
package/build/index.mjs
CHANGED
|
@@ -3355,10 +3355,10 @@ init();
|
|
|
3355
3355
|
|
|
3356
3356
|
const MODES = ["backtest", "walker", "paper", "live", "main", "pine", "editor", "dump", "pnldebug", "brokerdebug", "flush", "init", "docker", "help", "version"];
|
|
3357
3357
|
const ENTRY_PATH$1 = "./node_modules/@backtest-kit/cli/build/index.mjs";
|
|
3358
|
-
const HELP_TEXT$1 = `
|
|
3359
|
-
Example:
|
|
3360
|
-
|
|
3361
|
-
node ${ENTRY_PATH$1} --help
|
|
3358
|
+
const HELP_TEXT$1 = `
|
|
3359
|
+
Example:
|
|
3360
|
+
|
|
3361
|
+
node ${ENTRY_PATH$1} --help
|
|
3362
3362
|
`.trimStart();
|
|
3363
3363
|
const main$h = async () => {
|
|
3364
3364
|
if (!getEntry(import.meta.url)) {
|
|
@@ -3368,7 +3368,7 @@ const main$h = async () => {
|
|
|
3368
3368
|
if (MODES.some((mode) => values[mode])) {
|
|
3369
3369
|
return;
|
|
3370
3370
|
}
|
|
3371
|
-
process.stdout.write(`@backtest-kit/cli ${"13.
|
|
3371
|
+
process.stdout.write(`@backtest-kit/cli ${"13.3.0"}\n`);
|
|
3372
3372
|
process.stdout.write("\n");
|
|
3373
3373
|
process.stdout.write(`Run with --help to see available commands.\n`);
|
|
3374
3374
|
process.stdout.write("\n");
|
|
@@ -4467,204 +4467,204 @@ const main$2 = async () => {
|
|
|
4467
4467
|
main$2();
|
|
4468
4468
|
|
|
4469
4469
|
const ENTRY_PATH = "./node_modules/@backtest-kit/cli/build/index.mjs";
|
|
4470
|
-
const HELP_TEXT = `
|
|
4471
|
-
Usage:
|
|
4472
|
-
node index.mjs --<mode> [flags] [entry-point]
|
|
4473
|
-
|
|
4474
|
-
Modes:
|
|
4475
|
-
|
|
4476
|
-
--backtest <entry> Run strategy against historical candle data
|
|
4477
|
-
--walker <entry...> Run Walker A/B strategy comparison across multiple strategies
|
|
4478
|
-
--paper <entry> Paper trading (live prices, no real orders)
|
|
4479
|
-
--live <entry> Live trading with real orders
|
|
4480
|
-
--main <entry> Run an entry point with prepared environment, no trading harness
|
|
4481
|
-
--pine <entry> Execute a local .pine indicator file
|
|
4482
|
-
--editor Open the Pine Script visual editor in the browser
|
|
4483
|
-
--dump Fetch and save raw OHLCV candles
|
|
4484
|
-
--pnldebug Simulate PnL per minute for a given entry price and direction
|
|
4485
|
-
--brokerdebug Fire a single broker commit against the live broker adapter
|
|
4486
|
-
--flush <entry...> Delete report/log/markdown/agent folders from strategy dump dir
|
|
4487
|
-
--init Scaffold a new project in the current directory
|
|
4488
|
-
--docker Scaffold a Docker workspace for running strategies in a container
|
|
4489
|
-
--help Print this help message
|
|
4490
|
-
|
|
4491
|
-
Backtest flags:
|
|
4492
|
-
|
|
4493
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4494
|
-
--strategy <string> Strategy name from addStrategySchema (default: first registered)
|
|
4495
|
-
--exchange <string> Exchange name from addExchangeSchema (default: first registered)
|
|
4496
|
-
--frame <string> Frame name from addFrameSchema (default: first registered)
|
|
4497
|
-
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
4498
|
-
--noCache Skip candle cache warming before the run
|
|
4499
|
-
--noFlush Skip removing report/log/markdown/agent folders before backtest run
|
|
4500
|
-
--verbose Log every candle fetch to stdout
|
|
4501
|
-
--ui Start web dashboard at http://localhost:60050
|
|
4502
|
-
--telegram Send trade notifications to Telegram
|
|
4503
|
-
|
|
4504
|
-
Walker flags (--walker):
|
|
4505
|
-
|
|
4506
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4507
|
-
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
4508
|
-
--noCache Skip candle cache warming before the run
|
|
4509
|
-
--noFlush Skip removing report/log/markdown/agent folders before walker run
|
|
4510
|
-
--verbose Log every candle fetch to stdout
|
|
4511
|
-
--output <string> Output file base name (default: walker_{SYMBOL}_{TIMESTAMP})
|
|
4512
|
-
--json Save results as JSON to ./dump/<output>.json
|
|
4513
|
-
--markdown Save report as Markdown to ./dump/<output>.md
|
|
4514
|
-
|
|
4515
|
-
Each positional argument is a strategy entry point. All strategy files are loaded without
|
|
4516
|
-
changing process.cwd() — .env is read from the working directory only.
|
|
4517
|
-
addWalkerSchema is called automatically using the registered exchange and frame.
|
|
4518
|
-
After comparison completes the report is printed to stdout (or saved if --json/--markdown).
|
|
4519
|
-
|
|
4520
|
-
Module file ./modules/walker.module is loaded automatically if it exists.
|
|
4521
|
-
|
|
4522
|
-
Paper / Live flags:
|
|
4523
|
-
|
|
4524
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4525
|
-
--strategy <string> Strategy name (default: first registered)
|
|
4526
|
-
--exchange <string> Exchange name (default: first registered)
|
|
4527
|
-
--verbose Log every candle fetch to stdout
|
|
4528
|
-
--ui Start web dashboard
|
|
4529
|
-
--telegram Send Telegram notifications
|
|
4530
|
-
|
|
4531
|
-
Main flags (--main):
|
|
4532
|
-
|
|
4533
|
-
--noFlush Skip removing report/log/markdown/agent folders before the run
|
|
4534
|
-
|
|
4535
|
-
Prepares the runtime environment (loads .env, setup.config, loader.config and
|
|
4536
|
-
modules/main.module) and runs the single positional entry point — but does NOT
|
|
4537
|
-
start any trading harness. Unlike --backtest/--live/--walker, the CLI never calls
|
|
4538
|
-
Backtest/Live/Walker.background; the entry point decides what to run.
|
|
4539
|
-
|
|
4540
|
-
Exactly one positional entry point is required. process.cwd() is changed to the
|
|
4541
|
-
entry point directory and its local .env is loaded.
|
|
4542
|
-
|
|
4543
|
-
Backtest, Live and Walker runs started from userspace are still tracked: the run
|
|
4544
|
-
finishes automatically when one of them completes, Ctrl+C stops any active run,
|
|
4545
|
-
and a second Ctrl+C force-quits.
|
|
4546
|
-
|
|
4547
|
-
Module file ./modules/main.module is loaded automatically if it exists.
|
|
4548
|
-
|
|
4549
|
-
PineScript flags (--pine):
|
|
4550
|
-
|
|
4551
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4552
|
-
--timeframe <string> Candle interval (default: 15m)
|
|
4553
|
-
--limit <string> Number of candles to fetch (default: 250)
|
|
4554
|
-
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
4555
|
-
--exchange <string> Exchange name (default: first registered)
|
|
4556
|
-
--output <string> Output file base name without extension
|
|
4557
|
-
--json Save output as JSON array to <pine-dir>/dump/<output>.json
|
|
4558
|
-
--jsonl Save output as JSONL to <pine-dir>/dump/<output>.jsonl
|
|
4559
|
-
--markdown Save output as Markdown table to <pine-dir>/dump/<output>.md
|
|
4560
|
-
|
|
4561
|
-
Only plot() calls with display=display.data_window produce output columns.
|
|
4562
|
-
Module file ./modules/pine.module is loaded automatically if it exists.
|
|
4563
|
-
|
|
4564
|
-
Candle dump flags (--dump):
|
|
4565
|
-
|
|
4566
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4567
|
-
--timeframe <string> Candle interval (default: 15m)
|
|
4568
|
-
--limit <string> Number of candles (default: 250)
|
|
4569
|
-
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
4570
|
-
--exchange <string> Exchange name (default: first registered)
|
|
4571
|
-
--output <string> Output file base name (default: {SYMBOL}_{LIMIT}_{TIMEFRAME}_{TIMESTAMP})
|
|
4572
|
-
--json Save as JSON array to ./dump/<output>.json
|
|
4573
|
-
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
4574
|
-
|
|
4575
|
-
Module file ./modules/dump.module is loaded automatically if it exists.
|
|
4576
|
-
|
|
4577
|
-
PnL debug flags (--pnldebug):
|
|
4578
|
-
|
|
4579
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4580
|
-
--priceopen <number> Entry price (required)
|
|
4581
|
-
--direction <string> Position direction: long or short (default: long)
|
|
4582
|
-
--when <string> Start timestamp — ISO 8601 or Unix ms (default: now)
|
|
4583
|
-
--minutes <string> Number of 1m candles to simulate (default: 60)
|
|
4584
|
-
--exchange <string> Exchange name (default: first registered)
|
|
4585
|
-
--output <string> Output file base name (default: {SYMBOL}_{DIRECTION}_{PRICEOPEN}_{TIMESTAMP})
|
|
4586
|
-
--json Save as JSON array to ./dump/<output>.json
|
|
4587
|
-
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
4588
|
-
--markdown Save as Markdown table to ./dump/<output>.md
|
|
4589
|
-
|
|
4590
|
-
Module file ./modules/pnldebug.module is loaded automatically if it exists.
|
|
4591
|
-
|
|
4592
|
-
Broker debug flags (--brokerdebug):
|
|
4593
|
-
|
|
4594
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4595
|
-
--exchange <string> Exchange name (default: first registered)
|
|
4596
|
-
--commit <string> Commit type to fire: signal-open, signal-close, partial-profit,
|
|
4597
|
-
partial-loss, average-buy, trailing-stop, trailing-take, breakeven
|
|
4598
|
-
(default: signal-open)
|
|
4599
|
-
|
|
4600
|
-
Loads ./live.module, fetches the last candle for --symbol/--timeframe, and calls
|
|
4601
|
-
the selected broker commit with synthetic payload values derived from current price.
|
|
4602
|
-
|
|
4603
|
-
Flush flags (--flush):
|
|
4604
|
-
|
|
4605
|
-
One or more positional entry points. For each entry point the following
|
|
4606
|
-
subdirectories are removed from <entry-dir>/dump/:
|
|
4607
|
-
|
|
4608
|
-
report log markdown agent
|
|
4609
|
-
|
|
4610
|
-
Init flags (--init):
|
|
4611
|
-
|
|
4612
|
-
--output <string> Target directory name (default: backtest-kit-project)
|
|
4613
|
-
|
|
4614
|
-
Scaffolds a project and runs scripts/fetch_docs.mjs to download library docs.
|
|
4615
|
-
|
|
4616
|
-
Docker flags (--docker):
|
|
4617
|
-
|
|
4618
|
-
--output <string> Target directory name (default: backtest-kit-docker)
|
|
4619
|
-
|
|
4620
|
-
Scaffolds a Docker workspace: docker-compose.yaml, .env.example, package.json,
|
|
4621
|
-
tsconfig.json, and a sample strategy under content/. Run npm install then
|
|
4622
|
-
docker compose up to start the container.
|
|
4623
|
-
|
|
4624
|
-
Module hooks (loaded automatically by each mode):
|
|
4625
|
-
|
|
4626
|
-
modules/backtest.module --backtest Broker adapter for backtest
|
|
4627
|
-
modules/walker.module --walker Broker adapter for walker comparison
|
|
4628
|
-
modules/paper.module --paper Broker adapter for paper trading
|
|
4629
|
-
modules/live.module --live Broker adapter for live trading
|
|
4630
|
-
modules/main.module --main Environment setup for a custom entry point
|
|
4631
|
-
modules/pine.module --pine Exchange schema for PineScript runs
|
|
4632
|
-
modules/editor.module --editor Exchange schema for the visual Pine editor
|
|
4633
|
-
modules/dump.module --dump Exchange schema for candle dumps
|
|
4634
|
-
modules/pnldebug.module --pnldebug Exchange schema for PnL debug runs
|
|
4635
|
-
modules/brokerdebug.module --brokerdebug Broker adapter used for broker commit testing
|
|
4636
|
-
|
|
4637
|
-
--flush has no associated module. It only removes dump subdirectories.
|
|
4638
|
-
|
|
4639
|
-
Extensions .ts, .mjs, .cjs are tried automatically. Missing module = soft warning.
|
|
4640
|
-
|
|
4641
|
-
Environment variables:
|
|
4642
|
-
|
|
4643
|
-
CC_TELEGRAM_TOKEN Telegram bot token (required for --telegram)
|
|
4644
|
-
CC_TELEGRAM_CHANNEL Telegram channel or chat ID (required for --telegram)
|
|
4645
|
-
CC_WWWROOT_HOST UI server bind address (default: 0.0.0.0)
|
|
4646
|
-
CC_WWWROOT_PORT UI server port (default: 60050)
|
|
4647
|
-
|
|
4648
|
-
Examples:
|
|
4649
|
-
|
|
4650
|
-
node ${ENTRY_PATH} --backtest ./content/feb_2026.strategy.ts
|
|
4651
|
-
node ${ENTRY_PATH} --backtest --symbol BTCUSDT --noCache --noFlush --ui ./content/feb_2026.strategy.ts
|
|
4652
|
-
node ${ENTRY_PATH} --walker ./content/feb_2026_v1.strategy.ts ./content/feb_2026_v2.strategy.ts ./content/feb_2026_v3.strategy.ts
|
|
4653
|
-
node ${ENTRY_PATH} --walker --symbol BTCUSDT --noCache --noFlush --markdown ./content/feb_2026_v1.ts ./content/feb_2026_v2.ts
|
|
4654
|
-
node ${ENTRY_PATH} --paper --symbol ETHUSDT ./content/feb_2026.strategy.ts
|
|
4655
|
-
node ${ENTRY_PATH} --live --ui --telegram ./content/feb_2026.strategy.ts
|
|
4656
|
-
node ${ENTRY_PATH} --main ./tools/fetch_fear_and_greed.ts
|
|
4657
|
-
node ${ENTRY_PATH} --pine ./math/feb_2026.pine --timeframe 15m --limit 500 --jsonl
|
|
4658
|
-
node ${ENTRY_PATH} --editor
|
|
4659
|
-
node ${ENTRY_PATH} --dump --symbol BTCUSDT --timeframe 15m --limit 500 --jsonl
|
|
4660
|
-
node ${ENTRY_PATH} --pnldebug --symbol BTCUSDT --priceopen 64069.50 --direction short --when "2025-02-25" --minutes 120
|
|
4661
|
-
node ${ENTRY_PATH} --pnldebug --priceopen 67956.73 --direction long --when 1772064000000 --minutes 60 --markdown
|
|
4662
|
-
node ${ENTRY_PATH} --brokerdebug --commit signal-open --symbol BTCUSDT
|
|
4663
|
-
node ${ENTRY_PATH} --brokerdebug --commit partial-profit --symbol ETHUSDT
|
|
4664
|
-
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts
|
|
4665
|
-
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts ./content/feb_2026.strategy/feb_2026.test.ts
|
|
4666
|
-
node ${ENTRY_PATH} --init --output my-trading-bot
|
|
4667
|
-
node ${ENTRY_PATH} --docker --output my-docker-workspace
|
|
4470
|
+
const HELP_TEXT = `
|
|
4471
|
+
Usage:
|
|
4472
|
+
node index.mjs --<mode> [flags] [entry-point]
|
|
4473
|
+
|
|
4474
|
+
Modes:
|
|
4475
|
+
|
|
4476
|
+
--backtest <entry> Run strategy against historical candle data
|
|
4477
|
+
--walker <entry...> Run Walker A/B strategy comparison across multiple strategies
|
|
4478
|
+
--paper <entry> Paper trading (live prices, no real orders)
|
|
4479
|
+
--live <entry> Live trading with real orders
|
|
4480
|
+
--main <entry> Run an entry point with prepared environment, no trading harness
|
|
4481
|
+
--pine <entry> Execute a local .pine indicator file
|
|
4482
|
+
--editor Open the Pine Script visual editor in the browser
|
|
4483
|
+
--dump Fetch and save raw OHLCV candles
|
|
4484
|
+
--pnldebug Simulate PnL per minute for a given entry price and direction
|
|
4485
|
+
--brokerdebug Fire a single broker commit against the live broker adapter
|
|
4486
|
+
--flush <entry...> Delete report/log/markdown/agent folders from strategy dump dir
|
|
4487
|
+
--init Scaffold a new project in the current directory
|
|
4488
|
+
--docker Scaffold a Docker workspace for running strategies in a container
|
|
4489
|
+
--help Print this help message
|
|
4490
|
+
|
|
4491
|
+
Backtest flags:
|
|
4492
|
+
|
|
4493
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4494
|
+
--strategy <string> Strategy name from addStrategySchema (default: first registered)
|
|
4495
|
+
--exchange <string> Exchange name from addExchangeSchema (default: first registered)
|
|
4496
|
+
--frame <string> Frame name from addFrameSchema (default: first registered)
|
|
4497
|
+
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
4498
|
+
--noCache Skip candle cache warming before the run
|
|
4499
|
+
--noFlush Skip removing report/log/markdown/agent folders before backtest run
|
|
4500
|
+
--verbose Log every candle fetch to stdout
|
|
4501
|
+
--ui Start web dashboard at http://localhost:60050
|
|
4502
|
+
--telegram Send trade notifications to Telegram
|
|
4503
|
+
|
|
4504
|
+
Walker flags (--walker):
|
|
4505
|
+
|
|
4506
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4507
|
+
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
4508
|
+
--noCache Skip candle cache warming before the run
|
|
4509
|
+
--noFlush Skip removing report/log/markdown/agent folders before walker run
|
|
4510
|
+
--verbose Log every candle fetch to stdout
|
|
4511
|
+
--output <string> Output file base name (default: walker_{SYMBOL}_{TIMESTAMP})
|
|
4512
|
+
--json Save results as JSON to ./dump/<output>.json
|
|
4513
|
+
--markdown Save report as Markdown to ./dump/<output>.md
|
|
4514
|
+
|
|
4515
|
+
Each positional argument is a strategy entry point. All strategy files are loaded without
|
|
4516
|
+
changing process.cwd() — .env is read from the working directory only.
|
|
4517
|
+
addWalkerSchema is called automatically using the registered exchange and frame.
|
|
4518
|
+
After comparison completes the report is printed to stdout (or saved if --json/--markdown).
|
|
4519
|
+
|
|
4520
|
+
Module file ./modules/walker.module is loaded automatically if it exists.
|
|
4521
|
+
|
|
4522
|
+
Paper / Live flags:
|
|
4523
|
+
|
|
4524
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4525
|
+
--strategy <string> Strategy name (default: first registered)
|
|
4526
|
+
--exchange <string> Exchange name (default: first registered)
|
|
4527
|
+
--verbose Log every candle fetch to stdout
|
|
4528
|
+
--ui Start web dashboard
|
|
4529
|
+
--telegram Send Telegram notifications
|
|
4530
|
+
|
|
4531
|
+
Main flags (--main):
|
|
4532
|
+
|
|
4533
|
+
--noFlush Skip removing report/log/markdown/agent folders before the run
|
|
4534
|
+
|
|
4535
|
+
Prepares the runtime environment (loads .env, setup.config, loader.config and
|
|
4536
|
+
modules/main.module) and runs the single positional entry point — but does NOT
|
|
4537
|
+
start any trading harness. Unlike --backtest/--live/--walker, the CLI never calls
|
|
4538
|
+
Backtest/Live/Walker.background; the entry point decides what to run.
|
|
4539
|
+
|
|
4540
|
+
Exactly one positional entry point is required. process.cwd() is changed to the
|
|
4541
|
+
entry point directory and its local .env is loaded.
|
|
4542
|
+
|
|
4543
|
+
Backtest, Live and Walker runs started from userspace are still tracked: the run
|
|
4544
|
+
finishes automatically when one of them completes, Ctrl+C stops any active run,
|
|
4545
|
+
and a second Ctrl+C force-quits.
|
|
4546
|
+
|
|
4547
|
+
Module file ./modules/main.module is loaded automatically if it exists.
|
|
4548
|
+
|
|
4549
|
+
PineScript flags (--pine):
|
|
4550
|
+
|
|
4551
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4552
|
+
--timeframe <string> Candle interval (default: 15m)
|
|
4553
|
+
--limit <string> Number of candles to fetch (default: 250)
|
|
4554
|
+
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
4555
|
+
--exchange <string> Exchange name (default: first registered)
|
|
4556
|
+
--output <string> Output file base name without extension
|
|
4557
|
+
--json Save output as JSON array to <pine-dir>/dump/<output>.json
|
|
4558
|
+
--jsonl Save output as JSONL to <pine-dir>/dump/<output>.jsonl
|
|
4559
|
+
--markdown Save output as Markdown table to <pine-dir>/dump/<output>.md
|
|
4560
|
+
|
|
4561
|
+
Only plot() calls with display=display.data_window produce output columns.
|
|
4562
|
+
Module file ./modules/pine.module is loaded automatically if it exists.
|
|
4563
|
+
|
|
4564
|
+
Candle dump flags (--dump):
|
|
4565
|
+
|
|
4566
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4567
|
+
--timeframe <string> Candle interval (default: 15m)
|
|
4568
|
+
--limit <string> Number of candles (default: 250)
|
|
4569
|
+
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
4570
|
+
--exchange <string> Exchange name (default: first registered)
|
|
4571
|
+
--output <string> Output file base name (default: {SYMBOL}_{LIMIT}_{TIMEFRAME}_{TIMESTAMP})
|
|
4572
|
+
--json Save as JSON array to ./dump/<output>.json
|
|
4573
|
+
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
4574
|
+
|
|
4575
|
+
Module file ./modules/dump.module is loaded automatically if it exists.
|
|
4576
|
+
|
|
4577
|
+
PnL debug flags (--pnldebug):
|
|
4578
|
+
|
|
4579
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4580
|
+
--priceopen <number> Entry price (required)
|
|
4581
|
+
--direction <string> Position direction: long or short (default: long)
|
|
4582
|
+
--when <string> Start timestamp — ISO 8601 or Unix ms (default: now)
|
|
4583
|
+
--minutes <string> Number of 1m candles to simulate (default: 60)
|
|
4584
|
+
--exchange <string> Exchange name (default: first registered)
|
|
4585
|
+
--output <string> Output file base name (default: {SYMBOL}_{DIRECTION}_{PRICEOPEN}_{TIMESTAMP})
|
|
4586
|
+
--json Save as JSON array to ./dump/<output>.json
|
|
4587
|
+
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
4588
|
+
--markdown Save as Markdown table to ./dump/<output>.md
|
|
4589
|
+
|
|
4590
|
+
Module file ./modules/pnldebug.module is loaded automatically if it exists.
|
|
4591
|
+
|
|
4592
|
+
Broker debug flags (--brokerdebug):
|
|
4593
|
+
|
|
4594
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
4595
|
+
--exchange <string> Exchange name (default: first registered)
|
|
4596
|
+
--commit <string> Commit type to fire: signal-open, signal-close, partial-profit,
|
|
4597
|
+
partial-loss, average-buy, trailing-stop, trailing-take, breakeven
|
|
4598
|
+
(default: signal-open)
|
|
4599
|
+
|
|
4600
|
+
Loads ./live.module, fetches the last candle for --symbol/--timeframe, and calls
|
|
4601
|
+
the selected broker commit with synthetic payload values derived from current price.
|
|
4602
|
+
|
|
4603
|
+
Flush flags (--flush):
|
|
4604
|
+
|
|
4605
|
+
One or more positional entry points. For each entry point the following
|
|
4606
|
+
subdirectories are removed from <entry-dir>/dump/:
|
|
4607
|
+
|
|
4608
|
+
report log markdown agent
|
|
4609
|
+
|
|
4610
|
+
Init flags (--init):
|
|
4611
|
+
|
|
4612
|
+
--output <string> Target directory name (default: backtest-kit-project)
|
|
4613
|
+
|
|
4614
|
+
Scaffolds a project and runs scripts/fetch_docs.mjs to download library docs.
|
|
4615
|
+
|
|
4616
|
+
Docker flags (--docker):
|
|
4617
|
+
|
|
4618
|
+
--output <string> Target directory name (default: backtest-kit-docker)
|
|
4619
|
+
|
|
4620
|
+
Scaffolds a Docker workspace: docker-compose.yaml, .env.example, package.json,
|
|
4621
|
+
tsconfig.json, and a sample strategy under content/. Run npm install then
|
|
4622
|
+
docker compose up to start the container.
|
|
4623
|
+
|
|
4624
|
+
Module hooks (loaded automatically by each mode):
|
|
4625
|
+
|
|
4626
|
+
modules/backtest.module --backtest Broker adapter for backtest
|
|
4627
|
+
modules/walker.module --walker Broker adapter for walker comparison
|
|
4628
|
+
modules/paper.module --paper Broker adapter for paper trading
|
|
4629
|
+
modules/live.module --live Broker adapter for live trading
|
|
4630
|
+
modules/main.module --main Environment setup for a custom entry point
|
|
4631
|
+
modules/pine.module --pine Exchange schema for PineScript runs
|
|
4632
|
+
modules/editor.module --editor Exchange schema for the visual Pine editor
|
|
4633
|
+
modules/dump.module --dump Exchange schema for candle dumps
|
|
4634
|
+
modules/pnldebug.module --pnldebug Exchange schema for PnL debug runs
|
|
4635
|
+
modules/brokerdebug.module --brokerdebug Broker adapter used for broker commit testing
|
|
4636
|
+
|
|
4637
|
+
--flush has no associated module. It only removes dump subdirectories.
|
|
4638
|
+
|
|
4639
|
+
Extensions .ts, .mjs, .cjs are tried automatically. Missing module = soft warning.
|
|
4640
|
+
|
|
4641
|
+
Environment variables:
|
|
4642
|
+
|
|
4643
|
+
CC_TELEGRAM_TOKEN Telegram bot token (required for --telegram)
|
|
4644
|
+
CC_TELEGRAM_CHANNEL Telegram channel or chat ID (required for --telegram)
|
|
4645
|
+
CC_WWWROOT_HOST UI server bind address (default: 0.0.0.0)
|
|
4646
|
+
CC_WWWROOT_PORT UI server port (default: 60050)
|
|
4647
|
+
|
|
4648
|
+
Examples:
|
|
4649
|
+
|
|
4650
|
+
node ${ENTRY_PATH} --backtest ./content/feb_2026.strategy.ts
|
|
4651
|
+
node ${ENTRY_PATH} --backtest --symbol BTCUSDT --noCache --noFlush --ui ./content/feb_2026.strategy.ts
|
|
4652
|
+
node ${ENTRY_PATH} --walker ./content/feb_2026_v1.strategy.ts ./content/feb_2026_v2.strategy.ts ./content/feb_2026_v3.strategy.ts
|
|
4653
|
+
node ${ENTRY_PATH} --walker --symbol BTCUSDT --noCache --noFlush --markdown ./content/feb_2026_v1.ts ./content/feb_2026_v2.ts
|
|
4654
|
+
node ${ENTRY_PATH} --paper --symbol ETHUSDT ./content/feb_2026.strategy.ts
|
|
4655
|
+
node ${ENTRY_PATH} --live --ui --telegram ./content/feb_2026.strategy.ts
|
|
4656
|
+
node ${ENTRY_PATH} --main ./tools/fetch_fear_and_greed.ts
|
|
4657
|
+
node ${ENTRY_PATH} --pine ./math/feb_2026.pine --timeframe 15m --limit 500 --jsonl
|
|
4658
|
+
node ${ENTRY_PATH} --editor
|
|
4659
|
+
node ${ENTRY_PATH} --dump --symbol BTCUSDT --timeframe 15m --limit 500 --jsonl
|
|
4660
|
+
node ${ENTRY_PATH} --pnldebug --symbol BTCUSDT --priceopen 64069.50 --direction short --when "2025-02-25" --minutes 120
|
|
4661
|
+
node ${ENTRY_PATH} --pnldebug --priceopen 67956.73 --direction long --when 1772064000000 --minutes 60 --markdown
|
|
4662
|
+
node ${ENTRY_PATH} --brokerdebug --commit signal-open --symbol BTCUSDT
|
|
4663
|
+
node ${ENTRY_PATH} --brokerdebug --commit partial-profit --symbol ETHUSDT
|
|
4664
|
+
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts
|
|
4665
|
+
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts ./content/feb_2026.strategy/feb_2026.test.ts
|
|
4666
|
+
node ${ENTRY_PATH} --init --output my-trading-bot
|
|
4667
|
+
node ${ENTRY_PATH} --docker --output my-docker-workspace
|
|
4668
4668
|
`.trimStart();
|
|
4669
4669
|
const main$1 = async () => {
|
|
4670
4670
|
if (!getEntry(import.meta.url)) {
|
|
@@ -4674,7 +4674,7 @@ const main$1 = async () => {
|
|
|
4674
4674
|
if (!values.help) {
|
|
4675
4675
|
return;
|
|
4676
4676
|
}
|
|
4677
|
-
process.stdout.write(`@backtest-kit/cli ${"13.
|
|
4677
|
+
process.stdout.write(`@backtest-kit/cli ${"13.3.0"}\n\n`);
|
|
4678
4678
|
process.stdout.write(HELP_TEXT);
|
|
4679
4679
|
process.exit(0);
|
|
4680
4680
|
};
|
|
@@ -4688,7 +4688,7 @@ const main = async () => {
|
|
|
4688
4688
|
if (!values.version) {
|
|
4689
4689
|
return;
|
|
4690
4690
|
}
|
|
4691
|
-
process.stdout.write(`@backtest-kit/cli ${"13.
|
|
4691
|
+
process.stdout.write(`@backtest-kit/cli ${"13.3.0"}\n`);
|
|
4692
4692
|
process.exit(0);
|
|
4693
4693
|
};
|
|
4694
4694
|
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
|
+
};
|