1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2025-06-16 07:16:40 +00:00

Merge branch 'canary'

This commit is contained in:
Anson 2021-10-05 15:56:22 -07:00
commit a9eaf7c6db
4 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,10 @@
black:
stage: .pre
image: registry.gitlab.com/pipeline-components/black:latest
script:
- black --check --verbose -- .
#Following instructions (as of 2020-04-01): https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
#Kaniko docs are here: https://github.com/GoogleContainerTools/kaniko
#While this example shows building to multiple registries for all branches, with a few modifications

View File

@ -8,13 +8,6 @@
"files.associations": {
"DockerDev": "dockerfile",
},
"workbench.colorTheme": "One Dark Pro",
"explorer.confirmDelete": false,
"editor.fontFamily": "JetBrains Mono",
"editor.letterSpacing": 1.2,
"editor.fontLigatures": true,
"editor.wordWrap": "on",
"python.formatting.provider": "black",
"python.showStartPage": false,
"editor.fontSize": 13,
}

View File

@ -5,4 +5,5 @@ fuzzywuzzy==0.18.0
python-Levenshtein==0.12.1
schedule==1.0.0
mplfinance==0.12.7a5
markdownify==0.6.5
markdownify==0.6.5
cachetools==4.2.2

View File

@ -8,6 +8,7 @@ from logging import critical, debug, error, info, warning
import pandas as pd
import schedule
from cachetools import TTLCache, cached
from fuzzywuzzy import fuzz
from cg_Crypto import cg_Crypto
@ -30,15 +31,16 @@ class Router:
def trending_decay(self, decay=0.5):
"""Decays the value of each trending stock by a multiplier"""
return
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
@ -400,6 +402,7 @@ class Router:
return replies
@cached(cache=TTLCache(maxsize=1024, ttl=600))
def trending(self) -> str:
"""Checks APIs for trending symbols.