mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
Compare commits
7 Commits
a161ac9d3a
...
8a9c9d1cf2
Author | SHA1 | Date | |
---|---|---|---|
|
8a9c9d1cf2 | ||
|
50f07e7b11 | ||
|
660623181a | ||
|
03ee3aaf40 | ||
|
0b7cb2a1a8 | ||
|
92af01b0cb | ||
|
dc26d0d7ba |
|
@ -35,6 +35,7 @@ class MarketCapPairList(IPairList):
|
|||
self._number_assets = self._pairlistconfig["number_assets"]
|
||||
self._max_rank = self._pairlistconfig.get("max_rank", 30)
|
||||
self._refresh_period = self._pairlistconfig.get("refresh_period", 86400)
|
||||
self._category = self._pairlistconfig.get("category", None)
|
||||
self._marketcap_cache: TTLCache = TTLCache(maxsize=1, ttl=self._refresh_period)
|
||||
self._def_candletype = self._config["candle_type_def"]
|
||||
|
||||
|
@ -45,6 +46,15 @@ class MarketCapPairList(IPairList):
|
|||
is_demo=_coingecko_config.get("is_demo", True),
|
||||
)
|
||||
|
||||
if self._category:
|
||||
categories = self._coingecko.get_coins_categories_list()
|
||||
category_ids = [cat["category_id"] for cat in categories]
|
||||
|
||||
if self._category not in category_ids:
|
||||
raise OperationalException(
|
||||
f"category not in coingecko category list you can choose from {category_ids}"
|
||||
)
|
||||
|
||||
if self._max_rank > 250:
|
||||
raise OperationalException("This filter only support marketcap rank up to 250.")
|
||||
|
||||
|
@ -85,6 +95,12 @@ class MarketCapPairList(IPairList):
|
|||
"description": "Max rank of assets",
|
||||
"help": "Maximum rank of assets to use from the pairlist",
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"default": None,
|
||||
"description": "The Category",
|
||||
"help": "Th Category of the coin e.g layer-1 default None",
|
||||
},
|
||||
"refresh_period": {
|
||||
"type": "number",
|
||||
"default": 86400,
|
||||
|
@ -140,6 +156,7 @@ class MarketCapPairList(IPairList):
|
|||
page="1",
|
||||
sparkline="false",
|
||||
locale="en",
|
||||
**({"category": self._category} if self._category else {}),
|
||||
)
|
||||
if data:
|
||||
marketcap_list = [row["symbol"] for row in data]
|
||||
|
|
Loading…
Reference in New Issue
Block a user