AminHP / gym-anytrading

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

Reproducibility of result calculation (total_profit) using fixed test data for ForexEnv #39

Closed hcandra closed 3 years ago

hcandra commented 3 years ago

Hi, I played with the forex model using this gym. I created an RL A2C model with stable-baselines3 and tested against this gym. Somehow I always get different 'total_profit' calculation whilst 'max possible profit' is fixed. Can anybody advise on how do I tweak the code so that I can get consistent 'total_profit' result? I have tried to fix the seed using env.seed(32) and env.action_space.seed(32) but I still get different result in 'total_profit' calculation

Rgds, Harry

hcandra commented 3 years ago

Turned out the inconsistency is caused by another library for the RL model. Nothing to due with gym-anytrading.

Rgds, Harry

krowxx commented 2 years ago

sir i am having the same issue, care to explain how you solved it pls

edit: action, _states = model.predict(obs, deterministic=True) solved the issue for me