https://github.com/sponsors/robcaulk
"""
- version = "3.6.6"
+ version = "3.6.7"
@cached_property
def __optuna_config(self) -> dict:
return model
+def round_to_nearest(value: float, step: int) -> int:
+ """
+ Round a value to the nearest multiple of a given step.
+ :param value: The value to round.
+ :param step: The step size to round to (must be non-zero).
+ :return: The rounded value.
+ :raises ValueError: If step is zero.
+ """
+ if step == 0:
+ raise ValueError("step must be non-zero")
+ return int(round(value / step) * step)
+
+
def period_objective(
trial: optuna.Trial,
regressor: str,
)
y_pred = model.predict(X_test)
- min_label_period_candles: int = max(fit_live_predictions_candles // 9, 20)
- max_label_period_candles: int = min(
- max(fit_live_predictions_candles // 3, min_label_period_candles),
- max(test_window // 2, min_label_period_candles),
+ min_label_period_candles: int = round_to_nearest(
+ max(fit_live_predictions_candles // 12, 20), candles_step
+ )
+ max_label_period_candles: int = round_to_nearest(
+ min(
+ max(fit_live_predictions_candles // 3, min_label_period_candles),
+ max(test_window // 2, min_label_period_candles),
+ ),
+ candles_step,
)
label_period_candles: int = trial.suggest_int(
"label_period_candles",
INTERFACE_VERSION = 3
def version(self) -> str:
- return "3.2.12"
+ return "3.2.13"
timeframe = "5m"
peaks_prominence = (
dataframe["close"].iloc[-1]
* ta.NATR(dataframe, timeperiod=label_period_candles).iloc[-1]
- * 0.005
+ * 0.0075
)
min_peaks, _ = find_peaks(
-dataframe["low"].values,