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

Fixes for MultiDatasetTradingEnv #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/gym_trading_env/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,14 @@ def next_dataset(self):
# Find the indexes of the less explored dataset
potential_dataset_pathes = np.where(self.dataset_nb_uses == self.dataset_nb_uses.min())[0]
# Pick one of them
random_int = np.random.randint(potential_dataset_pathes.size)
random_int = np.random.choice(potential_dataset_pathes)
dataset_path = self.dataset_pathes[random_int]
self.dataset_nb_uses[random_int] += 1 # Update nb use counts

self.name = Path(dataset_path).name
return self.preprocess(pd.read_pickle(dataset_path))

def reset(self, seed=None):
def reset(self, seed=None, options=None):
self._episodes_on_this_dataset += 1
if self._episodes_on_this_dataset % self.episodes_between_dataset_switch == 0:
self._set_df(
Expand Down