]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): cleanup variables namespace
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Apr 2025 21:57:47 +0000 (23:57 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sat, 26 Apr 2025 21:57:47 +0000 (23:57 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py

index f3b1c2ea269ca9270155f36f49e76846fcfdcceb..0e9c109efc359d8aa3f0e06dd6fd0d04bacde0ad 100644 (file)
@@ -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:
index 24a06aab82f1ef6e98b6d5381bf9de5fb3d9f4ac..42b26d141b2bed867801189e02be65c192ebf51b 100644 (file)
@@ -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)