stefan-jansen / machine-learning-for-trading

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

Trading Env #230

Closed Will-Nie closed 2 years ago

Will-Nie commented 2 years ago

Hi Stefan,

Thank your for writing such an excellent book. I find it very useful!

When I read the book and compare the code with the web (https://github.com/PacktPublishing/Machine-Learning-for-Algorithmic-Trading-Second-Edition), I found in the trading_env.py from the chapter 22. There is a mismatching in the line 179 (https://github.com/PacktPublishing/Machine-Learning-for-Algorithmic-Trading-Second-Edition/blob/d6e03d8a18809fd9a2dffc069a9f19038d6fa8a3/22_deep_reinforcement_learning/trading_env.py#L179). In the book, I believe the last term in the line should be self.costs[self.step-1] instead. May I ask which one is correct? (I guess the book version is correct but not 100% sure)

Thank you for your time.