1
0
mirror of https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git synced 2025-08-02 19:41:26 +00:00

small code clean up and add linting to repo

This commit is contained in:
2023-04-07 00:15:01 -06:00
parent b72f0518c2
commit cedacc5749
8 changed files with 98 additions and 148 deletions

View File

@@ -5,7 +5,7 @@ import logging
import os
import datetime as dt
from logging import warning
from typing import List, Optional, Tuple
from typing import Dict
import pandas as pd
import requests as r
@@ -21,10 +21,7 @@ class MarketData:
SYMBOL_REGEX = "[$]([a-zA-Z]{1,4})"
searched_symbols = {}
otc_list = []
charts = {}
trending_cache = None
charts: Dict[Stock, pd.DataFrame] = {}
def __init__(self) -> None:
"""Creates a Symbol Object
@@ -41,9 +38,7 @@ class MarketData:
self.MARKETDATA_TOKEN = ""
except KeyError:
self.MARKETDATA_TOKEN = ""
warning(
"Starting without an MarketData.app Token will not allow you to get market data!"
)
warning("Starting without an MarketData.app Token will not allow you to get market data!")
if self.MARKETDATA_TOKEN != "":
schedule.every().day.do(self.clear_charts)
@@ -78,7 +73,8 @@ class MarketData:
except r.exceptions.JSONDecodeError as e:
logging.error(e)
return {}
return {}
def clear_charts(self) -> None:
"""
@@ -131,7 +127,6 @@ class MarketData:
except KeyError:
pass
to_date = dt.datetime.today().strftime("%Y-%m-%d")
resolution = "5" # minutes
if data := self.get(