Merge pull request #4296 from freqtrade/fix/pairlistbug
Fix disappearing pairs pairlist bug
This commit is contained in:
commit
a69fde39e5
@ -168,7 +168,7 @@ class IPairList(LoggingMixin, ABC):
|
||||
# Check if market is active
|
||||
market = markets[pair]
|
||||
if not market_is_active(market):
|
||||
logger.info(f"Ignoring {pair} from whitelist. Market is not active.")
|
||||
self.log_once(f"Ignoring {pair} from whitelist. Market is not active.", logger.info)
|
||||
continue
|
||||
if pair not in sanitized_whitelist:
|
||||
sanitized_whitelist.append(pair)
|
||||
|
@ -59,17 +59,6 @@ class PairListManager():
|
||||
"""The expanded blacklist (including wildcard expansion)"""
|
||||
return expand_pairlist(self._blacklist, self._exchange.get_markets().keys())
|
||||
|
||||
@property
|
||||
def expanded_whitelist_keep_invalid(self) -> List[str]:
|
||||
"""The expanded whitelist (including wildcard expansion), maintaining invalid pairs"""
|
||||
return expand_pairlist(self._whitelist, self._exchange.get_markets().keys(),
|
||||
keep_invalid=True)
|
||||
|
||||
@property
|
||||
def expanded_whitelist(self) -> List[str]:
|
||||
"""The expanded whitelist (including wildcard expansion), filtering invalid pairs"""
|
||||
return expand_pairlist(self._whitelist, self._exchange.get_markets().keys())
|
||||
|
||||
@property
|
||||
def name_list(self) -> List[str]:
|
||||
"""Get list of loaded Pairlist Handler names"""
|
||||
@ -153,10 +142,8 @@ class PairListManager():
|
||||
:return: pairlist - whitelisted pairs
|
||||
"""
|
||||
try:
|
||||
if keep_invalid:
|
||||
whitelist = self.expanded_whitelist_keep_invalid
|
||||
else:
|
||||
whitelist = self.expanded_whitelist
|
||||
|
||||
whitelist = expand_pairlist(pairlist, self._exchange.get_markets().keys(), keep_invalid)
|
||||
except ValueError as err:
|
||||
logger.error(f"Pair whitelist contains an invalid Wildcard: {err}")
|
||||
return []
|
||||
|
@ -126,6 +126,20 @@ def test_load_pairlist_noexist(mocker, markets, default_conf):
|
||||
default_conf, {}, 1)
|
||||
|
||||
|
||||
def test_load_pairlist_verify_multi(mocker, markets, default_conf):
|
||||
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
||||
mocker.patch('freqtrade.exchange.Exchange.markets', PropertyMock(return_value=markets))
|
||||
plm = PairListManager(freqtrade.exchange, default_conf)
|
||||
# Call different versions one after the other, should always consider what was passed in
|
||||
# and have no side-effects (therefore the same check multiple times)
|
||||
assert plm.verify_whitelist(['ETH/BTC', 'XRP/BTC', ], print) == ['ETH/BTC', 'XRP/BTC']
|
||||
assert plm.verify_whitelist(['ETH/BTC', 'XRP/BTC', 'BUUU/BTC'], print) == ['ETH/BTC', 'XRP/BTC']
|
||||
assert plm.verify_whitelist(['XRP/BTC', 'BUUU/BTC'], print) == ['XRP/BTC']
|
||||
assert plm.verify_whitelist(['ETH/BTC', 'XRP/BTC', ], print) == ['ETH/BTC', 'XRP/BTC']
|
||||
assert plm.verify_whitelist(['ETH/USDT', 'XRP/USDT', ], print) == ['ETH/USDT', ]
|
||||
assert plm.verify_whitelist(['ETH/BTC', 'XRP/BTC', ], print) == ['ETH/BTC', 'XRP/BTC']
|
||||
|
||||
|
||||
def test_refresh_market_pair_not_in_whitelist(mocker, markets, static_pl_conf):
|
||||
|
||||
freqtrade = get_patched_freqtradebot(mocker, static_pl_conf)
|
||||
|
Loading…
Reference in New Issue
Block a user