backtest-kit 1.5.37 → 1.5.38
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 +24 -0
- package/build/index.mjs +24 -0
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -2879,6 +2879,9 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
2879
2879
|
errors.push(`position must be "long" or "short", got "${signal.position}"`);
|
|
2880
2880
|
}
|
|
2881
2881
|
// ЗАЩИТА ОТ NaN/Infinity: currentPrice должна быть конечным числом
|
|
2882
|
+
if (typeof currentPrice !== "number") {
|
|
2883
|
+
errors.push(`currentPrice must be a number type, got ${currentPrice} (${typeof currentPrice})`);
|
|
2884
|
+
}
|
|
2882
2885
|
if (!isFinite(currentPrice)) {
|
|
2883
2886
|
errors.push(`currentPrice must be a finite number, got ${currentPrice} (${typeof currentPrice})`);
|
|
2884
2887
|
}
|
|
@@ -2886,12 +2889,21 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
2886
2889
|
errors.push(`currentPrice must be positive, got ${currentPrice}`);
|
|
2887
2890
|
}
|
|
2888
2891
|
// ЗАЩИТА ОТ NaN/Infinity: все цены должны быть конечными числами
|
|
2892
|
+
if (typeof signal.priceOpen !== "number") {
|
|
2893
|
+
errors.push(`priceOpen must be a number type, got ${signal.priceOpen} (${typeof signal.priceOpen})`);
|
|
2894
|
+
}
|
|
2889
2895
|
if (!isFinite(signal.priceOpen)) {
|
|
2890
2896
|
errors.push(`priceOpen must be a finite number, got ${signal.priceOpen} (${typeof signal.priceOpen})`);
|
|
2891
2897
|
}
|
|
2898
|
+
if (typeof signal.priceTakeProfit !== "number") {
|
|
2899
|
+
errors.push(`priceTakeProfit must be a number type, got ${signal.priceTakeProfit} (${typeof signal.priceTakeProfit})`);
|
|
2900
|
+
}
|
|
2892
2901
|
if (!isFinite(signal.priceTakeProfit)) {
|
|
2893
2902
|
errors.push(`priceTakeProfit must be a finite number, got ${signal.priceTakeProfit} (${typeof signal.priceTakeProfit})`);
|
|
2894
2903
|
}
|
|
2904
|
+
if (typeof signal.priceStopLoss !== "number") {
|
|
2905
|
+
errors.push(`priceStopLoss must be a number type, got ${signal.priceStopLoss} (${typeof signal.priceStopLoss})`);
|
|
2906
|
+
}
|
|
2895
2907
|
if (!isFinite(signal.priceStopLoss)) {
|
|
2896
2908
|
errors.push(`priceStopLoss must be a finite number, got ${signal.priceStopLoss} (${typeof signal.priceStopLoss})`);
|
|
2897
2909
|
}
|
|
@@ -3030,12 +3042,18 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
3030
3042
|
}
|
|
3031
3043
|
}
|
|
3032
3044
|
// Валидация временных параметров
|
|
3045
|
+
if (typeof signal.minuteEstimatedTime !== "number") {
|
|
3046
|
+
errors.push(`minuteEstimatedTime must be a number type, got ${signal.minuteEstimatedTime} (${typeof signal.minuteEstimatedTime})`);
|
|
3047
|
+
}
|
|
3033
3048
|
if (signal.minuteEstimatedTime <= 0) {
|
|
3034
3049
|
errors.push(`minuteEstimatedTime must be positive, got ${signal.minuteEstimatedTime}`);
|
|
3035
3050
|
}
|
|
3036
3051
|
if (!Number.isInteger(signal.minuteEstimatedTime)) {
|
|
3037
3052
|
errors.push(`minuteEstimatedTime must be an integer (whole number), got ${signal.minuteEstimatedTime}`);
|
|
3038
3053
|
}
|
|
3054
|
+
if (!isFinite(signal.minuteEstimatedTime)) {
|
|
3055
|
+
errors.push(`minuteEstimatedTime must be a finite number, got ${signal.minuteEstimatedTime}`);
|
|
3056
|
+
}
|
|
3039
3057
|
// ЗАЩИТА ОТ ВЕЧНЫХ СИГНАЛОВ: ограничиваем максимальное время жизни сигнала
|
|
3040
3058
|
if (GLOBAL_CONFIG.CC_MAX_SIGNAL_LIFETIME_MINUTES && GLOBAL_CONFIG.CC_MAX_SIGNAL_LIFETIME_MINUTES) {
|
|
3041
3059
|
if (signal.minuteEstimatedTime > GLOBAL_CONFIG.CC_MAX_SIGNAL_LIFETIME_MINUTES) {
|
|
@@ -3046,9 +3064,15 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
3046
3064
|
`Eternal signals block risk limits and prevent new trades.`);
|
|
3047
3065
|
}
|
|
3048
3066
|
}
|
|
3067
|
+
if (typeof signal.scheduledAt !== "number") {
|
|
3068
|
+
errors.push(`scheduledAt must be a number type, got ${signal.scheduledAt} (${typeof signal.scheduledAt})`);
|
|
3069
|
+
}
|
|
3049
3070
|
if (signal.scheduledAt <= 0) {
|
|
3050
3071
|
errors.push(`scheduledAt must be positive, got ${signal.scheduledAt}`);
|
|
3051
3072
|
}
|
|
3073
|
+
if (typeof signal.pendingAt !== "number") {
|
|
3074
|
+
errors.push(`pendingAt must be a number type, got ${signal.pendingAt} (${typeof signal.pendingAt})`);
|
|
3075
|
+
}
|
|
3052
3076
|
if (signal.pendingAt <= 0) {
|
|
3053
3077
|
errors.push(`pendingAt must be positive, got ${signal.pendingAt}`);
|
|
3054
3078
|
}
|
package/build/index.mjs
CHANGED
|
@@ -2877,6 +2877,9 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
2877
2877
|
errors.push(`position must be "long" or "short", got "${signal.position}"`);
|
|
2878
2878
|
}
|
|
2879
2879
|
// ЗАЩИТА ОТ NaN/Infinity: currentPrice должна быть конечным числом
|
|
2880
|
+
if (typeof currentPrice !== "number") {
|
|
2881
|
+
errors.push(`currentPrice must be a number type, got ${currentPrice} (${typeof currentPrice})`);
|
|
2882
|
+
}
|
|
2880
2883
|
if (!isFinite(currentPrice)) {
|
|
2881
2884
|
errors.push(`currentPrice must be a finite number, got ${currentPrice} (${typeof currentPrice})`);
|
|
2882
2885
|
}
|
|
@@ -2884,12 +2887,21 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
2884
2887
|
errors.push(`currentPrice must be positive, got ${currentPrice}`);
|
|
2885
2888
|
}
|
|
2886
2889
|
// ЗАЩИТА ОТ NaN/Infinity: все цены должны быть конечными числами
|
|
2890
|
+
if (typeof signal.priceOpen !== "number") {
|
|
2891
|
+
errors.push(`priceOpen must be a number type, got ${signal.priceOpen} (${typeof signal.priceOpen})`);
|
|
2892
|
+
}
|
|
2887
2893
|
if (!isFinite(signal.priceOpen)) {
|
|
2888
2894
|
errors.push(`priceOpen must be a finite number, got ${signal.priceOpen} (${typeof signal.priceOpen})`);
|
|
2889
2895
|
}
|
|
2896
|
+
if (typeof signal.priceTakeProfit !== "number") {
|
|
2897
|
+
errors.push(`priceTakeProfit must be a number type, got ${signal.priceTakeProfit} (${typeof signal.priceTakeProfit})`);
|
|
2898
|
+
}
|
|
2890
2899
|
if (!isFinite(signal.priceTakeProfit)) {
|
|
2891
2900
|
errors.push(`priceTakeProfit must be a finite number, got ${signal.priceTakeProfit} (${typeof signal.priceTakeProfit})`);
|
|
2892
2901
|
}
|
|
2902
|
+
if (typeof signal.priceStopLoss !== "number") {
|
|
2903
|
+
errors.push(`priceStopLoss must be a number type, got ${signal.priceStopLoss} (${typeof signal.priceStopLoss})`);
|
|
2904
|
+
}
|
|
2893
2905
|
if (!isFinite(signal.priceStopLoss)) {
|
|
2894
2906
|
errors.push(`priceStopLoss must be a finite number, got ${signal.priceStopLoss} (${typeof signal.priceStopLoss})`);
|
|
2895
2907
|
}
|
|
@@ -3028,12 +3040,18 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
3028
3040
|
}
|
|
3029
3041
|
}
|
|
3030
3042
|
// Валидация временных параметров
|
|
3043
|
+
if (typeof signal.minuteEstimatedTime !== "number") {
|
|
3044
|
+
errors.push(`minuteEstimatedTime must be a number type, got ${signal.minuteEstimatedTime} (${typeof signal.minuteEstimatedTime})`);
|
|
3045
|
+
}
|
|
3031
3046
|
if (signal.minuteEstimatedTime <= 0) {
|
|
3032
3047
|
errors.push(`minuteEstimatedTime must be positive, got ${signal.minuteEstimatedTime}`);
|
|
3033
3048
|
}
|
|
3034
3049
|
if (!Number.isInteger(signal.minuteEstimatedTime)) {
|
|
3035
3050
|
errors.push(`minuteEstimatedTime must be an integer (whole number), got ${signal.minuteEstimatedTime}`);
|
|
3036
3051
|
}
|
|
3052
|
+
if (!isFinite(signal.minuteEstimatedTime)) {
|
|
3053
|
+
errors.push(`minuteEstimatedTime must be a finite number, got ${signal.minuteEstimatedTime}`);
|
|
3054
|
+
}
|
|
3037
3055
|
// ЗАЩИТА ОТ ВЕЧНЫХ СИГНАЛОВ: ограничиваем максимальное время жизни сигнала
|
|
3038
3056
|
if (GLOBAL_CONFIG.CC_MAX_SIGNAL_LIFETIME_MINUTES && GLOBAL_CONFIG.CC_MAX_SIGNAL_LIFETIME_MINUTES) {
|
|
3039
3057
|
if (signal.minuteEstimatedTime > GLOBAL_CONFIG.CC_MAX_SIGNAL_LIFETIME_MINUTES) {
|
|
@@ -3044,9 +3062,15 @@ const VALIDATE_SIGNAL_FN = (signal, currentPrice, isScheduled) => {
|
|
|
3044
3062
|
`Eternal signals block risk limits and prevent new trades.`);
|
|
3045
3063
|
}
|
|
3046
3064
|
}
|
|
3065
|
+
if (typeof signal.scheduledAt !== "number") {
|
|
3066
|
+
errors.push(`scheduledAt must be a number type, got ${signal.scheduledAt} (${typeof signal.scheduledAt})`);
|
|
3067
|
+
}
|
|
3047
3068
|
if (signal.scheduledAt <= 0) {
|
|
3048
3069
|
errors.push(`scheduledAt must be positive, got ${signal.scheduledAt}`);
|
|
3049
3070
|
}
|
|
3071
|
+
if (typeof signal.pendingAt !== "number") {
|
|
3072
|
+
errors.push(`pendingAt must be a number type, got ${signal.pendingAt} (${typeof signal.pendingAt})`);
|
|
3073
|
+
}
|
|
3050
3074
|
if (signal.pendingAt <= 0) {
|
|
3051
3075
|
errors.push(`pendingAt must be positive, got ${signal.pendingAt}`);
|
|
3052
3076
|
}
|