|
|
|
|
@ -8,12 +8,12 @@ import logging
|
|
|
|
|
from typing import Any, Dict, List
|
|
|
|
|
|
|
|
|
|
from cachetools import TTLCache
|
|
|
|
|
from pycoingecko import CoinGeckoAPI
|
|
|
|
|
|
|
|
|
|
from freqtrade.constants import Config
|
|
|
|
|
from freqtrade.exceptions import OperationalException
|
|
|
|
|
from freqtrade.exchange.types import Tickers
|
|
|
|
|
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter
|
|
|
|
|
from freqtrade.util.coin_gecko import FtCoinGeckoApi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
@ -44,7 +44,13 @@ class MarketCapPairList(IPairList):
|
|
|
|
|
self._refresh_period = self._pairlistconfig.get("refresh_period", 86400)
|
|
|
|
|
self._marketcap_cache: TTLCache = TTLCache(maxsize=1, ttl=self._refresh_period)
|
|
|
|
|
self._def_candletype = self._config["candle_type_def"]
|
|
|
|
|
self._coingecko: CoinGeckoAPI = CoinGeckoAPI()
|
|
|
|
|
|
|
|
|
|
_coingecko_config = config.get("coingecko", {})
|
|
|
|
|
|
|
|
|
|
self._coingecko: FtCoinGeckoApi = FtCoinGeckoApi(
|
|
|
|
|
api_key=_coingecko_config.get("api_key", ""),
|
|
|
|
|
is_demo=_coingecko_config.get("is_demo", True),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if self._max_rank > 250:
|
|
|
|
|
raise OperationalException("This filter only support marketcap rank up to 250.")
|
|
|
|
|
|