backtest-kit 1.5.0 → 1.5.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/build/index.cjs +304 -69
- package/build/index.mjs +304 -69
- package/package.json +1 -1
- package/types.d.ts +23 -0
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ declare const GLOBAL_CONFIG: {
|
|
|
19
19
|
* Default: 0.3% (covers 2×0.1% fees + minimum profit margin)
|
|
20
20
|
*/
|
|
21
21
|
CC_MIN_TAKEPROFIT_DISTANCE_PERCENT: number;
|
|
22
|
+
/**
|
|
23
|
+
* Minimum StopLoss distance from priceOpen (percentage)
|
|
24
|
+
* Prevents signals from being immediately stopped out due to price volatility
|
|
25
|
+
* Default: 0.5% (buffer to avoid instant stop loss on normal market fluctuations)
|
|
26
|
+
*/
|
|
27
|
+
CC_MIN_STOPLOSS_DISTANCE_PERCENT: number;
|
|
22
28
|
/**
|
|
23
29
|
* Maximum StopLoss distance from priceOpen (percentage)
|
|
24
30
|
* Prevents catastrophic losses from extreme StopLoss values
|
|
@@ -31,6 +37,15 @@ declare const GLOBAL_CONFIG: {
|
|
|
31
37
|
* Default: 1440 minutes (1 day)
|
|
32
38
|
*/
|
|
33
39
|
CC_MAX_SIGNAL_LIFETIME_MINUTES: number;
|
|
40
|
+
/**
|
|
41
|
+
* Maximum time allowed for signal generation (in seconds).
|
|
42
|
+
* Prevents long-running or stuck signal generation routines from blocking
|
|
43
|
+
* execution or consuming resources indefinitely. If generation exceeds this
|
|
44
|
+
* threshold the attempt should be aborted, logged and optionally retried.
|
|
45
|
+
*
|
|
46
|
+
* Default: 180 seconds (3 minutes)
|
|
47
|
+
*/
|
|
48
|
+
CC_MAX_SIGNAL_GENERATION_SECONDS: number;
|
|
34
49
|
/**
|
|
35
50
|
* Number of retries for getCandles function
|
|
36
51
|
* Default: 3 retries
|
|
@@ -918,6 +933,10 @@ interface IStrategyTickResultActive {
|
|
|
918
933
|
exchangeName: ExchangeName;
|
|
919
934
|
/** Trading pair symbol (e.g., "BTCUSDT") */
|
|
920
935
|
symbol: string;
|
|
936
|
+
/** Percentage progress towards take profit (0-100%, 0 if moving towards SL) */
|
|
937
|
+
percentTp: number;
|
|
938
|
+
/** Percentage progress towards stop loss (0-100%, 0 if moving towards TP) */
|
|
939
|
+
percentSl: number;
|
|
921
940
|
}
|
|
922
941
|
/**
|
|
923
942
|
* Tick result: signal closed with PNL.
|
|
@@ -3764,6 +3783,10 @@ interface TickEvent {
|
|
|
3764
3783
|
takeProfit?: number;
|
|
3765
3784
|
/** Stop loss price (only for opened/active/closed) */
|
|
3766
3785
|
stopLoss?: number;
|
|
3786
|
+
/** Percentage progress towards take profit (only for active) */
|
|
3787
|
+
percentTp?: number;
|
|
3788
|
+
/** Percentage progress towards stop loss (only for active) */
|
|
3789
|
+
percentSl?: number;
|
|
3767
3790
|
/** PNL percentage (only for closed) */
|
|
3768
3791
|
pnl?: number;
|
|
3769
3792
|
/** Close reason (only for closed) */
|