hugocen / freqtrade-gym

A customized gym environment for developing and comparing reinforcement learning algorithms in crypto trading.
GNU General Public License v3.0
221 stars 45 forks source link

AttributeError: 'Pandas' object has no attribute 'kc_percent' #4

Closed matteomolino closed 3 years ago

matteomolino commented 3 years ago

Hi I'm here again with a new issue 🔢. When I run deep.rl.py I get this error "AttributeError: 'Pandas' object has no attribute 'kc_percent'". Probabably it's something with indicators but I couldn't figure it out. copy the error message here below FYI. I'd appreciate your effort to create this project.

/home/frequi/freqtrade/.env/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) /home/frequi/freqtrade/.env/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) /home/frequi/freqtrade/.env/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) /home/frequi/freqtrade/.env/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) /home/frequi/freqtrade/.env/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) /home/frequi/freqtrade/.env/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) {236429} Traceback (most recent call last): File "deep_rl.py", line 29, in model.learn(total_timesteps=int(1e+6)) File "/home/frequi/freqtrade/.env/lib/python3.6/site-packages/stable_baselines/acer/acer_simple.py", line 578, in learn enc_obs, obs, actions, rewards, mus, dones, masks = self.runner.run(callback) File "/home/frequi/freqtrade/.env/lib/python3.6/site-packages/stable_baselines/common/base_class.py", line 794, in runner self._runner = self._make_runner() File "/home/frequi/freqtrade/.env/lib/python3.6/site-packages/stable_baselines/acer/acer_simple.py", line 240, in _make_runner return _Runner(env=self.env, model=self, n_steps=self.n_steps) File "/home/frequi/freqtrade/.env/lib/python3.6/site-packages/stable_baselines/acer/acer_simple.py", line 682, in init super(_Runner, self).init(env=env, model=model, n_steps=n_steps) File "/home/frequi/freqtrade/.env/lib/python3.6/site-packages/stable_baselines/common/runners.py", line 31, in init self.obs[:] = env.reset() File "/home/frequi/freqtrade/.env/lib/python3.6/site-packages/stable_baselines/common/vec_env/dummy_vec_env.py", line 61, in reset obs = self.envs[env_idx].reset() File "/home/frequi/freqtrade/freqtradegym.py", line 238, in reset return self._next_observation() File "/home/frequi/freqtrade/freqtradegym.py", line 112, in _next_observation row.kc_percent, AttributeError: 'Pandas' object has no attribute 'kc_percent'

hugocen commented 3 years ago

Hi @matteomolino,

Sorry for the late update. It had been a really busy week for me.

The problem you have encountered is caused by the features name have to manually match in the indicator strategy and in freqtradegym. And I did not match the correct feature names before I push the project. I have updated the repo and I have changed many stuff. So you may have to re-download the repo. This time I have tested this is a workable demo and you are very welcome to try it out.

Have fun!

matteomolino commented 3 years ago

Hi No worries at all. I really thank you for your help and effort. I'm gonna download it again and use your developed model. Bests