notadamking / RLTrader

A cryptocurrency trading environment using deep reinforcement learning and OpenAI's gym
https://discord.gg/ZZ7BGWh
GNU General Public License v3.0
1.71k stars 537 forks source link

How to return account_history? #90

Closed maxmatical closed 5 years ago

maxmatical commented 5 years ago

If I want the environment to return the numpy array of account_histories so I can pull out values or do visualizations, how can I do that?

notadamking commented 5 years ago

This is currently not supported, though you are welcome to submit a PR that makes this possible.

On Jul 3, 2019, at 2:00 PM, Max Tian notifications@github.com wrote:

If I want the environment to return the numpy array of account_histories so I can pull out values or do visualizations, how can I do that?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

maxmatical commented 5 years ago

Do you have an idea/documentation on how to return custom variables? I've tried writing a function that returns the account_history, but I get AttributeError: 'DummyVecEnv' object has no attribute 'return_acc_hist' and I can't find any documentation on how to return custom variables in an environment

bzier commented 5 years ago

DummyVecEnv is a wrapper around other environments (see here). It includes a method called env_method, which should allow you to invoke any method defined on the underlying environment, like your return_acc_hist method.

maxmatical commented 5 years ago

Do I call it like env.env_method(return_acc_hist) or something like that? I tried that but I get NameError: name '_return_trade_history' is not defined so I feel like I'm doing something wrong

maxmatical commented 5 years ago

The issue is solved, I had to write the method name as a string env.env_method('return_acc_hist')