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

Add render_mode='rgb_array' #96

Open
ipsec opened this issue Oct 5, 2023 · 2 comments
Open

Add render_mode='rgb_array' #96

ipsec opened this issue Oct 5, 2023 · 2 comments

Comments

@ipsec
Copy link

ipsec commented Oct 5, 2023

Hi,

Some algorithms uses rgb_array render mode.

env = gym.make(env_id, render_mode='rgb_array')

I'm getting error:

gym_anytrading/envs/trading_env.py", line 29, in __init__ assert render_mode is None or render_mode in self.metadata['render_modes']

Thanks

@AminHP
Copy link
Owner

AminHP commented Mar 20, 2024

Hello @ipsec , As far as I know, the render_mode parameter is just used for visualization purposes. It doesn't affect the underlying algorithms and computations.

@twbrandon7
Copy link

twbrandon7 commented Apr 13, 2024

Hi there!

The assertion failed because the rgb_array render mode is not currently supported. I'd be happy to contribute a fix for this. Here's what I propose:

  1. Add 'rgb_array' to the list of supported render modes in gym_anytrading/envs/trading_env.py#25.
  2. Create a class `PriceRendererˋ and offload the rendering-related code to it.
  3. Implement a render function for rgb_array mode: We'll need to add code within the TradingEnv.render() method to convert the Matplotlib plot to a NumPy array.

Would this approach be aligned with the project's direction? I'm happy to create a pull request with these changes once we have confirmation.

Thanks!

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

3 participants