Don't overwrite pair_whitelist in config dict

Doing that will result in an empty whitelist after a short Exchange
downtime
This commit is contained in:
Matthias 2018-10-28 13:15:49 +01:00
parent db9a85f4a2
commit 551dc79cf7

View File

@ -54,6 +54,7 @@ class FreqtradeBot(object):
self.rpc: RPCManager = RPCManager(self) self.rpc: RPCManager = RPCManager(self)
self.persistence = None self.persistence = None
self.exchange = Exchange(self.config) self.exchange = Exchange(self.config)
self.active_pair_whitelist: List[str] = self.config['exchange']['pair_whitelist']
self._init_modules() self._init_modules()
def _init_modules(self) -> None: def _init_modules(self) -> None:
@ -179,11 +180,10 @@ class FreqtradeBot(object):
) )
# Keep only the subsets of pairs wanted (up to nb_assets) # Keep only the subsets of pairs wanted (up to nb_assets)
final_list = sanitized_list[:nb_assets] if nb_assets else sanitized_list self.active_pair_whitelist = sanitized_list[:nb_assets] if nb_assets else sanitized_list
self.config['exchange']['pair_whitelist'] = final_list
# Refreshing candles # Refreshing candles
self.exchange.refresh_tickers(final_list, self.strategy.ticker_interval) self.exchange.refresh_tickers(self.active_pair_whitelist, self.strategy.ticker_interval)
# Query trades from persistence layer # Query trades from persistence layer
trades = Trade.query.filter(Trade.is_open.is_(True)).all() trades = Trade.query.filter(Trade.is_open.is_(True)).all()
@ -380,7 +380,7 @@ class FreqtradeBot(object):
'Checking buy signals to create a new trade with stake_amount: %f ...', 'Checking buy signals to create a new trade with stake_amount: %f ...',
stake_amount stake_amount
) )
whitelist = copy.deepcopy(self.config['exchange']['pair_whitelist']) whitelist = copy.deepcopy(self.active_pair_whitelist)
# Remove currently opened and latest pairs from whitelist # Remove currently opened and latest pairs from whitelist
for trade in Trade.query.filter(Trade.is_open.is_(True)).all(): for trade in Trade.query.filter(Trade.is_open.is_(True)).all():