Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'IndicatorforRL' object has no attribute 'ohlcvdata_to_dataframe' #23

Open
sn3fru opened this issue Oct 2, 2021 · 5 comments

Comments

@sn3fru
Copy link

sn3fru commented Oct 2, 2021

I'm trying to use it for the first time and it's giving me this error. Do you know if anything has changed in the structure of the project?

C:\Users\marco\anaconda3\envs\rl\lib\site-packages\stable_baselines_init_.py:33: UserWarning: stable-baselines is in maintenance mode, please use Stable-Baselines3 (SB3) for an up-to-date version. You can find a migration guide in SB3 documentation.
"stable-baselines is in maintenance mode, please use Stable-Baselines3 (SB3) for an up-to-date version. You can find a migration guide in SB3 documentation."
Add {
"method": "AgeFilter",
"min_days_listed": 30
},
to your pairlists in config (Under StaticPairList)
Traceback (most recent call last):
File "deep_rl.py", line 14, in
env = TradingEnv(config)
File "C:\Users\marco\trade\freqtrade\freqtradegym.py", line 44, in init
preprocessed = self.strategy.ohlcvdata_to_dataframe(data)
AttributeError: 'IndicatorforRL' object has no attribute 'ohlcvdata_to_dataframe'

@brusand
Copy link

brusand commented Oct 2, 2021

so i am, 😘 i cpy/paste this code lines bit not sure it is yhe best way but it works

def ohlcvdata_to_dataframe(self, data: Dict[str, DataFrame]) -> Dict[str, DataFrame]:
"""
Creates a dataframe and populates indicators for given candle (OHLCV) data
Used by optimize operations only, not during dry / live runs.
Using .copy() to get a fresh copy of the dataframe for every strategy run.
Has positive effects on memory usage for whatever reason - also when
using only one strategy.
"""
return {pair: self.advise_indicators(pair_data.copy(), {'pair': pair})
for pair, pair_data in data.items()}

@harshadvekariya
Copy link

@brusand @sn3fru @hugocen @i am facing same issue, can you please tell me how exactly did you solve it?

it is showing me error in freqtradegym.py when I run rllib_example.py

File "/home/user/Desktop/freqtrade/freqtrade/freqtradegym.py", line 45, in __init__ preprocessed = self.strategy.ohlcvdata_to_dataframe(data) AttributeError: 'IndicatorforRL' object has no attribute 'ohlcvdata_to_dataframe'

Apreciate your help! Thanks

@pnmice
Copy link

pnmice commented Jan 30, 2022

The same issue. @harshadvekariya What is your tf version? Mine is 1.12

@harshadvekariya
Copy link

@pnmice
I am using the latest one 2.7.0

@harshadvekariya
Copy link

@pnmice
I got it working by getting the preprocessing without calling function. We are basically converting json data into a dataframe, so it should be straightforward as follow.

Edit the line no 45 in freqtradegym.py to follow
preprocessed = {pair: self.strategy.advise_indicators(pair_data.copy(), {'pair': pair}) for pair, pair_data in data.items()}

Let me know if you know a better way of doing this. Thanks @brusand for the solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants