mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
use get_pair_base_currency
This commit is contained in:
parent
076ca75200
commit
b72078e76e
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user