@backtest-kit/cli 0.0.1 → 0.0.2
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 +41 -41
- package/build/index.cjs +212 -107
- package/build/index.mjs +213 -109
- package/package.json +19 -3
- package/template/project/.gitkeep +0 -0
- package/types.d.ts +47 -13
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<img src="https://github.com/tripolskypetr/backtest-kit/raw/refs/heads/master/assets/square_compasses.svg" height="45px" align="right">
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# 📟 @backtest-kit/cli
|
|
4
4
|
|
|
5
5
|
> Zero-boilerplate CLI for launching backtests, paper trading, and live trading. Run any backtest-kit strategy from the command line — no setup code required.
|
|
6
6
|
|
|
@@ -30,13 +30,13 @@ Point the CLI at your strategy file, choose a mode, and it handles exchange conn
|
|
|
30
30
|
|
|
31
31
|
`@backtest-kit/cli` wraps the `backtest-kit` engine and resolves all scaffolding automatically:
|
|
32
32
|
|
|
33
|
-
| Mode
|
|
34
|
-
|
|
35
|
-
| **Backtest**
|
|
36
|
-
| **Paper**
|
|
37
|
-
| **Live**
|
|
38
|
-
| **UI Dashboard** | `--ui`
|
|
39
|
-
| **Telegram**
|
|
33
|
+
| Mode | Flag | Description |
|
|
34
|
+
|------------------|---------------|----------------------------------------------|
|
|
35
|
+
| **Backtest** | `--backtest` | Run strategy on historical candle data |
|
|
36
|
+
| **Paper** | `--paper` | Live prices, no real orders |
|
|
37
|
+
| **Live** | `--live` | Real trades via exchange API |
|
|
38
|
+
| **UI Dashboard** | `--ui` | Web dashboard at `http://localhost:60050` |
|
|
39
|
+
| **Telegram** | `--telegram` | Trade notifications with price charts |
|
|
40
40
|
|
|
41
41
|
## 🚀 Installation
|
|
42
42
|
|
|
@@ -129,19 +129,19 @@ npm start -- --symbol BTCUSDT --ui
|
|
|
129
129
|
|
|
130
130
|
## 🎛️ CLI Flags
|
|
131
131
|
|
|
132
|
-
| Flag
|
|
133
|
-
|
|
134
|
-
| `--backtest`
|
|
135
|
-
| `--paper`
|
|
136
|
-
| `--live`
|
|
137
|
-
| `--ui`
|
|
138
|
-
| `--telegram`
|
|
139
|
-
| `--verbose`
|
|
140
|
-
| `--symbol`
|
|
141
|
-
| `--strategy`
|
|
142
|
-
| `--exchange`
|
|
143
|
-
| `--frame`
|
|
144
|
-
| `--cache`
|
|
132
|
+
| Flag | Type | Default | Description |
|
|
133
|
+
|---------------|---------|----------------------|-------------------------------------------|
|
|
134
|
+
| `--backtest` | boolean | `false` | Run historical backtest |
|
|
135
|
+
| `--paper` | boolean | `false` | Paper trading (live prices, no orders) |
|
|
136
|
+
| `--live` | boolean | `false` | Run live trading |
|
|
137
|
+
| `--ui` | boolean | `false` | Start web UI dashboard |
|
|
138
|
+
| `--telegram` | boolean | `false` | Enable Telegram notifications |
|
|
139
|
+
| `--verbose` | boolean | `false` | Log each candle fetch |
|
|
140
|
+
| `--symbol` | string | `"BTCUSDT"` | Trading pair |
|
|
141
|
+
| `--strategy` | string | first registered | Strategy name |
|
|
142
|
+
| `--exchange` | string | first registered | Exchange name |
|
|
143
|
+
| `--frame` | string | first registered | Backtest frame name |
|
|
144
|
+
| `--cache` | string | `"1m, 15m, 30m, 4h"` | Intervals to pre-cache before backtest |
|
|
145
145
|
|
|
146
146
|
**Positional argument (required):** path to your strategy entry point file (set once in `package.json` scripts).
|
|
147
147
|
|
|
@@ -263,13 +263,13 @@ npm run backtest:dec
|
|
|
263
263
|
|
|
264
264
|
### Isolated Resources Per Strategy
|
|
265
265
|
|
|
266
|
-
| Resource
|
|
267
|
-
|
|
268
|
-
| Candle cache
|
|
269
|
-
| Backtest reports
|
|
270
|
-
| Live module
|
|
271
|
-
| Telegram templates
|
|
272
|
-
| Environment variables | `./.env` (overrides root)
|
|
266
|
+
| Resource | Path (relative to strategy dir) | Isolated |
|
|
267
|
+
|---------------------|-----------------------------------|------------------|
|
|
268
|
+
| Candle cache | `./dump/data/candle/` | ✅ per-strategy |
|
|
269
|
+
| Backtest reports | `./dump/` | ✅ per-strategy |
|
|
270
|
+
| Live module | `./modules/live.module.mjs` | ✅ per-strategy |
|
|
271
|
+
| Telegram templates | `./template/*.mustache` | ✅ per-strategy |
|
|
272
|
+
| Environment variables | `./.env` (overrides root) | ✅ per-strategy |
|
|
273
273
|
|
|
274
274
|
Each strategy run produces its own `dump/` directory, making it straightforward to compare results across time periods — both by inspection and by pointing an AI agent at a specific strategy folder.
|
|
275
275
|
|
|
@@ -372,24 +372,24 @@ CC_WWWROOT_PORT=60050
|
|
|
372
372
|
CC_QUICKCHART_HOST=
|
|
373
373
|
```
|
|
374
374
|
|
|
375
|
-
| Variable
|
|
376
|
-
|
|
377
|
-
| `CC_TELEGRAM_TOKEN`
|
|
378
|
-
| `CC_TELEGRAM_CHANNEL`
|
|
379
|
-
| `CC_WWWROOT_HOST`
|
|
380
|
-
| `CC_WWWROOT_PORT`
|
|
381
|
-
| `CC_QUICKCHART_HOST`
|
|
375
|
+
| Variable | Default | Description |
|
|
376
|
+
|------------------------|-------------|---------------------------------------|
|
|
377
|
+
| `CC_TELEGRAM_TOKEN` | — | Telegram bot token (from @BotFather) |
|
|
378
|
+
| `CC_TELEGRAM_CHANNEL` | — | Telegram channel or chat ID |
|
|
379
|
+
| `CC_WWWROOT_HOST` | `0.0.0.0` | UI server bind address |
|
|
380
|
+
| `CC_WWWROOT_PORT` | `60050` | UI server port |
|
|
381
|
+
| `CC_QUICKCHART_HOST` | — | Self-hosted QuickChart instance URL |
|
|
382
382
|
|
|
383
383
|
## ⚙️ Default Behaviors
|
|
384
384
|
|
|
385
385
|
When your strategy module does not register an exchange, frame, or strategy name, the CLI falls back to built-in defaults and prints a console warning:
|
|
386
386
|
|
|
387
|
-
| Component
|
|
388
|
-
|
|
389
|
-
| **Exchange** | CCXT Binance (`default_exchange`) | `Warning: The default exchange schema is set to CCXT Binance...`
|
|
390
|
-
| **Frame**
|
|
391
|
-
| **Symbol**
|
|
392
|
-
| **Cache intervals** | `1m, 15m, 30m, 4h`
|
|
387
|
+
| Component | Default | Warning |
|
|
388
|
+
|--------------|--------------------------------|---------------------------------------------------------------------------|
|
|
389
|
+
| **Exchange** | CCXT Binance (`default_exchange`) | `Warning: The default exchange schema is set to CCXT Binance...` |
|
|
390
|
+
| **Frame** | February 2024 (`default_frame`) | `Warning: The default frame schema is set to February 2024...` |
|
|
391
|
+
| **Symbol** | `BTCUSDT` | — |
|
|
392
|
+
| **Cache intervals** | `1m, 15m, 30m, 4h` | Shown if `--cache` not provided |
|
|
393
393
|
|
|
394
394
|
> **Note:** The default exchange schema **does not support order book fetching in backtest mode**. If your strategy calls `getOrderBook()` during backtest, you must register a custom exchange schema with your own snapshot storage.
|
|
395
395
|
|