]> Piment Noir Git Repositories - freqai-strategies.git/commitdiff
fix(reforcexy): fix peak pnl computation
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 27 Feb 2025 09:52:58 +0000 (10:52 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 27 Feb 2025 09:52:58 +0000 (10:52 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
ReforceXY/user_data/freqaimodels/ReforceXY.py

index 17b9a70ade3db3c4ab85b611cc58ff54c583ab18..11c19d6f159698a58adc30f3d754599aa05d1987 100644 (file)
@@ -809,7 +809,7 @@ class ReforceXY(BaseReinforcementLearningModel):
                 self._position in (Positions.Short, Positions.Long)
                 and action == Actions.Neutral.value
             ):
-                peak_pnl = np.max(self.get_most_recent_peak_pnl(), pnl)
+                peak_pnl = max(self.get_most_recent_peak_pnl(), pnl)
                 if peak_pnl > 0:
                     drawdown_penalty = 0.01 * factor * (peak_pnl - pnl)
                 else: