Closed ghaffari903 closed 2 years ago
Hi @ghaffari903
@ Athe-kunal Thank you for detailed response,
@Athe-kunal You mentioned very good points. You are wonderful!
- Selling actions are less than 0 and buying actions are more than 0 Yes, I know, my confusion was about changing reward without any action! It seems to be solved.
@Athe-kunal Dear Astarag, what do you think about the bad test results on best tuned model? Although we make the best model on the training data, but I do not get a good result in the test. Some answers are very good(70-80% better than index) but some are disappointing(-50% under index backtest result!).
Yeah, the RL agent is really sensitive and every time the initial seed value changes, the whole trajectory changes and we don't get very conclusive evidence. Also, the training data distribution is different to test data distribution, like the training model on Tesla before 2020, and testing it afterward may lead to sub-optimal results. So we can work on augmenting the data in the train set to capture these variations. Also, I am closing this issue, if you have any further, please feel free to re-open
Again, thanks for your implementations, I study codes, I have some questions, thanks someone for writing the answer.
1-What is the use of reward scaling? 2- In Step functionhttps://github.com/AI4Finance-Foundation/FinRL-Meta/blob/master/finrl_meta/env_stock_trading/env_stock_trading.py : min_stock_rate and min_action whats for? in trading we see qty < min_action, I did not understand what it is used for?
3- I printed real actions in this code, its count is 0 most of time, but reward is applied to amount!!!!
if self.turbulence_bool[self.day] == 0:
min_action = int(self.max_stock * self.min_stock_rate) # stock_cd
for index in np.where(actions < -min_action)[0]: # sell_index:
if price[index] > 0: # Sell only if current asset is > 0
sell_num_shares = min(self.stocks[index], -actions[index]) self.stocks[index] -= sell_num_shares self.amount += ( price[index] sell_num_shares (1 - self.sell_cost_pct) ) self.stocks_cool_down[index] = 0 for index in np.where(actions > min_action)[0]: # buy_index: if ( price[index] > 0 ): # Buy only if the price is > 0 (no missing data in this particular date) buy_num_shares = min(self.amount // price[index], actions[index]) self.stocks[index] += buy_num_shares self.amount -= ( price[index] buy_num_shares (1 + self.buy_cost_pct) ) self.stocks_cool_down[index] = 0`