mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-09-20 01:21:11 +00:00
adding category list if the category is not from the category
This commit is contained in:
parent
03ee3aaf40
commit
660623181a
|
@ -14,6 +14,7 @@ from freqtrade.exchange.exchange_types import Tickers
|
||||||
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
|
from freqtrade.plugins.pairlist.IPairList import IPairList, PairlistParameter, SupportsBacktesting
|
||||||
from freqtrade.util.coin_gecko import FtCoinGeckoApi
|
from freqtrade.util.coin_gecko import FtCoinGeckoApi
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,10 +47,12 @@ class MarketCapPairList(IPairList):
|
||||||
)
|
)
|
||||||
|
|
||||||
categories = self._coingecko.get_coins_categories_list()
|
categories = self._coingecko.get_coins_categories_list()
|
||||||
category_ids = [cat['category_id'] for cat in categories]
|
category_ids = [cat["category_id"] for cat in categories]
|
||||||
|
|
||||||
if self._category not in category_ids:
|
if self._category not in category_ids:
|
||||||
raise OperationalException(f"category not in coingecko category list you can choose from {category_ids}")
|
raise OperationalException(
|
||||||
|
f"category not in coingecko category list you can choose from {category_ids}"
|
||||||
|
)
|
||||||
|
|
||||||
if self._max_rank > 250:
|
if self._max_rank > 250:
|
||||||
raise OperationalException("This filter only support marketcap rank up to 250.")
|
raise OperationalException("This filter only support marketcap rank up to 250.")
|
||||||
|
@ -145,7 +148,6 @@ class MarketCapPairList(IPairList):
|
||||||
marketcap_list = self._marketcap_cache.get("marketcap")
|
marketcap_list = self._marketcap_cache.get("marketcap")
|
||||||
|
|
||||||
if marketcap_list is None:
|
if marketcap_list is None:
|
||||||
|
|
||||||
data = self._coingecko.get_coins_markets(
|
data = self._coingecko.get_coins_markets(
|
||||||
vs_currency="usd",
|
vs_currency="usd",
|
||||||
order="market_cap_desc",
|
order="market_cap_desc",
|
||||||
|
@ -153,7 +155,7 @@ class MarketCapPairList(IPairList):
|
||||||
page="1",
|
page="1",
|
||||||
sparkline="false",
|
sparkline="false",
|
||||||
locale="en",
|
locale="en",
|
||||||
**({"category": self._category} if self._category else {})
|
**({"category": self._category} if self._category else {}),
|
||||||
)
|
)
|
||||||
if data:
|
if data:
|
||||||
marketcap_list = [row["symbol"] for row in data]
|
marketcap_list = [row["symbol"] for row in data]
|
||||||
|
@ -167,7 +169,7 @@ class MarketCapPairList(IPairList):
|
||||||
if market == "futures":
|
if market == "futures":
|
||||||
pair_format += f":{self._stake_currency.upper()}"
|
pair_format += f":{self._stake_currency.upper()}"
|
||||||
|
|
||||||
top_marketcap = marketcap_list[: self._max_rank:]
|
top_marketcap = marketcap_list[: self._max_rank :]
|
||||||
|
|
||||||
for mc_pair in top_marketcap:
|
for mc_pair in top_marketcap:
|
||||||
test_pair = f"{mc_pair.upper()}/{pair_format}"
|
test_pair = f"{mc_pair.upper()}/{pair_format}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user