ClementPerroud / Gym-Trading-Env

A simple, easy, customizable Gymnasium environment for trading.
https://gym-trading-env.readthedocs.io/
MIT License
314 stars 67 forks source link

random selection in multi-dataset #24

Open rjkoch opened 2 months ago

rjkoch commented 2 months ago

https://github.com/ClementPerroud/Gym-Trading-Env/blob/1b5b466376c442d25b4b62fd78bfb319bc9864af/src/gym_trading_env/environments.py#L385

I think this should be dataset_path = self.dataset_pathes[potential_dataset_pathes[random_int]]

the previous line random_int = np.random.randint(potential_dataset_pathes.size)

is selecting a random integer within the domain of the length of the array. We need to reference that to pick the right entry of our potential_dataset_pathes

rjkoch commented 2 months ago

after implementing this and realizing another issue, I think it's better to do this: random_int = potential_dataset_pathes[np.random.randint(potential_dataset_pathes.size)]