Closed Chaosqing closed 6 months ago
forex_environment_test.ipynb
test_env = ForexEnvBasic( test_target_prices_df, test_features_df, portfolio_value=1000, allowed_actions={Actions.SELL, Actions.CLOSE, Actions.BUY}, market_order_strategy=ForexMarketOrderStrategyAllIn(), reward_strategy=ForexRewardStrategyLogPortfolioReturn(), trading_costs_strategy=ForexTradingCostsStrategySpread(spread=1), include_in_obs = ['position'] )
AssertionError Traceback (most recent call last) Cell In[5], line 1 ----> 1 check_env(test_env) File D:\anaconda3\Lib\site-packages\stable_baselines3\common\env_checker.py:396, in check_env(env, warn, skip_render_check) 381 def check_env(env: gym.Env, warn: bool = True, skip_render_check: bool = True) -> None: 382 """ 383 Check that an environment follows Gym API. 384 This is particularly useful when using a custom environment. (...) 394 True by default (useful for the CI) 395 """ --> 396 assert isinstance( 397 env, gym.Env 398 ), "Your environment must inherit from the gymnasium.Env class cf. https://gymnasium.farama.org/api/env/" 400 # ============= Check the spaces (observation and action) ================ 401 _check_spaces(env)
AssertionError: Your environment must inherit from the gymnasium.Env class cf. https://gymnasium.farama.org/api/env/
https://github.com/D3F4LT4ST/RL-trading/commit/c8e6deb6195daed8cab947b29de5eaef92b1574b
forex_environment_test.ipynb
test_env = ForexEnvBasic( test_target_prices_df, test_features_df, portfolio_value=1000, allowed_actions={Actions.SELL, Actions.CLOSE, Actions.BUY}, market_order_strategy=ForexMarketOrderStrategyAllIn(), reward_strategy=ForexRewardStrategyLogPortfolioReturn(), trading_costs_strategy=ForexTradingCostsStrategySpread(spread=1), include_in_obs = ['position'] )
check_env(test_env)
AssertionError Traceback (most recent call last) Cell In[5], line 1 ----> 1 check_env(test_env) File D:\anaconda3\Lib\site-packages\stable_baselines3\common\env_checker.py:396, in check_env(env, warn, skip_render_check) 381 def check_env(env: gym.Env, warn: bool = True, skip_render_check: bool = True) -> None: 382 """ 383 Check that an environment follows Gym API. 384 This is particularly useful when using a custom environment. (...) 394 True by default (useful for the CI) 395 """ --> 396 assert isinstance( 397 env, gym.Env 398 ), "Your environment must inherit from the gymnasium.Env class cf. https://gymnasium.farama.org/api/env/" 400 # ============= Check the spaces (observation and action) ================ 401 _check_spaces(env)
AssertionError: Your environment must inherit from the gymnasium.Env class cf. https://gymnasium.farama.org/api/env/