whitelist conflict resolved with develop branch
This commit is contained in:
@@ -61,6 +61,7 @@ class FreqtradeBot(object):
|
||||
if self.config.get('edge', {}).get('enabled', False):
|
||||
self.edge = Edge(self.config, self.exchange)
|
||||
|
||||
self.active_pair_whitelist: List[str] = self.config['exchange']['pair_whitelist']
|
||||
self._init_modules()
|
||||
|
||||
def _init_modules(self) -> None:
|
||||
@@ -114,11 +115,8 @@ class FreqtradeBot(object):
|
||||
constants.PROCESS_THROTTLE_SECS
|
||||
)
|
||||
|
||||
nb_assets = self.config.get('dynamic_whitelist', None)
|
||||
|
||||
self._throttle(func=self._process,
|
||||
min_secs=min_secs,
|
||||
nb_assets=nb_assets)
|
||||
min_secs=min_secs)
|
||||
return state
|
||||
|
||||
def _startup_messages(self) -> None:
|
||||
@@ -169,15 +167,15 @@ class FreqtradeBot(object):
|
||||
time.sleep(duration)
|
||||
return result
|
||||
|
||||
def _process(self, nb_assets: Optional[int] = 0) -> bool:
|
||||
def _process(self) -> bool:
|
||||
"""
|
||||
Queries the persistence layer for open trades and handles them,
|
||||
otherwise a new trade is created.
|
||||
:param: nb_assets: the maximum number of pairs to be traded at the same time
|
||||
:return: True if one or more trades has been created or closed, False otherwise
|
||||
"""
|
||||
state_changed = False
|
||||
try:
|
||||
nb_assets = self.config.get('dynamic_whitelist', None)
|
||||
# Refresh whitelist based on wallet maintenance
|
||||
sanitized_list = self._refresh_whitelist(
|
||||
self._gen_pair_whitelist(
|
||||
@@ -186,8 +184,7 @@ class FreqtradeBot(object):
|
||||
)
|
||||
|
||||
# Keep only the subsets of pairs wanted (up to nb_assets)
|
||||
final_list = sanitized_list[:nb_assets] if nb_assets else sanitized_list
|
||||
self.config['exchange']['pair_whitelist'] = final_list
|
||||
self.active_pair_whitelist = sanitized_list[:nb_assets] if nb_assets else sanitized_list
|
||||
|
||||
# Calculating Edge positiong
|
||||
# Should be called before refresh_tickers
|
||||
@@ -197,11 +194,20 @@ class FreqtradeBot(object):
|
||||
self.edge.calculate()
|
||||
|
||||
# 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
|
||||
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
|
||||
|
||||
# Extend active-pair whitelist with pairs from open trades
|
||||
# ensures that tickers are downloaded for open trades
|
||||
self.active_pair_whitelist.extend([trade.pair for trade in trades
|
||||
if trade.pair not in self.active_pair_whitelist])
|
||||
|
||||
# Refreshing candles
|
||||
self.exchange.refresh_tickers(self.active_pair_whitelist, self.strategy.ticker_interval)
|
||||
|
||||
# First process current opened trades
|
||||
for trade in trades:
|
||||
state_changed |= self.process_maybe_execute_sell(trade)
|
||||
@@ -389,7 +395,7 @@ class FreqtradeBot(object):
|
||||
:return: True if a trade object has been created and persisted, False otherwise
|
||||
"""
|
||||
interval = self.strategy.ticker_interval
|
||||
whitelist = copy.deepcopy(self.config['exchange']['pair_whitelist'])
|
||||
whitelist = copy.deepcopy(self.active_pair_whitelist)
|
||||
|
||||
# Remove currently opened and latest pairs from whitelist
|
||||
for trade in Trade.query.filter(Trade.is_open.is_(True)).all():
|
||||
|
||||
Reference in New Issue
Block a user