Dataframe should be copied after populate_indicator

Without that, PerformanceWarnings can appear throughout hyperopt which
are unnecessary and missleading for users

closes #5408
This commit is contained in:
Matthias 2021-09-15 19:56:12 +02:00
parent e4ec5679a1
commit f7bae81d96

View File

@ -777,10 +777,11 @@ class IStrategy(ABC, HyperStrategyMixin):
Does not run advise_buy or advise_sell!
Used by optimize operations only, not during dry / live runs.
Using .copy() to get a fresh copy of the dataframe for every strategy run.
Also copy on output to avoid PerformanceWarnings pandas 1.3.0 started to show.
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})
return {pair: self.advise_indicators(pair_data.copy(), {'pair': pair}).copy()
for pair, pair_data in data.items()}
def advise_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: