stefan-jansen / machine-learning-for-trading

Code for Machine Learning for Algorithmic Trading, 2nd edition.
https://ml4trading.io
12.57k stars 4.03k forks source link

Error in training the agent: not enough values to unpack in trading_environment.step #277

Closed Maathouse closed 1 year ago

Maathouse commented 1 year ago

Hi!

I currently face the following error:

Traceback (most recent call last): File "c:\Users\marcm\OneDrive\Bureaublad\Programming\Maathouse Algorithm Trading\MachineLearning\Jansen\Deep_RL.py", line 263, in nextstate, reward, done, = trading_environment.step(action) File "C:\Users\marcm\OneDrive\Bureaublad\Programming\Maathouse Algorithm Trading\MachineLearning\lib\site-packages\gym\wrappers\time_limit.py", line 50, in step observation, reward, terminated, truncated, info = self.env.step(action) ValueError: not enough values to unpack (expected 5, got 4)

Anyone faced the same problem or know how to solve it? Seems to be an error in one of the Core API for Environment, Wrapper, ActionWrapper, RewardWrapper and ObservationWrapper.

Regards,

Maathouse

stefan-jansen commented 1 year ago

The openAI gym API [changed in version 0.26 to return an additional value. Please downgrade to an earlier version or modify the code accordingly.