@backtest-kit/cli 16.4.0 → 16.6.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 +40 -8
- package/build/index.cjs +901 -88
- package/build/index.mjs +906 -93
- package/config/notification.config.mjs +4 -0
- package/docker/package.json +6 -6
- package/package.json +13 -13
- package/template/order-continue.mustache +17 -0
- package/template/{signal-close.mustache → order-fill-close.mustache} +1 -1
- package/template/{signal-open.mustache → order-fill-open.mustache} +2 -1
- package/template/order-reject-close.mustache +17 -0
- package/template/order-reject-open.mustache +16 -0
- package/template/order-stop.mustache +18 -0
- package/template/project/package.mustache +5 -5
- package/types.d.ts +33 -7
package/docker/package.json
CHANGED
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"@types/node": "25.6.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@backtest-kit/cli": "16.
|
|
19
|
-
"@backtest-kit/graph": "16.
|
|
20
|
-
"@backtest-kit/pinets": "16.
|
|
21
|
-
"@backtest-kit/signals": "16.
|
|
22
|
-
"@backtest-kit/ui": "16.
|
|
18
|
+
"@backtest-kit/cli": "16.6.0",
|
|
19
|
+
"@backtest-kit/graph": "16.6.0",
|
|
20
|
+
"@backtest-kit/pinets": "16.6.0",
|
|
21
|
+
"@backtest-kit/signals": "16.6.0",
|
|
22
|
+
"@backtest-kit/ui": "16.6.0",
|
|
23
23
|
"@tavily/core": "0.7.2",
|
|
24
24
|
"@tensorflow/tfjs": "4.22.0",
|
|
25
25
|
"@tensorflow/tfjs-backend-wasm": "4.22.0",
|
|
26
26
|
"@tensorflow/tfjs-core": "4.22.0",
|
|
27
27
|
"agent-swarm-kit": "6.0.0",
|
|
28
|
-
"backtest-kit": "16.
|
|
28
|
+
"backtest-kit": "16.6.0",
|
|
29
29
|
"dayjs": "1.11.20",
|
|
30
30
|
"functools-kit": "5.0.0",
|
|
31
31
|
"garch": "2.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backtest-kit/cli",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.6.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",
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/plugin-transform-modules-umd": "7.27.1",
|
|
65
65
|
"@babel/standalone": "7.29.1",
|
|
66
|
-
"@backtest-kit/graph": "16.
|
|
67
|
-
"@backtest-kit/ollama": "16.
|
|
68
|
-
"@backtest-kit/pinets": "16.
|
|
69
|
-
"@backtest-kit/signals": "16.
|
|
70
|
-
"@backtest-kit/ui": "16.
|
|
66
|
+
"@backtest-kit/graph": "16.6.0",
|
|
67
|
+
"@backtest-kit/ollama": "16.6.0",
|
|
68
|
+
"@backtest-kit/pinets": "16.6.0",
|
|
69
|
+
"@backtest-kit/signals": "16.6.0",
|
|
70
|
+
"@backtest-kit/ui": "16.6.0",
|
|
71
71
|
"@rollup/plugin-replace": "6.0.3",
|
|
72
72
|
"@rollup/plugin-typescript": "11.1.6",
|
|
73
73
|
"@types/image-size": "0.7.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@types/mustache": "4.2.6",
|
|
76
76
|
"@types/node": "22.9.0",
|
|
77
77
|
"@types/stack-trace": "0.0.33",
|
|
78
|
-
"backtest-kit": "16.
|
|
78
|
+
"backtest-kit": "16.6.0",
|
|
79
79
|
"glob": "11.0.1",
|
|
80
80
|
"markdown-it": "14.1.1",
|
|
81
81
|
"rimraf": "6.0.1",
|
|
@@ -92,14 +92,14 @@
|
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"@babel/plugin-transform-modules-umd": "^7.27.1",
|
|
94
94
|
"@babel/standalone": "^7.29.1",
|
|
95
|
-
"@backtest-kit/graph": "^16.
|
|
96
|
-
"@backtest-kit/ollama": "^16.
|
|
97
|
-
"@backtest-kit/pinets": "^16.
|
|
98
|
-
"@backtest-kit/signals": "^16.
|
|
99
|
-
"@backtest-kit/ui": "^16.
|
|
95
|
+
"@backtest-kit/graph": "^16.6.0",
|
|
96
|
+
"@backtest-kit/ollama": "^16.6.0",
|
|
97
|
+
"@backtest-kit/pinets": "^16.6.0",
|
|
98
|
+
"@backtest-kit/signals": "^16.6.0",
|
|
99
|
+
"@backtest-kit/ui": "^16.6.0",
|
|
100
100
|
"pinets": "^0.9.29",
|
|
101
101
|
"ccxt": "^4.5.39",
|
|
102
|
-
"backtest-kit": "^16.
|
|
102
|
+
"backtest-kit": "^16.6.0",
|
|
103
103
|
"markdown-it": "^14.1.1",
|
|
104
104
|
"typescript": "^5.0.0"
|
|
105
105
|
},
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
**✅ Order Continue**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Order:** `{{type}}`
|
|
6
|
+
**Tolerated Failures:** `{{attempt}}`
|
|
7
|
+
**Current:** `{{currentPrice}}`
|
|
8
|
+
**Entry:** `{{priceOpen}}`
|
|
9
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
10
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
11
|
+
**PnL:** {{pnl.pnlPercentage}}% ({{pnl.pnlCost}} / {{pnl.pnlEntries}})
|
|
12
|
+
**Signal ID:** `{{signalId}}`
|
|
13
|
+
**Time:** `{{timestamp}}`
|
|
14
|
+
|
|
15
|
+
{{#backtest}}
|
|
16
|
+
_🧪 Backtest_
|
|
17
|
+
{{/backtest}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
**🚫 Order Close Rejected**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Reason:** `{{message}}`
|
|
6
|
+
**Close Reason:** `{{closeReason}}`
|
|
7
|
+
**Current:** `{{currentPrice}}`
|
|
8
|
+
**Entry:** `{{priceOpen}}`
|
|
9
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
10
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
11
|
+
**PnL:** {{pnl.pnlPercentage}}% ({{pnl.pnlCost}} / {{pnl.pnlEntries}})
|
|
12
|
+
**Signal ID:** `{{signalId}}`
|
|
13
|
+
**Time:** `{{timestamp}}`
|
|
14
|
+
|
|
15
|
+
{{#backtest}}
|
|
16
|
+
_🧪 Backtest_
|
|
17
|
+
{{/backtest}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
**🚫 Order Open Rejected**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Reason:** `{{message}}`
|
|
6
|
+
**Current:** `{{currentPrice}}`
|
|
7
|
+
**Entry:** `{{priceOpen}}`
|
|
8
|
+
**Cost:** `{{cost}}`
|
|
9
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
10
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
11
|
+
**Signal ID:** `{{signalId}}`
|
|
12
|
+
**Time:** `{{timestamp}}`
|
|
13
|
+
|
|
14
|
+
{{#backtest}}
|
|
15
|
+
_🧪 Backtest_
|
|
16
|
+
{{/backtest}}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
**🛑 Order Stop**
|
|
2
|
+
|
|
3
|
+
**Symbol:** `{{symbol}}` ({{position}})
|
|
4
|
+
|
|
5
|
+
**Order:** `{{type}}`
|
|
6
|
+
**Reason:** `{{reason}}`
|
|
7
|
+
**Failed Attempts:** `{{attempt}}`
|
|
8
|
+
**Current:** `{{currentPrice}}`
|
|
9
|
+
**Entry:** `{{priceOpen}}`
|
|
10
|
+
**Take Profit:** `{{priceTakeProfit}}`
|
|
11
|
+
**Stop Loss:** `{{priceStopLoss}}`
|
|
12
|
+
**PnL:** {{pnl.pnlPercentage}}% ({{pnl.pnlCost}} / {{pnl.pnlEntries}})
|
|
13
|
+
**Signal ID:** `{{signalId}}`
|
|
14
|
+
**Time:** `{{timestamp}}`
|
|
15
|
+
|
|
16
|
+
{{#backtest}}
|
|
17
|
+
_🧪 Backtest_
|
|
18
|
+
{{/backtest}}
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"type": "commonjs",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@backtest-kit/cli": "^16.
|
|
17
|
-
"@backtest-kit/graph": "^16.
|
|
18
|
-
"@backtest-kit/pinets": "^16.
|
|
19
|
-
"@backtest-kit/ui": "^16.
|
|
16
|
+
"@backtest-kit/cli": "^16.6.0",
|
|
17
|
+
"@backtest-kit/graph": "^16.6.0",
|
|
18
|
+
"@backtest-kit/pinets": "^16.6.0",
|
|
19
|
+
"@backtest-kit/ui": "^16.6.0",
|
|
20
20
|
"agent-swarm-kit": "^6.0.0",
|
|
21
|
-
"backtest-kit": "^16.
|
|
21
|
+
"backtest-kit": "^16.6.0",
|
|
22
22
|
"functools-kit": "^5.0.0",
|
|
23
23
|
"garch": "^2.0.0",
|
|
24
24
|
"get-moment-stamp": "^3.0.0",
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as functools_kit from 'functools-kit';
|
|
2
2
|
import * as BacktestKit from 'backtest-kit';
|
|
3
|
-
import { CandleInterval, TrailingTakeCommit, TrailingStopCommit, BreakevenCommit, PartialProfitCommit, PartialLossCommit, IStrategyTickResultScheduled, IStrategyTickResultCancelled, IStrategyTickResultOpened, IStrategyTickResultClosed, RiskContract, AverageBuyCommit,
|
|
3
|
+
import { CandleInterval, TrailingTakeCommit, TrailingStopCommit, BreakevenCommit, PartialProfitCommit, PartialLossCommit, IStrategyTickResultScheduled, IStrategyTickResultCancelled, IStrategyTickResultOpened, IStrategyTickResultClosed, RiskContract, AverageBuyCommit, OrderFillOpenContract, OrderFillCloseContract, OrderRejectOpenContract, OrderRejectCloseContract, OrderContinueContract, OrderStopContract, CancelScheduledCommit, ClosePendingCommit, SignalInfoContract } from 'backtest-kit';
|
|
4
4
|
import * as BacktestKitUi from '@backtest-kit/ui';
|
|
5
5
|
import * as BacktestKitGraph from '@backtest-kit/graph';
|
|
6
6
|
import * as BacktestKitOllama from '@backtest-kit/ollama';
|
|
@@ -309,8 +309,22 @@ declare class TelegramLogicService {
|
|
|
309
309
|
private notifyClosed;
|
|
310
310
|
private notifyRisk;
|
|
311
311
|
private notifyAverageBuy;
|
|
312
|
-
private
|
|
313
|
-
private
|
|
312
|
+
private notifyOrderFillOpen;
|
|
313
|
+
private notifyOrderFillClose;
|
|
314
|
+
private notifyOrderRejectOpen;
|
|
315
|
+
private notifyOrderRejectClose;
|
|
316
|
+
/**
|
|
317
|
+
* Post-verdict order-check CONTINUE (order_continue). Fires every live tick the
|
|
318
|
+
* order survives the check, so it is throttled via functools-kit ttl:
|
|
319
|
+
* one message per signalId per ORDER_CHECK_NOTIFY_TTL (15 minutes).
|
|
320
|
+
*/
|
|
321
|
+
private notifyOrderContinue;
|
|
322
|
+
/**
|
|
323
|
+
* Post-verdict order-check STOP (order_stop). Terminal — fires once per signal,
|
|
324
|
+
* so no throttle; drops the continue throttle slot for this signalId
|
|
325
|
+
* (the signal leaves monitoring, the ttl entry would only leak otherwise).
|
|
326
|
+
*/
|
|
327
|
+
private notifyOrderStop;
|
|
314
328
|
private notifySignalInfo;
|
|
315
329
|
private notifyCancelScheduled;
|
|
316
330
|
private notifyClosePending;
|
|
@@ -330,6 +344,10 @@ interface NotificationConfig {
|
|
|
330
344
|
partial_profit: boolean;
|
|
331
345
|
order_sync: boolean;
|
|
332
346
|
order_check: boolean;
|
|
347
|
+
order_fill: boolean;
|
|
348
|
+
order_reject: boolean;
|
|
349
|
+
order_continue: boolean;
|
|
350
|
+
order_stop: boolean;
|
|
333
351
|
strategy_commit: boolean;
|
|
334
352
|
}
|
|
335
353
|
interface TelegramConfig {
|
|
@@ -344,8 +362,12 @@ interface TelegramConfig {
|
|
|
344
362
|
getClosedMarkdown(event: IStrategyTickResultClosed): Promise<string>;
|
|
345
363
|
getRiskMarkdown(event: RiskContract): Promise<string>;
|
|
346
364
|
getAverageBuyMarkdown(event: AverageBuyCommit): Promise<string>;
|
|
347
|
-
|
|
348
|
-
|
|
365
|
+
getOrderFillOpenMarkdown(event: OrderFillOpenContract): Promise<string>;
|
|
366
|
+
getOrderFillCloseMarkdown(event: OrderFillCloseContract): Promise<string>;
|
|
367
|
+
getOrderRejectOpenMarkdown(event: OrderRejectOpenContract): Promise<string>;
|
|
368
|
+
getOrderRejectCloseMarkdown(event: OrderRejectCloseContract): Promise<string>;
|
|
369
|
+
getOrderContinueMarkdown(event: OrderContinueContract): Promise<string>;
|
|
370
|
+
getOrderStopMarkdown(event: OrderStopContract): Promise<string>;
|
|
349
371
|
getCancelScheduledMarkdown(event: CancelScheduledCommit): Promise<string>;
|
|
350
372
|
getClosePendingMarkdown(event: ClosePendingCommit): Promise<string>;
|
|
351
373
|
getSignalInfoMarkdown(event: SignalInfoContract): Promise<string>;
|
|
@@ -367,8 +389,12 @@ declare class TelegramTemplateService implements TelegramConfig {
|
|
|
367
389
|
getClosedMarkdown: (event: IStrategyTickResultClosed) => Promise<string>;
|
|
368
390
|
getRiskMarkdown: (event: RiskContract) => Promise<string>;
|
|
369
391
|
getAverageBuyMarkdown: (event: AverageBuyCommit) => Promise<string>;
|
|
370
|
-
|
|
371
|
-
|
|
392
|
+
getOrderFillOpenMarkdown: (event: OrderFillOpenContract) => Promise<string>;
|
|
393
|
+
getOrderFillCloseMarkdown: (event: OrderFillCloseContract) => Promise<string>;
|
|
394
|
+
getOrderRejectOpenMarkdown: (event: OrderRejectOpenContract) => Promise<string>;
|
|
395
|
+
getOrderRejectCloseMarkdown: (event: OrderRejectCloseContract) => Promise<string>;
|
|
396
|
+
getOrderContinueMarkdown: (event: OrderContinueContract) => Promise<string>;
|
|
397
|
+
getOrderStopMarkdown: (event: OrderStopContract) => Promise<string>;
|
|
372
398
|
getCancelScheduledMarkdown: (event: CancelScheduledCommit) => Promise<string>;
|
|
373
399
|
getClosePendingMarkdown: (event: ClosePendingCommit) => Promise<string>;
|
|
374
400
|
getSignalInfoMarkdown: (event: SignalInfoContract) => Promise<string>;
|