From 63944f53cca21c166730dcaa37c062e435684176 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 10 Aug 2025 17:06:14 +0200 Subject: [PATCH] fix(reforcexy): revert Actions usage in strategy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- ReforceXY/user_data/strategies/RLAgentStrategy.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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" -- 2.43.0