load generic class if no subclass exists

This commit is contained in:
iuvbio 2019-02-17 14:42:55 +01:00
parent d3ead2cd09
commit fe792882b5
2 changed files with 8 additions and 3 deletions

View File

@ -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)

View File

@ -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(