mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-06-16 15:06:53 +00:00
Merge branch 'canary'
This commit is contained in:
commit
a9eaf7c6db
@ -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
|
#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
|
#Kaniko docs are here: https://github.com/GoogleContainerTools/kaniko
|
||||||
#While this example shows building to multiple registries for all branches, with a few modifications
|
#While this example shows building to multiple registries for all branches, with a few modifications
|
||||||
|
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
@ -8,13 +8,6 @@
|
|||||||
"files.associations": {
|
"files.associations": {
|
||||||
"DockerDev": "dockerfile",
|
"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.formatting.provider": "black",
|
||||||
"python.showStartPage": false,
|
"python.showStartPage": false,
|
||||||
"editor.fontSize": 13,
|
|
||||||
}
|
}
|
@ -6,3 +6,4 @@ python-Levenshtein==0.12.1
|
|||||||
schedule==1.0.0
|
schedule==1.0.0
|
||||||
mplfinance==0.12.7a5
|
mplfinance==0.12.7a5
|
||||||
markdownify==0.6.5
|
markdownify==0.6.5
|
||||||
|
cachetools==4.2.2
|
@ -8,6 +8,7 @@ from logging import critical, debug, error, info, warning
|
|||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import schedule
|
import schedule
|
||||||
|
from cachetools import TTLCache, cached
|
||||||
from fuzzywuzzy import fuzz
|
from fuzzywuzzy import fuzz
|
||||||
|
|
||||||
from cg_Crypto import cg_Crypto
|
from cg_Crypto import cg_Crypto
|
||||||
@ -30,15 +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"""
|
||||||
|
|
||||||
return
|
|
||||||
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
|
||||||
@ -400,6 +402,7 @@ class Router:
|
|||||||
|
|
||||||
return replies
|
return replies
|
||||||
|
|
||||||
|
@cached(cache=TTLCache(maxsize=1024, ttl=600))
|
||||||
def trending(self) -> str:
|
def trending(self) -> str:
|
||||||
"""Checks APIs for trending symbols.
|
"""Checks APIs for trending symbols.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user