From fe792882b5f7457f8c1a0e2f33c5976ea28149c0 Mon Sep 17 00:00:00 2001 From: iuvbio Date: Sun, 17 Feb 2019 14:42:55 +0100 Subject: [PATCH] load generic class if no subclass exists --- freqtrade/freqtradebot.py | 9 +++++++-- freqtrade/resolvers/exchange_resolver.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index fb132d605..588b959d3 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -17,6 +17,7 @@ from freqtrade import (DependencyException, OperationalException, from freqtrade.data.converter import order_book_to_dataframe from freqtrade.data.dataprovider import DataProvider from freqtrade.edge import Edge +from freqtrade.exchange import Exchange from freqtrade.persistence import Trade from freqtrade.rpc import RPCManager, RPCMessageType from freqtrade.resolvers import ExchangeResolver, StrategyResolver, PairListResolver @@ -55,8 +56,12 @@ class FreqtradeBot(object): self.rpc: RPCManager = RPCManager(self) - exchange_name = self.config.get('exchange', {}).get('name', 'binance') - self.exchange = ExchangeResolver(exchange_name, self, self.config) + exchange_name = self.config.get('exchange', {}).get('name', 'bittrex') + try: + self.exchange = ExchangeResolver(exchange_name, self, self.config).exchange + except ImportError: + logger.info(f"No {exchange_name} specific subclass found. Using the generic class instead.") + self.exchange = Exchange(self.config) self.wallets = Wallets(self.exchange) self.dataprovider = DataProvider(self.config, self.exchange) diff --git a/freqtrade/resolvers/exchange_resolver.py b/freqtrade/resolvers/exchange_resolver.py index b2c301982..5d46becf5 100644 --- a/freqtrade/resolvers/exchange_resolver.py +++ b/freqtrade/resolvers/exchange_resolver.py @@ -22,7 +22,7 @@ class ExchangeResolver(IResolver): Load the custom class from config parameter :param config: configuration dictionary or None """ - self.pairlist = self._load_exchange(exchange_name, kwargs={'freqtrade': freqtrade, + self.exchange = self._load_exchange(exchange_name, kwargs={'freqtrade': freqtrade, 'config': config}) def _load_exchange(