mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 20:23:57 +00:00
format
This commit is contained in:
parent
514558796b
commit
8aefae3aff
|
@ -38,6 +38,7 @@ class __OptionPairlistParameter(__PairlistParameterBase):
|
|||
default: Union[str, None]
|
||||
options: List[str]
|
||||
|
||||
|
||||
class __ListPairListParamenter(__PairlistParameterBase):
|
||||
type: Literal["list"]
|
||||
default: Union[List[str], None]
|
||||
|
@ -54,7 +55,7 @@ PairlistParameter = Union[
|
|||
__StringPairlistParameter,
|
||||
__OptionPairlistParameter,
|
||||
__BoolPairlistParameter,
|
||||
__ListPairListParamenter
|
||||
__ListPairListParamenter,
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -47,12 +47,13 @@ class MarketCapPairList(IPairList):
|
|||
|
||||
if self._categories:
|
||||
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]
|
||||
|
||||
for category in self._categories:
|
||||
if category not in category_ids:
|
||||
raise OperationalException(
|
||||
f"category not in coingecko category list you can choose from {category_ids}")
|
||||
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.")
|
||||
|
@ -160,18 +161,15 @@ class MarketCapPairList(IPairList):
|
|||
data = []
|
||||
|
||||
if not self._categories:
|
||||
data = self._coingecko.get_coins_markets(
|
||||
**default_kwargs
|
||||
)
|
||||
data = self._coingecko.get_coins_markets(**default_kwargs)
|
||||
else:
|
||||
for category in self._categories:
|
||||
category_data = self._coingecko.get_coins_markets(
|
||||
**default_kwargs,
|
||||
**({"category": category} if category else {})
|
||||
**default_kwargs, **({"category": category} if category else {})
|
||||
)
|
||||
data += category_data
|
||||
|
||||
data.sort(key=lambda d: float(d['market_cap'] or 0.0), reverse=True)
|
||||
data.sort(key=lambda d: float(d["market_cap"] or 0.0), reverse=True)
|
||||
|
||||
if data:
|
||||
marketcap_list = [row["symbol"] for row in data]
|
||||
|
|
Loading…
Reference in New Issue
Block a user