diff --git a/freqtrade/exchange/exchange.py b/freqtrade/exchange/exchange.py index 65b9fb628..348f9c395 100644 --- a/freqtrade/exchange/exchange.py +++ b/freqtrade/exchange/exchange.py @@ -86,7 +86,7 @@ class Exchange: # TradingMode.SPOT always supported and not required in this list ] - def __init__(self, config: Dict[str, Any], validate: bool = True) -> None: + def __init__(self, config: Dict[str, Any], validate: bool = True, freqai: bool = False) -> None: """ Initializes this module with the given config, it does basic validation whether the specified exchange and pairs are valid. @@ -196,7 +196,7 @@ class Exchange: self.markets_refresh_interval: int = exchange_config.get( "markets_refresh_interval", 60) * 60 - if self.trading_mode != TradingMode.SPOT: + if self.trading_mode != TradingMode.SPOT and freqai is False: self.fill_leverage_tiers() self.additional_exchange_init() diff --git a/freqtrade/freqai/data_kitchen.py b/freqtrade/freqai/data_kitchen.py index 9866ee33a..93e7b74ad 100644 --- a/freqtrade/freqai/data_kitchen.py +++ b/freqtrade/freqai/data_kitchen.py @@ -714,7 +714,7 @@ class FreqaiDataKitchen: def download_new_data_for_retraining(self, timerange: TimeRange, metadata: dict) -> None: exchange = ExchangeResolver.load_exchange(self.config['exchange']['name'], - self.config, validate=False) + self.config, validate=False, freqai=True) pairs = copy.deepcopy(self.freqai_config.get('corr_pairlist', [])) if str(metadata['pair']) not in pairs: pairs.append(str(metadata['pair'])) diff --git a/freqtrade/resolvers/exchange_resolver.py b/freqtrade/resolvers/exchange_resolver.py index 4dfbf445b..c1ec8b69c 100644 --- a/freqtrade/resolvers/exchange_resolver.py +++ b/freqtrade/resolvers/exchange_resolver.py @@ -18,7 +18,8 @@ class ExchangeResolver(IResolver): object_type = Exchange @staticmethod - def load_exchange(exchange_name: str, config: dict, validate: bool = True) -> Exchange: + def load_exchange(exchange_name: str, config: dict, validate: bool = True, + freqai: bool = False) -> Exchange: """ Load the custom class from config parameter :param exchange_name: name of the Exchange to load @@ -31,7 +32,8 @@ class ExchangeResolver(IResolver): try: exchange = ExchangeResolver._load_exchange(exchange_name, kwargs={'config': config, - 'validate': validate}) + 'validate': validate, + 'freqai': freqai}) except ImportError: logger.info( f"No {exchange_name} specific subclass found. Using the generic class instead.")