1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-07-22 22:21:33 +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

@@ -424,3 +424,18 @@ class IEX_Symbol:
return m
else:
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
"""
stocks = r.get(
f"https://cloud.iexapis.com/stable/stock/market/list/mostactive?token={self.IEX_TOKEN}"
).json()
return [f"${s['symbol']}: {s['companyName']}" for s in stocks]