nateemma / strategies

Custom trading strategies using the freqtrade framework
321 stars 86 forks source link

ERROR - Unexpected error cannot unpack non-iterable #2

Closed kblaszczyk1 closed 1 year ago

kblaszczyk1 commented 1 year ago

Thanks for the work you put into this repository is very interesting. However, I have a question, which version of freqtrade are you using for the PCA.py strategy? On version 2022.3 I get errors of the type and I don't know how to solve it:

2022-11-06 21:25:31,470 - freqtrade.strategy.interface - WARNING - Unable to analyze candle (OHLCV) data for pair AXS/USDT: cannot unpack non-iterable LinearDiscriminantAnalysis object 2022-11-06 21:25:33,931 - freqtrade.strategy.strategy_wrapper - ERROR - Unexpected error cannot unpack non-iterable LinearDiscriminantAnalysis object calling <bound method IStrategy._analyze_ticker_internal

Let me add that I am very interested in the PCA's approach

nateemma commented 1 year ago

I haven’t seen that before, maybe try updating skyward? I upgraded freqtrade recently, so I am basically on the latest dev version. What exchange are you using?

Also, I re-wrote a lot of it last week, check out the latest version. PCA is now a base class and there are several subclasses, which basically just implement different ideas for the training signals.

You may want to check out freqAI (part of freqtrade). They have a very similar concept, but more integrated into the freqtrade framework

Let me know if the latest version still has the same issues

Thanks

Phil

On Sun, Nov 6, 2022 at 12:34 PM maveth @.***> wrote:

Thanks for the work you put into this repository is very interesting. However, I have a question, which version of freqtrade are you using for the PCA.py strategy? On version 2022.3 I get errors of the type and I don't know how to solve it:

2022-11-06 21:25:31,470 - freqtrade.strategy.interface - WARNING - Unable to analyze candle (OHLCV) data for pair AXS/USDT: cannot unpack non-iterable LinearDiscriminantAnalysis object 2022-11-06 21:25:33,931 - freqtrade.strategy.strategy_wrapper - ERROR - Unexpected error cannot unpack non-iterable LinearDiscriminantAnalysis object calling <bound method IStrategy._analyze_ticker_internal

Let me add that I am very interested in the PCA's approach

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X527HUGFKKDWK2YGHJTWHAI4XANCNFSM6AAAAAARYS4TE4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kblaszczyk1 commented 1 year ago

Thank you for your response! I have installed freqtrade develop in the latest version, the configuration is identical to your config_binanceus.json Current log message:


Warning: startup can be very slow


Lookahead:  6  candles ( 0.5  hours)
Thresholds - Profit:0.30% Loss:-0.30%

KNC/USD Profit threshold 0.3000 -> 0.1931 Loss threshold -0.3000 -> -0.1850 !!! WARNING: using default (buy) training implementation !!! !!! WARNING: using default (sell) training implementation !!!

training samples: 585 #buys: 91 #sells: 105

!!! zero values in rows (remove indicator?!) :  ['sqzmi', 'sqz_on']
KNC/USD  - input:  (585, 162)  -> pca:  (585, 100)

2022-11-07 01:38:34,497 - freqtrade.strategy.strategy_wrapper - ERROR - Unexpected error cannot unpack non-iterable LinearDiscriminantAnalysis object calling <bound method IStrategy._analyze_ticker_internal of <PCA.PCA object at 0x7f28e25a1b50>> Traceback (most recent call last): File "/opt/freqtrade-develop/freqtrade/strategy/strategy_wrapper.py", line 27, in wrapper return f(*args, **kwargs) File "/opt/freqtrade-develop/freqtrade/strategy/interface.py", line 748, in _analyze_ticker_internal dataframe = self.analyze_ticker(dataframe, metadata) File "/opt/freqtrade-develop/freqtrade/strategy/interface.py", line 726, in analyze_ticker dataframe = self.advise_indicators(dataframe, metadata) File "/opt/freqtrade-develop/freqtrade/strategy/interface.py", line 1221, in advise_indicators return self.populate_indicators(dataframe, metadata) File "/opt/strategies/binanceus/PCA.py", line 337, in populate_indicators self.train_models(curr_pair, df, buys, sells) File "/opt/strategies/binanceus/PCA.py", line 1243, in train_models buy_clf, buy_clf_name = self.get_buy_classifier(df_train_pca, train_buy_labels) File "/opt/strategies/binanceus/PCA.py", line 1409, in get_buy_classifier clf, name = self.classifier_factory(self.default_classifier, df_norm, labels) TypeError: cannot unpack non-iterable LinearDiscriminantAnalysis object 2022-11-07 01:38:34,498 - freqtrade.strategy.interface - WARNING - Unable to analyze candle (OHLCV) data for pair KNC/USD: cannot unpack non-iterable LinearDiscriminantAnalysis object

nateemma commented 1 year ago

Hmm, not sure what's going on here.

Try "pip install sklearn", which should update. that (sklearn) library

What platform are you using for development? I use a Mac and haven't tried anything else.

Try running PCA_swing instead of PCA.

If that doesn't work, we'll try contacting the freqtrade team

Cheers,

Phil

On Sun, Nov 6, 2022 at 4:47 PM maveth @.***> wrote:

Thank you for your response! How to update the skyward? I have installed freqtrade develop in the latest version, the configuration is identical to your config_binanceus.json Current log message:

Warning: startup can be very slow

Lookahead: 6 candles ( 0.5 hours) Thresholds - Profit:0.30% Loss:-0.30%

KNC/USD Profit threshold 0.3000 -> 0.1931 Loss threshold -0.3000 -> -0.1850 !!! WARNING: using default (buy) training implementation !!! !!! WARNING: using default (sell) training implementation !!!

training samples: 585 #buys: 91 #sells: 105

!!! zero values in rows (remove indicator?!) : ['sqzmi', 'sqz_on'] KNC/USD - input: (585, 162) -> pca: (585, 100) 2022-11-07 01:38:34,497 - freqtrade.strategy.strategy_wrapper - ERROR - Unexpected error cannot unpack non-iterable LinearDiscriminantAnalysis object calling <bound method IStrategy._analyze_ticker_internal of <PCA.PCA object at 0x7f28e25a1b50>> Traceback (most recent call last): File "/opt/freqtrade-develop/freqtrade/strategy/strategy_wrapper.py", line 27, in wrapper return f(*args, **kwargs) File "/opt/freqtrade-develop/freqtrade/strategy/interface.py", line 748, in _analyze_ticker_internal dataframe = self.analyze_ticker(dataframe, metadata) File "/opt/freqtrade-develop/freqtrade/strategy/interface.py", line 726, in analyze_ticker dataframe = self.advise_indicators(dataframe, metadata) File "/opt/freqtrade-develop/freqtrade/strategy/interface.py", line 1221, in advise_indicators return self.populate_indicators(dataframe, metadata) File "/opt/strategies/binanceus/PCA.py", line 337, in populate_indicators self.train_models(curr_pair, df, buys, sells) File "/opt/strategies/binanceus/PCA.py", line 1243, in train_models buy_clf, buy_clf_name = self.get_buy_classifier(df_train_pca, train_buy_labels) File "/opt/strategies/binanceus/PCA.py", line 1409, in get_buy_classifier clf, name = self.classifier_factory(self.default_classifier, df_norm, labels) TypeError: cannot unpack non-iterable LinearDiscriminantAnalysis object 2022-11-07 01:38:34,498 - freqtrade.strategy.interface - WARNING - Unable to analyze candle (OHLCV) data for pair KNC/USD: cannot unpack non-iterable LinearDiscriminantAnalysis object

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/2#issuecomment-1304953271, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X55K5IGODTPGMHZBKTDWHBGTHANCNFSM6AAAAAARYS4TE4 . You are receiving this because you commented.Message ID: @.***>

kblaszczyk1 commented 1 year ago

I updated my sklearn but it didn't do anything. I am using rhel as my operating environment I ran PCA_swing for test and it works fine and doesn't report any error / warn

nateemma commented 1 year ago

OK, so you are good for now?

Note that I am currently working on those strategies, they are not yet stable...

Thanks,

Phil

On Mon, Nov 7, 2022 at 12:52 AM maveth @.***> wrote:

I updated my sklearn but it didn't do anything. I am using rhel as my operating environment I ran PCA_swing for test and it works fine and doesn't report any error / warn

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/2#issuecomment-1305278720, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X52D3Z3SXMYV2LRQQI3WHC7LRANCNFSM6AAAAAARYS4TE4 . You are receiving this because you commented.Message ID: @.***>

kblaszczyk1 commented 1 year ago

I mean the PCA.py strategy is still not working properly, but PCAswing.py is working properly. I understand that the main class of PCA should not be used, PCA * should be used instead?

nateemma commented 1 year ago

OK, I fixed the error. You shouldn't really be using PCA directly though, it will not perform well

Thanks,

Phil

On Mon, Nov 7, 2022 at 9:26 AM maveth @.***> wrote:

I mean the PCA.py strategy is still not working properly, but PCA_swing.py is working properly

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/2#issuecomment-1305947326, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X5YISQ6N6OU7RGFZKKLWHE3UJANCNFSM6AAAAAARYS4TE4 . You are receiving this because you commented.Message ID: @.***>

kblaszczyk1 commented 1 year ago

Thank you for your help!

nateemma commented 1 year ago

actually, hold off on that. The fix broke the subclasses...

On Mon, Nov 7, 2022 at 9:55 AM maveth @.***> wrote:

Thank you for your help!

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/2#issuecomment-1305979711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X5ZMF43OWOS252WZWODWHE7BNANCNFSM6AAAAAARYS4TE4 . You are receiving this because you commented.Message ID: @.***>

nateemma commented 1 year ago

OK, fixed (again)...

On Mon, Nov 7, 2022 at 9:57 AM Phil Price @.***> wrote:

actually, hold off on that. The fix broke the subclasses...

On Mon, Nov 7, 2022 at 9:55 AM maveth @.***> wrote:

Thank you for your help!

— Reply to this email directly, view it on GitHub https://github.com/nateemma/strategies/issues/2#issuecomment-1305979711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD4X5ZMF43OWOS252WZWODWHE7BNANCNFSM6AAAAAARYS4TE4 . You are receiving this because you commented.Message ID: @.***>

kblaszczyk1 commented 1 year ago

After your fix, the main PCA class works fine when I used --strategy PCA