@backtest-kit/cli 6.1.4 → 6.2.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 +60 -1
- package/build/index.cjs +399 -145
- package/build/index.mjs +400 -146
- package/package.json +13 -13
- package/template/project/README.md +29 -0
- package/template/project/package.mustache +5 -5
- package/types.d.ts +22 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtest-kit/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Zero-boilerplate CLI runner for backtest-kit strategies. Run backtests, paper trading, and live bots with candle cache warming, web dashboard, and Telegram notifications — no setup code required.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Petr Tripolsky",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@babel/plugin-transform-modules-umd": "7.27.1",
|
|
63
63
|
"@babel/standalone": "7.29.1",
|
|
64
|
-
"@backtest-kit/ui": "6.
|
|
65
|
-
"@backtest-kit/graph": "6.
|
|
66
|
-
"@backtest-kit/ollama": "6.
|
|
67
|
-
"@backtest-kit/pinets": "6.
|
|
68
|
-
"@backtest-kit/signals": "6.
|
|
64
|
+
"@backtest-kit/ui": "6.2.0",
|
|
65
|
+
"@backtest-kit/graph": "6.2.0",
|
|
66
|
+
"@backtest-kit/ollama": "6.2.0",
|
|
67
|
+
"@backtest-kit/pinets": "6.2.0",
|
|
68
|
+
"@backtest-kit/signals": "6.2.0",
|
|
69
69
|
"@rollup/plugin-replace": "6.0.3",
|
|
70
70
|
"@rollup/plugin-typescript": "11.1.6",
|
|
71
71
|
"@types/image-size": "0.7.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@types/mustache": "4.2.6",
|
|
74
74
|
"@types/node": "22.9.0",
|
|
75
75
|
"@types/stack-trace": "0.0.33",
|
|
76
|
-
"backtest-kit": "6.
|
|
76
|
+
"backtest-kit": "6.2.0",
|
|
77
77
|
"glob": "11.0.1",
|
|
78
78
|
"markdown-it": "14.1.1",
|
|
79
79
|
"rimraf": "6.0.1",
|
|
@@ -88,12 +88,12 @@
|
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@babel/plugin-transform-modules-umd": "^7.27.1",
|
|
90
90
|
"@babel/standalone": "^7.29.1",
|
|
91
|
-
"@backtest-kit/ui": "^6.
|
|
92
|
-
"@backtest-kit/graph": "^6.
|
|
93
|
-
"@backtest-kit/ollama": "^6.
|
|
94
|
-
"@backtest-kit/pinets": "^6.
|
|
95
|
-
"@backtest-kit/signals": "^6.
|
|
96
|
-
"backtest-kit": "^6.
|
|
91
|
+
"@backtest-kit/ui": "^6.2.0",
|
|
92
|
+
"@backtest-kit/graph": "^6.2.0",
|
|
93
|
+
"@backtest-kit/ollama": "^6.2.0",
|
|
94
|
+
"@backtest-kit/pinets": "^6.2.0",
|
|
95
|
+
"@backtest-kit/signals": "^6.2.0",
|
|
96
|
+
"backtest-kit": "^6.2.0",
|
|
97
97
|
"markdown-it": "^14.1.1",
|
|
98
98
|
"typescript": "^5.0.0"
|
|
99
99
|
},
|
|
@@ -87,6 +87,34 @@ npm start -- --live --symbol BTCUSDT --ui --telegram ./content/feb_2026.strategy
|
|
|
87
87
|
|
|
88
88
|
Module file `./modules/live.module.ts` is loaded automatically if it exists. Use it to register a `Broker` adapter that intercepts every trade mutation before internal state changes — exchange rejection rolls back the operation atomically.
|
|
89
89
|
|
|
90
|
+
## 🚶 Walker — A/B Strategy Comparison (`--walker`)
|
|
91
|
+
|
|
92
|
+
Runs the same historical period across multiple strategy files and prints a ranked comparison report. Use it to pick the best variant before committing to a single strategy.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm start -- --walker --symbol BTCUSDT --noCache \
|
|
96
|
+
./content/feb_2026_v1.strategy.ts \
|
|
97
|
+
./content/feb_2026_v2.strategy.ts \
|
|
98
|
+
./content/feb_2026_v3.strategy.ts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Each positional argument is a separate strategy file. All files are loaded without changing `process.cwd()` — `.env` is always read from the project root. `addWalkerSchema` is called automatically using the exchange and frame registered by the strategy files. If no frame is registered, the CLI falls back to the last 31 days from `Date.now()` with a warning.
|
|
102
|
+
|
|
103
|
+
| Flag | Type | Default | Description |
|
|
104
|
+
|------|------|---------|-------------|
|
|
105
|
+
| `--walker` | boolean | — | Enable walker comparison mode |
|
|
106
|
+
| `--symbol` | string | `BTCUSDT` | Trading pair |
|
|
107
|
+
| `--cacheInterval` | string | `1m, 15m, 30m, 1h, 4h` | Comma-separated intervals to pre-cache |
|
|
108
|
+
| `--noCache` | boolean | `false` | Skip candle cache warming |
|
|
109
|
+
| `--verbose` | boolean | `false` | Log candle fetches and per-strategy progress |
|
|
110
|
+
| `--output` | string | `walker_{SYMBOL}_{TIMESTAMP}` | Output file base name (no extension) |
|
|
111
|
+
| `--json` | boolean | `false` | Save results as JSON to `./dump/<output>.json` |
|
|
112
|
+
| `--markdown` | boolean | `false` | Save report as Markdown to `./dump/<output>.md` |
|
|
113
|
+
|
|
114
|
+
Output file is created at `./dump/<output>.md` (or `.json`). Without `--json`/`--markdown` the report is printed to stdout.
|
|
115
|
+
|
|
116
|
+
Module file `./modules/walker.module.ts` is loaded automatically before comparison starts (shared for all strategy files in the run).
|
|
117
|
+
|
|
90
118
|
## 🌲 Running PineScript Indicators (`--pine`)
|
|
91
119
|
|
|
92
120
|
Executes a local `.pine` file against a real exchange and prints the output as a Markdown table or saves it to a file.
|
|
@@ -148,6 +176,7 @@ Module file `./modules/dump.module.ts` is loaded automatically. The project incl
|
|
|
148
176
|
| File | Loaded by mode | Purpose |
|
|
149
177
|
|------|----------------|---------|
|
|
150
178
|
| `modules/backtest.module.ts` | `--backtest` | Register a `Broker` adapter for backtest |
|
|
179
|
+
| `modules/walker.module.ts` | `--walker` | Shared config loaded before walker comparison starts |
|
|
151
180
|
| `modules/paper.module.ts` | `--paper` | Register a `Broker` adapter for paper trading |
|
|
152
181
|
| `modules/live.module.ts` | `--live` | Register a `Broker` adapter for live trading |
|
|
153
182
|
| `modules/pine.module.ts` | `--pine` | Register an exchange schema for PineScript runs |
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"type": "commonjs",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@backtest-kit/cli": "^6.
|
|
16
|
-
"@backtest-kit/graph": "^6.
|
|
17
|
-
"@backtest-kit/pinets": "^6.
|
|
18
|
-
"@backtest-kit/ui": "^6.
|
|
15
|
+
"@backtest-kit/cli": "^6.2.0",
|
|
16
|
+
"@backtest-kit/graph": "^6.2.0",
|
|
17
|
+
"@backtest-kit/pinets": "^6.2.0",
|
|
18
|
+
"@backtest-kit/ui": "^6.2.0",
|
|
19
19
|
"agent-swarm-kit": "^1.3.0",
|
|
20
|
-
"backtest-kit": "^6.
|
|
20
|
+
"backtest-kit": "^6.2.0",
|
|
21
21
|
"functools-kit": "^1.0.95",
|
|
22
22
|
"garch": "^1.2.3",
|
|
23
23
|
"get-moment-stamp": "^1.1.2",
|
package/types.d.ts
CHANGED
|
@@ -77,6 +77,26 @@ declare class BacktestMainService {
|
|
|
77
77
|
connect: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
declare class WalkerMainService {
|
|
81
|
+
private loggerService;
|
|
82
|
+
private resolveService;
|
|
83
|
+
private exchangeSchemaService;
|
|
84
|
+
private symbolSchemaService;
|
|
85
|
+
private cacheLogicService;
|
|
86
|
+
private moduleConnectionService;
|
|
87
|
+
run: ((payload: {
|
|
88
|
+
entryPoints: string[];
|
|
89
|
+
symbol: string;
|
|
90
|
+
output: string;
|
|
91
|
+
cacheInterval: CandleInterval[];
|
|
92
|
+
json: boolean;
|
|
93
|
+
markdown: boolean;
|
|
94
|
+
verbose: boolean;
|
|
95
|
+
noCache: boolean;
|
|
96
|
+
}) => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
97
|
+
connect: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
98
|
+
}
|
|
99
|
+
|
|
80
100
|
declare class ExchangeSchemaService {
|
|
81
101
|
readonly loggerService: LoggerService;
|
|
82
102
|
addSchema: (() => Promise<void>) & functools_kit.ISingleshotClearable;
|
|
@@ -104,6 +124,7 @@ declare class ResolveService {
|
|
|
104
124
|
readonly OVERRIDE_MODULES_DIR: string;
|
|
105
125
|
getIsLaunched: () => boolean;
|
|
106
126
|
attachPine: (pinePath: string) => Promise<string>;
|
|
127
|
+
attachStrategy: (jsPath: string) => Promise<void>;
|
|
107
128
|
attachJavascript: (jsPath: string) => Promise<void>;
|
|
108
129
|
}
|
|
109
130
|
|
|
@@ -232,6 +253,7 @@ declare const cli: {
|
|
|
232
253
|
cacheLogicService: CacheLogicService;
|
|
233
254
|
telegramLogicService: TelegramLogicService;
|
|
234
255
|
backtestMainService: BacktestMainService;
|
|
256
|
+
walkerMainService: WalkerMainService;
|
|
235
257
|
paperMainService: PaperMainService;
|
|
236
258
|
liveMainService: LiveMainService;
|
|
237
259
|
moduleConnectionService: ModuleConnectionService;
|