mirror of
https://gitlab.com/simple-stock-bots/simple-stock-bot.git
synced 2025-06-16 07:16:40 +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):
|
def trending_decay(self, decay=0.5):
|
||||||
"""Decays the value of each trending stock by a multiplier"""
|
"""Decays the value of each trending stock by a multiplier"""
|
||||||
|
|
||||||
info("Decaying trending symbols.")
|
|
||||||
if self.trending_count:
|
if self.trending_count:
|
||||||
for key in self.trending_count.keys():
|
t_copy = self.trending_count.copy()
|
||||||
if self.trending_count[key] < 0.01:
|
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.
|
# 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:
|
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]:
|
def find_symbols(self, text: str) -> list[Symbol]:
|
||||||
"""Finds stock tickers starting with a dollar sign, and cryptocurrencies with two dollar signs
|
"""Finds stock tickers starting with a dollar sign, and cryptocurrencies with two dollar signs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user