From: Jérôme Benoit Date: Sun, 10 Aug 2025 15:06:14 +0000 (+0200) Subject: fix(reforcexy): revert Actions usage in strategy X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=63944f53cca21c166730dcaa37c062e435684176;p=freqai-strategies.git fix(reforcexy): revert Actions usage in strategy Signed-off-by: Jérôme Benoit --- diff --git a/ReforceXY/user_data/strategies/RLAgentStrategy.py b/ReforceXY/user_data/strategies/RLAgentStrategy.py index 28f08c6..a4b0cf3 100644 --- a/ReforceXY/user_data/strategies/RLAgentStrategy.py +++ b/ReforceXY/user_data/strategies/RLAgentStrategy.py @@ -3,7 +3,6 @@ from functools import cached_property, reduce from typing import Any # import talib.abstract as ta -from freqtrade.freqai.RL.Base5ActionRLEnv import Actions from freqtrade.strategy import IStrategy from pandas import DataFrame @@ -107,7 +106,7 @@ class RLAgentStrategy(IStrategy): def set_freqai_targets( self, dataframe: DataFrame, metadata: dict[str, Any], **kwargs ) -> DataFrame: - dataframe[ACTION_COLUMN] = Actions.Neutral + dataframe[ACTION_COLUMN] = 0 return dataframe @@ -123,7 +122,7 @@ class RLAgentStrategy(IStrategy): ) -> DataFrame: enter_long_conditions = [ dataframe.get("do_predict") == 1, - dataframe.get(ACTION_COLUMN) == Actions.Long_enter, + dataframe.get(ACTION_COLUMN) == 1, ] dataframe.loc[ reduce(lambda x, y: x & y, enter_long_conditions), @@ -132,7 +131,7 @@ class RLAgentStrategy(IStrategy): enter_short_conditions = [ dataframe.get("do_predict") == 1, - dataframe.get(ACTION_COLUMN) == Actions.Short_enter, + dataframe.get(ACTION_COLUMN) == 3, ] dataframe.loc[ reduce(lambda x, y: x & y, enter_short_conditions), @@ -146,13 +145,13 @@ class RLAgentStrategy(IStrategy): ) -> DataFrame: exit_long_conditions = [ dataframe.get("do_predict") == 1, - dataframe.get(ACTION_COLUMN) == Actions.Long_exit, + dataframe.get(ACTION_COLUMN) == 2, ] dataframe.loc[reduce(lambda x, y: x & y, exit_long_conditions), "exit_long"] = 1 exit_short_conditions = [ dataframe.get("do_predict") == 1, - dataframe.get(ACTION_COLUMN) == Actions.Short_exit, + dataframe.get(ACTION_COLUMN) == 4, ] dataframe.loc[ reduce(lambda x, y: x & y, exit_short_conditions), "exit_short"