mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
use FtCoinGeckoApi for marketCapPairlist, too
This commit is contained in:
parent
2cd3089b3a
commit
468d0f8cf0
|
@ -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.")
|
||||
|
|
|
@ -55,11 +55,11 @@ class CryptoToFiatConverter(LoggingMixin):
|
|||
def __init__(self, config: Config) -> None:
|
||||
# Timeout: 6h
|
||||
self._pair_price: TTLCache = TTLCache(maxsize=500, ttl=6 * 60 * 60)
|
||||
coingecko_config = config.get("coingecko", {})
|
||||
|
||||
_coingecko_config = config.get("coingecko", {})
|
||||
self._coingecko = FtCoinGeckoApi(
|
||||
api_key=coingecko_config.get("api_key", ""),
|
||||
is_demo=coingecko_config.get("is_demo", True),
|
||||
api_key=_coingecko_config.get("api_key", ""),
|
||||
is_demo=_coingecko_config.get("is_demo", True),
|
||||
retries=1,
|
||||
)
|
||||
LoggingMixin.__init__(self, logger, 3600)
|
||||
|
|
Loading…
Reference in New Issue
Block a user