]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
refactor(qav3): code cleanups
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 21 Nov 2025 19:31:15 +0000 (20:31 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 21 Nov 2025 19:31:15 +0000 (20:31 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py

index 2768d3cee9d024dbac52aa4429b281e528f82e37..1c8cdbf6afead9f22daf5ae2a0ae1dd8863dd0cf 100644 (file)
@@ -73,7 +73,7 @@ class QuickAdapterRegressorV3(BaseRegressionModel):
     https://github.com/sponsors/robcaulk
     """
 
-    version = "3.7.123"
+    version = "3.7.124"
 
     _SQRT_2: Final[float] = np.sqrt(2.0)
 
index e2764ecc3d1966f41f9e0b2e2b5b48b241b97fbd..6cf88b275dde7c4c57429733231226ffb8a620bf 100644 (file)
@@ -35,6 +35,7 @@ from Utils import (
     SMOOTHING_METHODS,
     WEIGHT_STRATEGIES,
     TrendDirection,
+    WeightStrategy,
     alligator,
     bottom_change_percent,
     calculate_n_extrema,
@@ -104,7 +105,7 @@ class QuickAdapterV3(IStrategy):
     _TRADING_MODES: Final[tuple[TradingMode, ...]] = ("spot", "margin", "futures")
 
     def version(self) -> str:
-        return "3.3.173"
+        return "3.3.174"
 
     timeframe = "5m"
 
@@ -732,18 +733,17 @@ class QuickAdapterV3(IStrategy):
 
     @staticmethod
     def _get_weights(
-        strategy: str, amplitudes: list[float], amplitude_excesses: list[float]
+        strategy: WeightStrategy,
+        amplitudes: list[float],
+        amplitude_excesses: list[float],
     ) -> list[float]:
-        if not isinstance(strategy, str):
-            return []
-        strategy = strategy.lower().strip()
-        if strategy == "amplitude_excess":
+        if strategy == WEIGHT_STRATEGIES[2]:  # "amplitude_excess"
             return (
                 amplitude_excesses
                 if len(amplitude_excesses) == len(amplitudes)
                 else amplitudes
             )
-        if strategy == "amplitude":
+        if strategy == WEIGHT_STRATEGIES[1]:  # "amplitude"
             return amplitudes
         return []
 
index cdd83f2d12255492317ac6928eaac457c13eee21..34bd96e9d0356d2e6843e0a3e7f8b6f115fd8aa3 100644 (file)
@@ -985,13 +985,13 @@ def zigzag(
                 amplitude = np.nan
             else:
                 amplitude = abs(value - prev_value) / abs(prev_value)
-            threshold_current = thresholds[pos]
+            current_threshold = thresholds[pos]
             if (
-                np.isfinite(threshold_current)
-                and threshold_current > 0
+                np.isfinite(current_threshold)
+                and current_threshold > 0
                 and np.isfinite(amplitude)
             ):
-                amplitude_excess = amplitude / threshold_current
+                amplitude_excess = amplitude / current_threshold
             else:
                 amplitude_excess = np.nan
         else: