From: Jérôme Benoit Date: Sat, 26 Apr 2025 21:57:47 +0000 (+0200) Subject: refactor(qav3): cleanup variables namespace X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=12270f77a93b75d40420bb31d0e1915f78f9866f;p=freqai-strategies.git refactor(qav3): cleanup variables namespace Signed-off-by: Jérôme Benoit --- diff --git a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py index f3b1c2e..0e9c109 100644 --- a/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py +++ b/quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py @@ -967,20 +967,20 @@ def label_objective( if df.empty: return -float("inf"), -float("inf") - _, pivot_values, _ = zigzag( + _, pivots_values, _ = zigzag( df, period=label_period_candles, ratio=label_natr_ratio, ) - if len(pivot_values) < 2: + if len(pivots_values) < 2: return -float("inf"), -float("inf") scaled_natr_label_period_candles = ( ta.NATR(df, timeperiod=label_period_candles) * label_natr_ratio ) - return scaled_natr_label_period_candles.median(), len(pivot_values) + return scaled_natr_label_period_candles.median(), len(pivots_values) def smoothed_max(series: pd.Series, temperature=1.0) -> float: diff --git a/quickadapter/user_data/strategies/QuickAdapterV3.py b/quickadapter/user_data/strategies/QuickAdapterV3.py index 24a06aa..42b26d1 100644 --- a/quickadapter/user_data/strategies/QuickAdapterV3.py +++ b/quickadapter/user_data/strategies/QuickAdapterV3.py @@ -384,13 +384,13 @@ class QuickAdapterV3(IStrategy): def set_freqai_targets(self, dataframe: DataFrame, metadata: dict, **kwargs): pair = str(metadata.get("pair")) - pivot_indices, _, pivot_directions = zigzag( + pivots_indices, _, pivots_directions = zigzag( dataframe, period=self.get_label_period_candles(pair), ratio=self.get_label_natr_ratio(pair), ) dataframe[EXTREMA_COLUMN] = 0 - for pivot_idx, pivot_dir in zip(pivot_indices, pivot_directions): + for pivot_idx, pivot_dir in zip(pivots_indices, pivots_directions): dataframe.at[pivot_idx, EXTREMA_COLUMN] = pivot_dir dataframe["minima"] = np.where(dataframe[EXTREMA_COLUMN] == -1, -1, 0) dataframe["maxima"] = np.where(dataframe[EXTREMA_COLUMN] == 1, 1, 0)