@backtest-kit/cli 8.4.2 → 8.4.3
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 +1615 -1615
- package/build/index.cjs +185 -185
- package/build/index.mjs +185 -185
- 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 +44 -32
- package/docker/package.json +38 -38
- 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
|
@@ -3014,10 +3014,10 @@ init();
|
|
|
3014
3014
|
|
|
3015
3015
|
const MODES = ["backtest", "walker", "paper", "live", "pine", "editor", "dump", "pnldebug", "brokerdebug", "flush", "init", "docker", "help", "version"];
|
|
3016
3016
|
const ENTRY_PATH$1 = "./node_modules/@backtest-kit/cli/build/index.mjs";
|
|
3017
|
-
const HELP_TEXT$1 = `
|
|
3018
|
-
Example:
|
|
3019
|
-
|
|
3020
|
-
node ${ENTRY_PATH$1} --help
|
|
3017
|
+
const HELP_TEXT$1 = `
|
|
3018
|
+
Example:
|
|
3019
|
+
|
|
3020
|
+
node ${ENTRY_PATH$1} --help
|
|
3021
3021
|
`.trimStart();
|
|
3022
3022
|
const main$f = async () => {
|
|
3023
3023
|
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)))) {
|
|
@@ -3027,7 +3027,7 @@ const main$f = async () => {
|
|
|
3027
3027
|
if (MODES.some((mode) => values[mode])) {
|
|
3028
3028
|
return;
|
|
3029
3029
|
}
|
|
3030
|
-
process.stdout.write(`@backtest-kit/cli ${"8.4.
|
|
3030
|
+
process.stdout.write(`@backtest-kit/cli ${"8.4.3"}\n`);
|
|
3031
3031
|
process.stdout.write("\n");
|
|
3032
3032
|
process.stdout.write(`Run with --help to see available commands.\n`);
|
|
3033
3033
|
process.stdout.write("\n");
|
|
@@ -3715,190 +3715,190 @@ const main$2 = async () => {
|
|
|
3715
3715
|
console.log(`Done! Docker workspace created at ${projectPath}`);
|
|
3716
3716
|
console.log(`Next steps:`);
|
|
3717
3717
|
console.log(` cd ${projectName}`);
|
|
3718
|
-
console.log(` docker compose up -d`);
|
|
3718
|
+
console.log(` MODE=live SYMBOL=TRXUSDT UI=1 docker compose up -d`);
|
|
3719
3719
|
console.log(` docker compose logs -f`);
|
|
3720
3720
|
process.exit(0);
|
|
3721
3721
|
};
|
|
3722
3722
|
main$2();
|
|
3723
3723
|
|
|
3724
3724
|
const ENTRY_PATH = "./node_modules/@backtest-kit/cli/build/index.mjs";
|
|
3725
|
-
const HELP_TEXT = `
|
|
3726
|
-
Usage:
|
|
3727
|
-
node index.mjs --<mode> [flags] [entry-point]
|
|
3728
|
-
|
|
3729
|
-
Modes:
|
|
3730
|
-
|
|
3731
|
-
--backtest <entry> Run strategy against historical candle data
|
|
3732
|
-
--walker <entry...> Run Walker A/B strategy comparison across multiple strategies
|
|
3733
|
-
--paper <entry> Paper trading (live prices, no real orders)
|
|
3734
|
-
--live <entry> Live trading with real orders
|
|
3735
|
-
--pine <entry> Execute a local .pine indicator file
|
|
3736
|
-
--editor Open the Pine Script visual editor in the browser
|
|
3737
|
-
--dump Fetch and save raw OHLCV candles
|
|
3738
|
-
--pnldebug Simulate PnL per minute for a given entry price and direction
|
|
3739
|
-
--brokerdebug Fire a single broker commit against the live broker adapter
|
|
3740
|
-
--flush <entry...> Delete report/log/markdown/agent folders from strategy dump dir
|
|
3741
|
-
--init Scaffold a new project in the current directory
|
|
3742
|
-
--docker Scaffold a Docker workspace for running strategies in a container
|
|
3743
|
-
--help Print this help message
|
|
3744
|
-
|
|
3745
|
-
Backtest flags:
|
|
3746
|
-
|
|
3747
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3748
|
-
--strategy <string> Strategy name from addStrategySchema (default: first registered)
|
|
3749
|
-
--exchange <string> Exchange name from addExchangeSchema (default: first registered)
|
|
3750
|
-
--frame <string> Frame name from addFrameSchema (default: first registered)
|
|
3751
|
-
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
3752
|
-
--noCache Skip candle cache warming before the run
|
|
3753
|
-
--noFlush Skip removing report/log/markdown/agent folders before backtest run
|
|
3754
|
-
--verbose Log every candle fetch to stdout
|
|
3755
|
-
--ui Start web dashboard at http://localhost:60050
|
|
3756
|
-
--telegram Send trade notifications to Telegram
|
|
3757
|
-
|
|
3758
|
-
Walker flags (--walker):
|
|
3759
|
-
|
|
3760
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3761
|
-
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
3762
|
-
--noCache Skip candle cache warming before the run
|
|
3763
|
-
--noFlush Skip removing report/log/markdown/agent folders before walker run
|
|
3764
|
-
--verbose Log every candle fetch to stdout
|
|
3765
|
-
--output <string> Output file base name (default: walker_{SYMBOL}_{TIMESTAMP})
|
|
3766
|
-
--json Save results as JSON to ./dump/<output>.json
|
|
3767
|
-
--markdown Save report as Markdown to ./dump/<output>.md
|
|
3768
|
-
|
|
3769
|
-
Each positional argument is a strategy entry point. All strategy files are loaded without
|
|
3770
|
-
changing process.cwd() — .env is read from the working directory only.
|
|
3771
|
-
addWalkerSchema is called automatically using the registered exchange and frame.
|
|
3772
|
-
After comparison completes the report is printed to stdout (or saved if --json/--markdown).
|
|
3773
|
-
|
|
3774
|
-
Module file ./modules/walker.module is loaded automatically if it exists.
|
|
3775
|
-
|
|
3776
|
-
Paper / Live flags:
|
|
3777
|
-
|
|
3778
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3779
|
-
--strategy <string> Strategy name (default: first registered)
|
|
3780
|
-
--exchange <string> Exchange name (default: first registered)
|
|
3781
|
-
--verbose Log every candle fetch to stdout
|
|
3782
|
-
--ui Start web dashboard
|
|
3783
|
-
--telegram Send Telegram notifications
|
|
3784
|
-
|
|
3785
|
-
PineScript flags (--pine):
|
|
3786
|
-
|
|
3787
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3788
|
-
--timeframe <string> Candle interval (default: 15m)
|
|
3789
|
-
--limit <string> Number of candles to fetch (default: 250)
|
|
3790
|
-
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
3791
|
-
--exchange <string> Exchange name (default: first registered)
|
|
3792
|
-
--output <string> Output file base name without extension
|
|
3793
|
-
--json Save output as JSON array to <pine-dir>/dump/<output>.json
|
|
3794
|
-
--jsonl Save output as JSONL to <pine-dir>/dump/<output>.jsonl
|
|
3795
|
-
--markdown Save output as Markdown table to <pine-dir>/dump/<output>.md
|
|
3796
|
-
|
|
3797
|
-
Only plot() calls with display=display.data_window produce output columns.
|
|
3798
|
-
Module file ./modules/pine.module is loaded automatically if it exists.
|
|
3799
|
-
|
|
3800
|
-
Candle dump flags (--dump):
|
|
3801
|
-
|
|
3802
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3803
|
-
--timeframe <string> Candle interval (default: 15m)
|
|
3804
|
-
--limit <string> Number of candles (default: 250)
|
|
3805
|
-
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
3806
|
-
--exchange <string> Exchange name (default: first registered)
|
|
3807
|
-
--output <string> Output file base name (default: {SYMBOL}_{LIMIT}_{TIMEFRAME}_{TIMESTAMP})
|
|
3808
|
-
--json Save as JSON array to ./dump/<output>.json
|
|
3809
|
-
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
3810
|
-
|
|
3811
|
-
Module file ./modules/dump.module is loaded automatically if it exists.
|
|
3812
|
-
|
|
3813
|
-
PnL debug flags (--pnldebug):
|
|
3814
|
-
|
|
3815
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3816
|
-
--priceopen <number> Entry price (required)
|
|
3817
|
-
--direction <string> Position direction: long or short (default: long)
|
|
3818
|
-
--when <string> Start timestamp — ISO 8601 or Unix ms (default: now)
|
|
3819
|
-
--minutes <string> Number of 1m candles to simulate (default: 60)
|
|
3820
|
-
--exchange <string> Exchange name (default: first registered)
|
|
3821
|
-
--output <string> Output file base name (default: {SYMBOL}_{DIRECTION}_{PRICEOPEN}_{TIMESTAMP})
|
|
3822
|
-
--json Save as JSON array to ./dump/<output>.json
|
|
3823
|
-
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
3824
|
-
--markdown Save as Markdown table to ./dump/<output>.md
|
|
3825
|
-
|
|
3826
|
-
Module file ./modules/pnldebug.module is loaded automatically if it exists.
|
|
3827
|
-
|
|
3828
|
-
Broker debug flags (--brokerdebug):
|
|
3829
|
-
|
|
3830
|
-
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3831
|
-
--exchange <string> Exchange name (default: first registered)
|
|
3832
|
-
--commit <string> Commit type to fire: signal-open, signal-close, partial-profit,
|
|
3833
|
-
partial-loss, average-buy, trailing-stop, trailing-take, breakeven
|
|
3834
|
-
(default: signal-open)
|
|
3835
|
-
|
|
3836
|
-
Loads ./live.module, fetches the last candle for --symbol/--timeframe, and calls
|
|
3837
|
-
the selected broker commit with synthetic payload values derived from current price.
|
|
3838
|
-
|
|
3839
|
-
Flush flags (--flush):
|
|
3840
|
-
|
|
3841
|
-
One or more positional entry points. For each entry point the following
|
|
3842
|
-
subdirectories are removed from <entry-dir>/dump/:
|
|
3843
|
-
|
|
3844
|
-
report log markdown agent
|
|
3845
|
-
|
|
3846
|
-
Init flags (--init):
|
|
3847
|
-
|
|
3848
|
-
--output <string> Target directory name (default: backtest-kit-project)
|
|
3849
|
-
|
|
3850
|
-
Scaffolds a project and runs scripts/fetch_docs.mjs to download library docs.
|
|
3851
|
-
|
|
3852
|
-
Docker flags (--docker):
|
|
3853
|
-
|
|
3854
|
-
--output <string> Target directory name (default: backtest-kit-docker)
|
|
3855
|
-
|
|
3856
|
-
Scaffolds a Docker workspace: docker-compose.yaml, .env.example, package.json,
|
|
3857
|
-
tsconfig.json, and a sample strategy under content/. Run npm install then
|
|
3858
|
-
docker compose up to start the container.
|
|
3859
|
-
|
|
3860
|
-
Module hooks (loaded automatically by each mode):
|
|
3861
|
-
|
|
3862
|
-
modules/backtest.module --backtest Broker adapter for backtest
|
|
3863
|
-
modules/walker.module --walker Broker adapter for walker comparison
|
|
3864
|
-
modules/paper.module --paper Broker adapter for paper trading
|
|
3865
|
-
modules/live.module --live Broker adapter for live trading
|
|
3866
|
-
modules/pine.module --pine Exchange schema for PineScript runs
|
|
3867
|
-
modules/editor.module --editor Exchange schema for the visual Pine editor
|
|
3868
|
-
modules/dump.module --dump Exchange schema for candle dumps
|
|
3869
|
-
modules/pnldebug.module --pnldebug Exchange schema for PnL debug runs
|
|
3870
|
-
modules/brokerdebug.module --brokerdebug Broker adapter used for broker commit testing
|
|
3871
|
-
|
|
3872
|
-
--flush has no associated module. It only removes dump subdirectories.
|
|
3873
|
-
|
|
3874
|
-
Extensions .ts, .mjs, .cjs are tried automatically. Missing module = soft warning.
|
|
3875
|
-
|
|
3876
|
-
Environment variables:
|
|
3877
|
-
|
|
3878
|
-
CC_TELEGRAM_TOKEN Telegram bot token (required for --telegram)
|
|
3879
|
-
CC_TELEGRAM_CHANNEL Telegram channel or chat ID (required for --telegram)
|
|
3880
|
-
CC_WWWROOT_HOST UI server bind address (default: 0.0.0.0)
|
|
3881
|
-
CC_WWWROOT_PORT UI server port (default: 60050)
|
|
3882
|
-
|
|
3883
|
-
Examples:
|
|
3884
|
-
|
|
3885
|
-
node ${ENTRY_PATH} --backtest ./content/feb_2026.strategy.ts
|
|
3886
|
-
node ${ENTRY_PATH} --backtest --symbol BTCUSDT --noCache --noFlush --ui ./content/feb_2026.strategy.ts
|
|
3887
|
-
node ${ENTRY_PATH} --walker ./content/feb_2026_v1.strategy.ts ./content/feb_2026_v2.strategy.ts ./content/feb_2026_v3.strategy.ts
|
|
3888
|
-
node ${ENTRY_PATH} --walker --symbol BTCUSDT --noCache --noFlush --markdown ./content/feb_2026_v1.ts ./content/feb_2026_v2.ts
|
|
3889
|
-
node ${ENTRY_PATH} --paper --symbol ETHUSDT ./content/feb_2026.strategy.ts
|
|
3890
|
-
node ${ENTRY_PATH} --live --ui --telegram ./content/feb_2026.strategy.ts
|
|
3891
|
-
node ${ENTRY_PATH} --pine ./math/feb_2026.pine --timeframe 15m --limit 500 --jsonl
|
|
3892
|
-
node ${ENTRY_PATH} --editor
|
|
3893
|
-
node ${ENTRY_PATH} --dump --symbol BTCUSDT --timeframe 15m --limit 500 --jsonl
|
|
3894
|
-
node ${ENTRY_PATH} --pnldebug --symbol BTCUSDT --priceopen 64069.50 --direction short --when "2025-02-25" --minutes 120
|
|
3895
|
-
node ${ENTRY_PATH} --pnldebug --priceopen 67956.73 --direction long --when 1772064000000 --minutes 60 --markdown
|
|
3896
|
-
node ${ENTRY_PATH} --brokerdebug --commit signal-open --symbol BTCUSDT
|
|
3897
|
-
node ${ENTRY_PATH} --brokerdebug --commit partial-profit --symbol ETHUSDT
|
|
3898
|
-
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts
|
|
3899
|
-
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts ./content/feb_2026.strategy/feb_2026.test.ts
|
|
3900
|
-
node ${ENTRY_PATH} --init --output my-trading-bot
|
|
3901
|
-
node ${ENTRY_PATH} --docker --output my-docker-workspace
|
|
3725
|
+
const HELP_TEXT = `
|
|
3726
|
+
Usage:
|
|
3727
|
+
node index.mjs --<mode> [flags] [entry-point]
|
|
3728
|
+
|
|
3729
|
+
Modes:
|
|
3730
|
+
|
|
3731
|
+
--backtest <entry> Run strategy against historical candle data
|
|
3732
|
+
--walker <entry...> Run Walker A/B strategy comparison across multiple strategies
|
|
3733
|
+
--paper <entry> Paper trading (live prices, no real orders)
|
|
3734
|
+
--live <entry> Live trading with real orders
|
|
3735
|
+
--pine <entry> Execute a local .pine indicator file
|
|
3736
|
+
--editor Open the Pine Script visual editor in the browser
|
|
3737
|
+
--dump Fetch and save raw OHLCV candles
|
|
3738
|
+
--pnldebug Simulate PnL per minute for a given entry price and direction
|
|
3739
|
+
--brokerdebug Fire a single broker commit against the live broker adapter
|
|
3740
|
+
--flush <entry...> Delete report/log/markdown/agent folders from strategy dump dir
|
|
3741
|
+
--init Scaffold a new project in the current directory
|
|
3742
|
+
--docker Scaffold a Docker workspace for running strategies in a container
|
|
3743
|
+
--help Print this help message
|
|
3744
|
+
|
|
3745
|
+
Backtest flags:
|
|
3746
|
+
|
|
3747
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3748
|
+
--strategy <string> Strategy name from addStrategySchema (default: first registered)
|
|
3749
|
+
--exchange <string> Exchange name from addExchangeSchema (default: first registered)
|
|
3750
|
+
--frame <string> Frame name from addFrameSchema (default: first registered)
|
|
3751
|
+
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
3752
|
+
--noCache Skip candle cache warming before the run
|
|
3753
|
+
--noFlush Skip removing report/log/markdown/agent folders before backtest run
|
|
3754
|
+
--verbose Log every candle fetch to stdout
|
|
3755
|
+
--ui Start web dashboard at http://localhost:60050
|
|
3756
|
+
--telegram Send trade notifications to Telegram
|
|
3757
|
+
|
|
3758
|
+
Walker flags (--walker):
|
|
3759
|
+
|
|
3760
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3761
|
+
--cacheInterval <string> Comma-separated intervals to pre-cache (default: "1m, 15m, 30m, 4h")
|
|
3762
|
+
--noCache Skip candle cache warming before the run
|
|
3763
|
+
--noFlush Skip removing report/log/markdown/agent folders before walker run
|
|
3764
|
+
--verbose Log every candle fetch to stdout
|
|
3765
|
+
--output <string> Output file base name (default: walker_{SYMBOL}_{TIMESTAMP})
|
|
3766
|
+
--json Save results as JSON to ./dump/<output>.json
|
|
3767
|
+
--markdown Save report as Markdown to ./dump/<output>.md
|
|
3768
|
+
|
|
3769
|
+
Each positional argument is a strategy entry point. All strategy files are loaded without
|
|
3770
|
+
changing process.cwd() — .env is read from the working directory only.
|
|
3771
|
+
addWalkerSchema is called automatically using the registered exchange and frame.
|
|
3772
|
+
After comparison completes the report is printed to stdout (or saved if --json/--markdown).
|
|
3773
|
+
|
|
3774
|
+
Module file ./modules/walker.module is loaded automatically if it exists.
|
|
3775
|
+
|
|
3776
|
+
Paper / Live flags:
|
|
3777
|
+
|
|
3778
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3779
|
+
--strategy <string> Strategy name (default: first registered)
|
|
3780
|
+
--exchange <string> Exchange name (default: first registered)
|
|
3781
|
+
--verbose Log every candle fetch to stdout
|
|
3782
|
+
--ui Start web dashboard
|
|
3783
|
+
--telegram Send Telegram notifications
|
|
3784
|
+
|
|
3785
|
+
PineScript flags (--pine):
|
|
3786
|
+
|
|
3787
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3788
|
+
--timeframe <string> Candle interval (default: 15m)
|
|
3789
|
+
--limit <string> Number of candles to fetch (default: 250)
|
|
3790
|
+
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
3791
|
+
--exchange <string> Exchange name (default: first registered)
|
|
3792
|
+
--output <string> Output file base name without extension
|
|
3793
|
+
--json Save output as JSON array to <pine-dir>/dump/<output>.json
|
|
3794
|
+
--jsonl Save output as JSONL to <pine-dir>/dump/<output>.jsonl
|
|
3795
|
+
--markdown Save output as Markdown table to <pine-dir>/dump/<output>.md
|
|
3796
|
+
|
|
3797
|
+
Only plot() calls with display=display.data_window produce output columns.
|
|
3798
|
+
Module file ./modules/pine.module is loaded automatically if it exists.
|
|
3799
|
+
|
|
3800
|
+
Candle dump flags (--dump):
|
|
3801
|
+
|
|
3802
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3803
|
+
--timeframe <string> Candle interval (default: 15m)
|
|
3804
|
+
--limit <string> Number of candles (default: 250)
|
|
3805
|
+
--when <string> End date — ISO 8601 or Unix ms (default: now)
|
|
3806
|
+
--exchange <string> Exchange name (default: first registered)
|
|
3807
|
+
--output <string> Output file base name (default: {SYMBOL}_{LIMIT}_{TIMEFRAME}_{TIMESTAMP})
|
|
3808
|
+
--json Save as JSON array to ./dump/<output>.json
|
|
3809
|
+
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
3810
|
+
|
|
3811
|
+
Module file ./modules/dump.module is loaded automatically if it exists.
|
|
3812
|
+
|
|
3813
|
+
PnL debug flags (--pnldebug):
|
|
3814
|
+
|
|
3815
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3816
|
+
--priceopen <number> Entry price (required)
|
|
3817
|
+
--direction <string> Position direction: long or short (default: long)
|
|
3818
|
+
--when <string> Start timestamp — ISO 8601 or Unix ms (default: now)
|
|
3819
|
+
--minutes <string> Number of 1m candles to simulate (default: 60)
|
|
3820
|
+
--exchange <string> Exchange name (default: first registered)
|
|
3821
|
+
--output <string> Output file base name (default: {SYMBOL}_{DIRECTION}_{PRICEOPEN}_{TIMESTAMP})
|
|
3822
|
+
--json Save as JSON array to ./dump/<output>.json
|
|
3823
|
+
--jsonl Save as JSONL to ./dump/<output>.jsonl
|
|
3824
|
+
--markdown Save as Markdown table to ./dump/<output>.md
|
|
3825
|
+
|
|
3826
|
+
Module file ./modules/pnldebug.module is loaded automatically if it exists.
|
|
3827
|
+
|
|
3828
|
+
Broker debug flags (--brokerdebug):
|
|
3829
|
+
|
|
3830
|
+
--symbol <string> Trading pair (default: BTCUSDT)
|
|
3831
|
+
--exchange <string> Exchange name (default: first registered)
|
|
3832
|
+
--commit <string> Commit type to fire: signal-open, signal-close, partial-profit,
|
|
3833
|
+
partial-loss, average-buy, trailing-stop, trailing-take, breakeven
|
|
3834
|
+
(default: signal-open)
|
|
3835
|
+
|
|
3836
|
+
Loads ./live.module, fetches the last candle for --symbol/--timeframe, and calls
|
|
3837
|
+
the selected broker commit with synthetic payload values derived from current price.
|
|
3838
|
+
|
|
3839
|
+
Flush flags (--flush):
|
|
3840
|
+
|
|
3841
|
+
One or more positional entry points. For each entry point the following
|
|
3842
|
+
subdirectories are removed from <entry-dir>/dump/:
|
|
3843
|
+
|
|
3844
|
+
report log markdown agent
|
|
3845
|
+
|
|
3846
|
+
Init flags (--init):
|
|
3847
|
+
|
|
3848
|
+
--output <string> Target directory name (default: backtest-kit-project)
|
|
3849
|
+
|
|
3850
|
+
Scaffolds a project and runs scripts/fetch_docs.mjs to download library docs.
|
|
3851
|
+
|
|
3852
|
+
Docker flags (--docker):
|
|
3853
|
+
|
|
3854
|
+
--output <string> Target directory name (default: backtest-kit-docker)
|
|
3855
|
+
|
|
3856
|
+
Scaffolds a Docker workspace: docker-compose.yaml, .env.example, package.json,
|
|
3857
|
+
tsconfig.json, and a sample strategy under content/. Run npm install then
|
|
3858
|
+
docker compose up to start the container.
|
|
3859
|
+
|
|
3860
|
+
Module hooks (loaded automatically by each mode):
|
|
3861
|
+
|
|
3862
|
+
modules/backtest.module --backtest Broker adapter for backtest
|
|
3863
|
+
modules/walker.module --walker Broker adapter for walker comparison
|
|
3864
|
+
modules/paper.module --paper Broker adapter for paper trading
|
|
3865
|
+
modules/live.module --live Broker adapter for live trading
|
|
3866
|
+
modules/pine.module --pine Exchange schema for PineScript runs
|
|
3867
|
+
modules/editor.module --editor Exchange schema for the visual Pine editor
|
|
3868
|
+
modules/dump.module --dump Exchange schema for candle dumps
|
|
3869
|
+
modules/pnldebug.module --pnldebug Exchange schema for PnL debug runs
|
|
3870
|
+
modules/brokerdebug.module --brokerdebug Broker adapter used for broker commit testing
|
|
3871
|
+
|
|
3872
|
+
--flush has no associated module. It only removes dump subdirectories.
|
|
3873
|
+
|
|
3874
|
+
Extensions .ts, .mjs, .cjs are tried automatically. Missing module = soft warning.
|
|
3875
|
+
|
|
3876
|
+
Environment variables:
|
|
3877
|
+
|
|
3878
|
+
CC_TELEGRAM_TOKEN Telegram bot token (required for --telegram)
|
|
3879
|
+
CC_TELEGRAM_CHANNEL Telegram channel or chat ID (required for --telegram)
|
|
3880
|
+
CC_WWWROOT_HOST UI server bind address (default: 0.0.0.0)
|
|
3881
|
+
CC_WWWROOT_PORT UI server port (default: 60050)
|
|
3882
|
+
|
|
3883
|
+
Examples:
|
|
3884
|
+
|
|
3885
|
+
node ${ENTRY_PATH} --backtest ./content/feb_2026.strategy.ts
|
|
3886
|
+
node ${ENTRY_PATH} --backtest --symbol BTCUSDT --noCache --noFlush --ui ./content/feb_2026.strategy.ts
|
|
3887
|
+
node ${ENTRY_PATH} --walker ./content/feb_2026_v1.strategy.ts ./content/feb_2026_v2.strategy.ts ./content/feb_2026_v3.strategy.ts
|
|
3888
|
+
node ${ENTRY_PATH} --walker --symbol BTCUSDT --noCache --noFlush --markdown ./content/feb_2026_v1.ts ./content/feb_2026_v2.ts
|
|
3889
|
+
node ${ENTRY_PATH} --paper --symbol ETHUSDT ./content/feb_2026.strategy.ts
|
|
3890
|
+
node ${ENTRY_PATH} --live --ui --telegram ./content/feb_2026.strategy.ts
|
|
3891
|
+
node ${ENTRY_PATH} --pine ./math/feb_2026.pine --timeframe 15m --limit 500 --jsonl
|
|
3892
|
+
node ${ENTRY_PATH} --editor
|
|
3893
|
+
node ${ENTRY_PATH} --dump --symbol BTCUSDT --timeframe 15m --limit 500 --jsonl
|
|
3894
|
+
node ${ENTRY_PATH} --pnldebug --symbol BTCUSDT --priceopen 64069.50 --direction short --when "2025-02-25" --minutes 120
|
|
3895
|
+
node ${ENTRY_PATH} --pnldebug --priceopen 67956.73 --direction long --when 1772064000000 --minutes 60 --markdown
|
|
3896
|
+
node ${ENTRY_PATH} --brokerdebug --commit signal-open --symbol BTCUSDT
|
|
3897
|
+
node ${ENTRY_PATH} --brokerdebug --commit partial-profit --symbol ETHUSDT
|
|
3898
|
+
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts
|
|
3899
|
+
node ${ENTRY_PATH} --flush ./content/feb_2026.strategy/feb_2026.strategy.ts ./content/feb_2026.strategy/feb_2026.test.ts
|
|
3900
|
+
node ${ENTRY_PATH} --init --output my-trading-bot
|
|
3901
|
+
node ${ENTRY_PATH} --docker --output my-docker-workspace
|
|
3902
3902
|
`.trimStart();
|
|
3903
3903
|
const main$1 = async () => {
|
|
3904
3904
|
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)))) {
|
|
@@ -3908,7 +3908,7 @@ const main$1 = async () => {
|
|
|
3908
3908
|
if (!values.help) {
|
|
3909
3909
|
return;
|
|
3910
3910
|
}
|
|
3911
|
-
process.stdout.write(`@backtest-kit/cli ${"8.4.
|
|
3911
|
+
process.stdout.write(`@backtest-kit/cli ${"8.4.3"}\n\n`);
|
|
3912
3912
|
process.stdout.write(HELP_TEXT);
|
|
3913
3913
|
process.exit(0);
|
|
3914
3914
|
};
|
|
@@ -3922,7 +3922,7 @@ const main = async () => {
|
|
|
3922
3922
|
if (!values.version) {
|
|
3923
3923
|
return;
|
|
3924
3924
|
}
|
|
3925
|
-
process.stdout.write(`@backtest-kit/cli ${"8.4.
|
|
3925
|
+
process.stdout.write(`@backtest-kit/cli ${"8.4.3"}\n`);
|
|
3926
3926
|
process.exit(0);
|
|
3927
3927
|
};
|
|
3928
3928
|
main();
|