mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-06-16 15:06:53 +00:00
hopeful fix for #77
This commit is contained in:
parent
e9639f3538
commit
20ec52fc22
@ -31,14 +31,16 @@ class Router:
|
||||
def trending_decay(self, decay=0.5):
|
||||
"""Decays the value of each trending stock by a multiplier"""
|
||||
|
||||
info("Decaying trending symbols.")
|
||||
if self.trending_count:
|
||||
for key in self.trending_count.keys():
|
||||
if self.trending_count[key] < 0.01:
|
||||
t_copy = self.trending_count.copy()
|
||||
for key in t_copy.keys():
|
||||
if t_copy[key] < 0.01:
|
||||
# This just makes sure were not keeping around keys that havent been called in a very long time.
|
||||
self.trending_count.pop(key, None)
|
||||
t_copy.pop(key, None)
|
||||
else:
|
||||
self.trending_count[key] = self.trending_count[key] * decay
|
||||
t_copy[key] = t_copy[key] * decay
|
||||
self.trending_count = t_copy.copy()
|
||||
info("Decayed trending symbols.")
|
||||
|
||||
def find_symbols(self, text: str) -> list[Symbol]:
|
||||
"""Finds stock tickers starting with a dollar sign, and cryptocurrencies with two dollar signs
|
||||
|
Loading…
x
Reference in New Issue
Block a user