use get_pair_base_currency

This commit is contained in:
Matthias 2024-01-27 16:07:55 +01:00
parent 076ca75200
commit b72078e76e
2 changed files with 6 additions and 3 deletions

View File

@ -153,7 +153,7 @@ class MarketCapPairList(IPairList):
top_marketcap = marketcap_list[:self._number_assets:]
for pair in pairlist:
base = pair.split('/')[0]
base = self._exchange.get_pair_base_currency(pair)
if base.lower() in top_marketcap:
filtered_pairlist.append(pair)
else:

View File

@ -1542,7 +1542,7 @@ def test_FullTradesFilter(mocker, default_conf_usdt, fee, caplog) -> None:
{"method": "MarketCapPairList", "mode": "total_assets", "number_assets": 5}
], ['ETH/USDT', 'XRP/USDT'])
])
def test_MarketCapPairList_filter(mocker, default_conf_usdt, pairlists, result):
def test_MarketCapPairList_filter(mocker, default_conf_usdt, markets, pairlists, result):
test_value = [
{
"symbol": "btc",
@ -1579,7 +1579,10 @@ def test_MarketCapPairList_filter(mocker, default_conf_usdt, pairlists, result):
default_conf_usdt['exchange']['pair_whitelist'].extend(['BTC/USDT', 'ETC/USDT'])
default_conf_usdt['trading_mode'] = 'spot'
default_conf_usdt['pairlists'] = pairlists
mocker.patch(f'{EXMS}.exchange_has', MagicMock(return_value=True))
mocker.patch.multiple(EXMS,
markets=PropertyMock(return_value=markets),
exchange_has=MagicMock(return_value=True),
)
mocker.patch("freqtrade.plugins.pairlist.MarketCapPairList.CoinGeckoAPI.get_coins_markets",
return_value=test_value)