AminHP / gym-anytrading

The most simple, flexible, and comprehensive OpenAI Gym trading environment (Approved by OpenAI Gym)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Holding 0 position shall be encouraged when price is falling.

GXY2017 opened this issue · comments

Suggest adding this part in Stock.env()_calculate_reward(self, action).
Holding 0 position, eg, holding cash, shall be encouraged when price is falling;or be punished when price is rising.

This will change reward, but will not affect profit if stock strategy is long only.

            # encourage 0 holdings when price is falling
            if self._position == Positions.Short:
                step_reward += -price_diff

Hi @GXY2017, thank you for the suggestion.

This project was supposed to be a simple baseline for beginners when I started it. So, I think it is better to keep it that way. However, you can inherit from the StocksEnv class and add your improvement.

Thank you for the reply. Its a very clean learning example.
Close this here.