Add render_mode='rgb_array'
ipsec opened this issue · 2 comments
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
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.
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:
- Add 'rgb_array' to the list of supported render modes in
gym_anytrading/envs/trading_env.py#25
. - Create a class `PriceRendererˋ and offload the rendering-related code to it.
- Implement a render function for
rgb_array
mode: We'll need to add code within theTradingEnv.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!