]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(qav3): handle NaN in builtin cmf
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 10 Mar 2025 10:15:15 +0000 (11:15 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Mon, 10 Mar 2025 10:15:15 +0000 (11:15 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
quickadapter/user_data/strategies/QuickAdapterV3.py

index b348e1f2fab52bec64b3363c34044d0bc019b73c..c2f7ad990e4457cd36f48470335325e8c6a89bcd 100644 (file)
@@ -130,7 +130,9 @@ class QuickAdapterV3(IStrategy):
         dataframe["%-er-period"] = pta.er(dataframe["close"], length=period)
         dataframe["%-rocr-period"] = ta.ROCR(dataframe, timeperiod=period)
         dataframe["%-trix-period"] = ta.TRIX(dataframe, timeperiod=period)
-        dataframe["%-cmf-period"] = chaikin_money_flow(dataframe, period=period)
+        dataframe["%-cmf-period"] = chaikin_money_flow(dataframe, period=period).fillna(
+            0.0
+        )
         dataframe["%-tcp-period"] = top_percent_change(dataframe, period=period)
         dataframe["%-cti-period"] = pta.cti(dataframe["close"], length=period)
         dataframe["%-chop-period"] = qtpylib.chopiness(dataframe, period)