]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): align cache variable namespace
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 15 Jun 2025 19:56:08 +0000 (21:56 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 15 Jun 2025 19:56:08 +0000 (21:56 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/Utils.py

index d9bbac3233e554524d67f4429fd33f165ddbf40b..b29d39e1c05067db6f645d68e93eba9bc38684dc 100644 (file)
@@ -1366,7 +1366,7 @@ def zigzag(
         last_pivot_pos = pos
         reset_candidate_pivot()
 
-    slopes_ok_cache: dict[tuple[int, int, bool, int, float], bool] = {}
+    slope_ok_cache: dict[tuple[int, int, bool, int, float], bool] = {}
 
     def get_slope_ok(
         pos: int,
@@ -1383,16 +1383,16 @@ def zigzag(
             min_slope,
         )
 
-        if cache_key in slopes_ok_cache:
-            return slopes_ok_cache[cache_key]
+        if cache_key in slope_ok_cache:
+            return slope_ok_cache[cache_key]
 
         next_start = pos
         next_end = min(next_start + slope_confirmation_window, n)
         next_closes = closes[next_start:next_end]
 
         if len(next_closes) < 2:
-            slopes_ok_cache[cache_key] = False
-            return slopes_ok_cache[cache_key]
+            slope_ok_cache[cache_key] = False
+            return slope_ok_cache[cache_key]
 
         log_next_closes = np.log(next_closes)
         log_next_closes_length = len(log_next_closes)
@@ -1408,13 +1408,13 @@ def zigzag(
         )[0]
 
         if direction == TrendDirection.DOWN:
-            slopes_ok_cache[cache_key] = log_next_slope < -min_slope
+            slope_ok_cache[cache_key] = log_next_slope < -min_slope
         elif direction == TrendDirection.UP:
-            slopes_ok_cache[cache_key] = log_next_slope > min_slope
+            slope_ok_cache[cache_key] = log_next_slope > min_slope
         else:
-            slopes_ok_cache[cache_key] = False
+            slope_ok_cache[cache_key] = False
 
-        return slopes_ok_cache[cache_key]
+        return slope_ok_cache[cache_key]
 
     def is_pivot_confirmed(
         pos: int,
index 4f1c1dbb43b9e421391d35d8d5a6d09ad0361b16..ad88660649e0f5803a16a7ac54c245e828e11540 100644 (file)
@@ -490,7 +490,7 @@ def zigzag(
         last_pivot_pos = pos
         reset_candidate_pivot()
 
-    slopes_ok_cache: dict[tuple[int, int, bool, int, float], bool] = {}
+    slope_ok_cache: dict[tuple[int, int, bool, int, float], bool] = {}
 
     def get_slope_ok(
         pos: int,
@@ -507,16 +507,16 @@ def zigzag(
             min_slope,
         )
 
-        if cache_key in slopes_ok_cache:
-            return slopes_ok_cache[cache_key]
+        if cache_key in slope_ok_cache:
+            return slope_ok_cache[cache_key]
 
         next_start = pos
         next_end = min(next_start + slope_confirmation_window, n)
         next_closes = closes[next_start:next_end]
 
         if len(next_closes) < 2:
-            slopes_ok_cache[cache_key] = False
-            return slopes_ok_cache[cache_key]
+            slope_ok_cache[cache_key] = False
+            return slope_ok_cache[cache_key]
 
         log_next_closes = np.log(next_closes)
         log_next_closes_length = len(log_next_closes)
@@ -532,13 +532,13 @@ def zigzag(
         )[0]
 
         if direction == TrendDirection.DOWN:
-            slopes_ok_cache[cache_key] = log_next_slope < -min_slope
+            slope_ok_cache[cache_key] = log_next_slope < -min_slope
         elif direction == TrendDirection.UP:
-            slopes_ok_cache[cache_key] = log_next_slope > min_slope
+            slope_ok_cache[cache_key] = log_next_slope > min_slope
         else:
-            slopes_ok_cache[cache_key] = False
+            slope_ok_cache[cache_key] = False
 
-        return slopes_ok_cache[cache_key]
+        return slope_ok_cache[cache_key]
 
     def is_pivot_confirmed(
         pos: int,