1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2025-07-27 08:31:41 +00:00

Add list of stocks to bot

This commit is contained in:
2023-10-12 02:42:52 +00:00
parent 4a556597df
commit 66f233918e
10 changed files with 47 additions and 23 deletions

View File

@@ -65,10 +65,13 @@ class Router:
schedule.run_pending()
symbols: list[Symbol] = []
stocks = set(re.findall(self.STOCK_REGEX, text))
for stock in stocks:
stock_matches = set(re.findall(self.STOCK_REGEX, text))
for stock_match in stock_matches:
# Market data lacks tools to check if a symbol is valid.
symbols.append(Stock(stock))
if stock_info := self.stock.symbol_id(stock_match):
symbols.append(Stock(stock_info))
else:
log.info(f"{stock_match} is not in list of stocks")
coins = set(re.findall(self.CRYPTO_REGEX, text))
for coin in coins: