Merge branch 'develop' into pr/wizrds/7303

This commit is contained in:
Matthias
2022-09-20 06:56:15 +02:00
103 changed files with 1189 additions and 442 deletions

View File

@@ -6,6 +6,7 @@ import logging
from pathlib import Path
from typing import Any, Dict, Iterator, List, Tuple, Type, Union
from freqtrade.constants import Config
from freqtrade.exceptions import OperationalException
from freqtrade.misc import deep_merge_dicts, json_load
from freqtrade.optimize.hyperopt_tools import HyperoptTools
@@ -21,7 +22,7 @@ class HyperStrategyMixin:
strategy logic.
"""
def __init__(self, config: Dict[str, Any], *args, **kwargs):
def __init__(self, config: Config, *args, **kwargs):
"""
Initialize hyperoptable strategy mixin.
"""

View File

@@ -10,7 +10,7 @@ from typing import Dict, List, Optional, Tuple, Union
import arrow
from pandas import DataFrame
from freqtrade.constants import ListPairsWithTimeframes
from freqtrade.constants import Config, ListPairsWithTimeframes
from freqtrade.data.dataprovider import DataProvider
from freqtrade.enums import (CandleType, ExitCheckTuple, ExitType, RunMode, SignalDirection,
SignalTagType, SignalType, TradingMode)
@@ -119,7 +119,7 @@ class IStrategy(ABC, HyperStrategyMixin):
# Definition of plot_config. See plotting documentation for more details.
plot_config: Dict = {}
def __init__(self, config: dict) -> None:
def __init__(self, config: Config) -> None:
self.config = config
# Dict to determine if analysis is necessary
self._last_candle_seen_per_pair: Dict[str, datetime] = {}
@@ -614,6 +614,22 @@ class IStrategy(ABC, HyperStrategyMixin):
# END - Intended to be overridden by strategy
###
def __informative_pairs_freqai(self) -> ListPairsWithTimeframes:
"""
Create informative-pairs needed for FreqAI
"""
if self.config.get('freqai', {}).get('enabled', False):
whitelist_pairs = self.dp.current_whitelist()
candle_type = self.config.get('candle_type_def', CandleType.SPOT)
corr_pairs = self.config["freqai"]["feature_parameters"]["include_corr_pairlist"]
informative_pairs = []
for tf in self.config["freqai"]["feature_parameters"]["include_timeframes"]:
for pair in set(whitelist_pairs + corr_pairs):
informative_pairs.append((pair, tf, candle_type))
return informative_pairs
return []
def gather_informative_pairs(self) -> ListPairsWithTimeframes:
"""
Internal method which gathers all informative pairs (user or automatically defined).
@@ -638,6 +654,7 @@ class IStrategy(ABC, HyperStrategyMixin):
else:
for pair in self.dp.current_whitelist():
informative_pairs.append((pair, inf_data.timeframe, candle_type))
informative_pairs.extend(self.__informative_pairs_freqai())
return list(set(informative_pairs))
def get_strategy_name(self) -> str: