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