diff --git a/freqtrade/plugins/pairlist/MarketCapPairList.py b/freqtrade/plugins/pairlist/MarketCapPairList.py index 2394e910e..874e7bb2c 100644 --- a/freqtrade/plugins/pairlist/MarketCapPairList.py +++ b/freqtrade/plugins/pairlist/MarketCapPairList.py @@ -5,6 +5,7 @@ Provides dynamic pair list based on Market Cap """ import logging +import math from cachetools import TTLCache @@ -56,8 +57,8 @@ class MarketCapPairList(IPairList): f"You can choose from {category_ids}" ) - if self._max_rank > 250: - raise OperationalException("This filter only support marketcap rank up to 250.") + if self._max_rank > 1000: + raise OperationalException("This filter only support marketcap rank up to 1000.") @property def needstickers(self) -> bool: @@ -165,7 +166,11 @@ class MarketCapPairList(IPairList): data = [] if not self._categories: - data = self._coingecko.get_coins_markets(**default_kwargs) + pages_required = math.ceil(self._max_rank / 250) + for page in range(1, pages_required + 1): + default_kwargs["page"] = page + page_data = self._coingecko.get_coins_markets(**default_kwargs) + data.extend(page_data) else: for category in self._categories: category_data = self._coingecko.get_coins_markets( diff --git a/tests/plugins/test_pairlist.py b/tests/plugins/test_pairlist.py index 1c138cc55..0cb1df323 100644 --- a/tests/plugins/test_pairlist.py +++ b/tests/plugins/test_pairlist.py @@ -2458,10 +2458,10 @@ def test_MarketCapPairList_exceptions(mocker, default_conf_usdt): PairListManager(exchange, default_conf_usdt) default_conf_usdt["pairlists"] = [ - {"method": "MarketCapPairList", "number_assets": 20, "max_rank": 260} + {"method": "MarketCapPairList", "number_assets": 20, "max_rank": 1010} ] with pytest.raises( - OperationalException, match="This filter only support marketcap rank up to 250." + OperationalException, match="This filter only support marketcap rank up to 1000." ): PairListManager(exchange, default_conf_usdt)