This commit is contained in:
Matthias 2019-11-09 14:44:39 +01:00
parent 02b9da8aba
commit a01b34a004
2 changed files with 30 additions and 2 deletions

View File

@ -73,7 +73,7 @@ class IPairList(ABC):
""" """
return IPairList.verify_blacklist(pairlist, self._pairlistmanager.blacklist) return IPairList.verify_blacklist(pairlist, self._pairlistmanager.blacklist)
def _whitelist_for_active_markets(self, whitelist: List[str]) -> List[str]: def _whitelist_for_active_markets(self, pairlist: List[str]) -> List[str]:
""" """
Check available markets and remove pair from whitelist if necessary Check available markets and remove pair from whitelist if necessary
:param whitelist: the sorted list of pairs the user might want to trade :param whitelist: the sorted list of pairs the user might want to trade
@ -83,7 +83,7 @@ class IPairList(ABC):
markets = self._exchange.markets markets = self._exchange.markets
sanitized_whitelist: List[str] = [] sanitized_whitelist: List[str] = []
for pair in whitelist: for pair in pairlist:
# pair is not in the generated dynamic market or has the wrong stake currency # pair is not in the generated dynamic market or has the wrong stake currency
if (pair not in markets or not pair.endswith(self._config['stake_currency'])): if (pair not in markets or not pair.endswith(self._config['stake_currency'])):
logger.warning(f"Pair {pair} is not compatible with exchange " logger.warning(f"Pair {pair} is not compatible with exchange "

View File

@ -229,3 +229,31 @@ def test__whitelist_for_active_markets(mocker, whitelist_conf, markets, pairlist
assert set(new_whitelist) == set(['ETH/BTC', 'TKN/BTC']) assert set(new_whitelist) == set(['ETH/BTC', 'TKN/BTC'])
assert log_message in caplog.text assert log_message in caplog.text
def test_volumepairlist_invalid_sortvalue(mocker, markets, whitelist_conf):
whitelist_conf['pairlists'][0]['config'].update({"sort_key": "asdf"})
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
with pytest.raises(OperationalException,
match=r"key asdf not in .*"):
get_patched_freqtradebot(mocker, whitelist_conf)
def test_volumepairlist_caching(mocker, markets, whitelist_conf, tickers):
mocker.patch.multiple('freqtrade.exchange.Exchange',
markets=PropertyMock(return_value=markets),
exchange_has=MagicMock(return_value=True),
get_tickers=tickers
)
bot = get_patched_freqtradebot(mocker, whitelist_conf)
assert bot.pairlists._pairlists[0]._last_refresh == 0
bot.pairlists.refresh_pairlist()
assert bot.pairlists._pairlists[0]._last_refresh != 0
lrf = bot.pairlists._pairlists[0]._last_refresh
bot.pairlists.refresh_pairlist()
# Time should not be updated.
assert bot.pairlists._pairlists[0]._last_refresh == lrf