Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Error in TradeEnv running check_env() from stable baselines #2

Closed
simonesalvucci opened this issue Feb 7, 2020 · 4 comments

Comments

@simonesalvucci
Copy link

simonesalvucci commented Feb 7, 2020

Hi there,

I've encountered an issue running the following code:

import gym
from gym_anytrading.envs import TradingEnv, ForexEnv, Actions, Positions 
from gym_anytrading.datasets import FOREX_EURUSD_1H_ASK
from stable_baselines.common.env_checker import check_env


env = gym.make('forex-v0', frame_bound=(10, 500), window_size=10)
check_env(env, warn=False, skip_render_check=False)

The output I get is:
AssertionError: The observation returned by the reset() method does not match the given observation space

I've debugged your TradingEnv class and did't see any issue, so I've thought the problem could be in check_env().

I've debugged check_env() as well, but everything seems fine there.
Then I went for the last test which was running check_env() with the classic CartPole-v0 from gym, here check_env() didn't trow any exception and run smoothly.

This is the code for the CartPole-v0:

import gym
from gym.envs.classic_control import CartPoleEnv
from stable_baselines.common.env_checker import check_env

env = gym.make('CartPole-v0')
check_env(env, warn=False, skip_render_check=False)

Do you have any clue why this is happening? I'm confused lol

@simonesalvucci
Copy link
Author

I've just realised I didn't reset the environment before running check_env()
Doing that solves the issue.

@simonesalvucci
Copy link
Author

Actually I was wrong, resetting the environment doesn't solve the issue.
Sorry about that...

@simonesalvucci simonesalvucci reopened this Feb 7, 2020
@AminHP
Copy link
Owner

AminHP commented Feb 7, 2020

Hi.

It was a small bug and I fixed it. Thank you!

@simonesalvucci
Copy link
Author

The fix solves the issue, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants