Convert InformativeData to dataclass

This commit is contained in:
Matthias
2022-01-29 19:59:54 +01:00
parent ab932d8398
commit 8a6823deb1
3 changed files with 11 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
from typing import Any, Callable, NamedTuple, Optional, Union
from dataclasses import dataclass
from typing import Any, Callable, Optional, Union
from pandas import DataFrame
@@ -10,7 +11,8 @@ from freqtrade.strategy.strategy_helper import merge_informative_pair
PopulateIndicators = Callable[[Any, DataFrame, dict], DataFrame]
class InformativeData(NamedTuple):
@dataclass
class InformativeData:
asset: Optional[str]
timeframe: str
fmt: Union[str, Callable[[Any], str], None]

View File

@@ -158,9 +158,7 @@ class IStrategy(ABC, HyperStrategyMixin):
raise OperationalException('Informative timeframe must be equal or higher than '
'strategy timeframe!')
if not informative_data.candle_type:
informative_data = InformativeData(
informative_data.asset, informative_data.timeframe, informative_data.fmt,
informative_data.ffill, config['candle_type_def'])
informative_data.candle_type = config['candle_type_def']
self._ft_informative.append((informative_data, cls_method))
@abstractmethod