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

@@ -284,6 +284,30 @@ class Router:
return replies
def trending(self) -> str:
"""Checks APIs for trending symbols.
Returns
-------
list[str]
List of preformatted strings to be sent to user.
"""
stocks = self.stock.trending()
coins = self.crypto.trending()
reply = "`Trending Stocks:\n"
reply += "-" * len("Trending Stocks:") + "\n"
for stock in stocks:
reply += stock + "\n"
reply += "\n\nTrending Crypto:\n"
reply += "-" * len("Trending Crypto:") + "\n"
for coin in coins:
reply += coin + "\n"
return reply + "`"
def random_pick(self) -> str:
choice = random.choice(