AminHP / gym-anytrading

The most simple, flexible, and comprehensive OpenAI Gym trading environment (Approved by OpenAI Gym)
MIT License
2.09k stars 459 forks source link

How to maximize the sharpe ratio? #62

Closed GXY2017 closed 2 years ago

GXY2017 commented 2 years ago

Current step_reward is linear and maximize step_reward will maximize the self._total_reward. But Sharpe ratio requires historical yield data, and maximizing the Sharpe ratio in each step may not get the best strategy for the whole training data. Do you have any idea to maximize Sharpe ratio? Thank you.

AminHP commented 2 years ago

Hi @GXY2017

First of all, the current reward function is just a simple example and does not consider everything. The historical data is available in the history attribute in the trading env class. I think it contains all the required information you need.