chore: protect users who dont read log warnings

This commit is contained in:
robcaulk
2023-08-25 16:45:46 +02:00
parent e5a88fdeda
commit 04122abd17

View File

@@ -11,6 +11,8 @@ from gymnasium import spaces
from gymnasium.utils import seeding
from pandas import DataFrame
from freqtrade.exceptions import OperationalException
logger = logging.getLogger(__name__)
@@ -80,8 +82,9 @@ class BaseEnvironment(gym.Env):
self.can_short: bool = can_short
self.live: bool = live
if not self.live and self.add_state_info:
self.add_state_info = False
logger.warning("add_state_info is not available in backtesting. Deactivating.")
raise OperationalException("`add_state_info` is not available in backtesting. Change "
"parameter to false in your rl_config. See `add_state_info` "
"docs for more info.")
self.seed(seed)
self.reset_env(df, prices, window_size, reward_kwargs, starting_point)