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

Change reward function

CharlyHunsicker opened this issue · comments

Would it be possible to make a function comparable to add_signals for changing the reward function? It would be nice to use custom KPI's as rewards for example risk-adjusted return.

Kind regards.

@CharlyHunsicker Any idea how we can change the reward function with model parameters without making a specific function for it like add_signals?

@CharlyHunsicker

Currently, there is no simple way to add custom KPIs. But, you can implement a new function similar to _calculate_reward or _calculate_profit and call it here. Of course, you need to rewrite the step method. A more simple but dirtier way is calling your custom function inside _calculate_reward or _calculate_profit.

@QuantumCrazy

You can add some hyperparameters in the env and use them in the reward function. Then, try to tune these hyperparameters by a model and set them outside the reward function.

Thank you for your comment @AminHP.