]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): kama is returning an ndarray
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 23 May 2025 13:24:45 +0000 (15:24 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 23 May 2025 13:24:45 +0000 (15:24 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index f0d12fd24e9d716f1d943f0edb43280d577be085..b2d992193b0bcdfb4cda7e755e97782bc50c78db 100644 (file)
@@ -60,7 +60,7 @@ class QuickAdapterV3(IStrategy):
     INTERFACE_VERSION = 3
 
     def version(self) -> str:
-        return "3.3.59"
+        return "3.3.60"
 
     timeframe = "5m"
 
@@ -503,11 +503,14 @@ class QuickAdapterV3(IStrategy):
         if trade_duration_candles >= 2:
             kama = get_ma_fn("kama")
             try:
-                trade_kama_natr = kama(
+                trade_kama_natr_values = kama(
                     trade_zl_natr, timeperiod=trade_duration_candles
-                ).dropna()
-                if not trade_kama_natr.empty:
-                    take_profit_natr = trade_kama_natr.iloc[-1]
+                )
+                trade_kama_natr_values = trade_kama_natr_values[
+                    ~np.isnan(trade_kama_natr_values)
+                ]
+                if trade_kama_natr_values.size > 0:
+                    take_profit_natr = trade_kama_natr_values[-1]
             except Exception as e:
                 logger.error(
                     f"Failed to calculate KAMA at take profit price computation: {str(e)}",