1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-07-25 07:31:48 +00:00

added /trending command

This commit is contained in:
2021-03-28 23:31:21 -07:00
parent a4befde8ce
commit f4adfb1915
5 changed files with 76 additions and 8 deletions

View File

@@ -263,3 +263,18 @@ class cg_Crypto:
return f"{symbol} does not have a description available."
return f"No information found for: {symbol}\nEither today is boring or the symbol does not exist."
def trending(self) -> list[str]:
"""Gets current coins trending on coingecko
Returns
-------
list[str]
list of $$ID: NAME
"""
coins = r.get("https://api.coingecko.com/api/v3/search/trending").json()[
"coins"
]
return [f"$${c['item']['id'].upper()}: {c['item']['name']}" for c in coins]