bugfixing

This commit is contained in:
MuslemRahimi 2025-02-24 17:54:42 +01:00
parent e956705af4
commit cce53995b6
3 changed files with 7 additions and 2 deletions

View File

@ -27,6 +27,9 @@ stock_screener_data_dict = {item['symbol']: item for item in stock_screener_data
quote_cache = {} quote_cache = {}
print(stock_screener_data_dict.get('AAPL', {}))
def get_quote_data(symbol): def get_quote_data(symbol):
"""Get quote data for a symbol from JSON file""" """Get quote data for a symbol from JSON file"""
if symbol in quote_cache: if symbol in quote_cache:

View File

@ -275,7 +275,6 @@ async def get_data():
print(f"Error processing item {item}: {e}") print(f"Error processing item {item}: {e}")
query = query_template.format(symbol='SPY') query = query_template.format(symbol='SPY')
etf_con = sqlite3.connect('etf.db') etf_con = sqlite3.connect('etf.db')

View File

@ -22,7 +22,7 @@ with open(f"json/stock-screener/data.json", 'rb') as file:
stock_screener_data = orjson.loads(file.read()) stock_screener_data = orjson.loads(file.read())
stock_screener_data_dict = {item['symbol']: item for item in stock_screener_data} stock_screener_data_dict = {item['symbol']: item for item in stock_screener_data}
screener_columns = ['forwardPE','revenueTTM',"netIncomeTTM"] screener_columns = ['floatShares', 'forwardPE','shortOutStandingPercent','shortFloatPercent','revenuePerEmployee','profitPerEmployee','revenueTTM',"netIncomeTTM"]
async def get_data(ticker): async def get_data(ticker):
try: try:
@ -67,15 +67,18 @@ async def get_data(ticker):
'beta': company_profile[0]['beta'], 'beta': company_profile[0]['beta'],
'marketCap': company_profile[0]['mktCap'], 'marketCap': company_profile[0]['mktCap'],
'avgVolume': company_profile[0]['volAvg'], 'avgVolume': company_profile[0]['volAvg'],
'country': company_profile[0]['country'],
'exchange': company_profile[0]['exchangeShortName'], 'exchange': company_profile[0]['exchangeShortName'],
'earning': company_quote['earningsAnnouncement'], 'earning': company_quote['earningsAnnouncement'],
'pe': company_quote['pe'], 'pe': company_quote['pe'],
'eps': company_quote['eps'], 'eps': company_quote['eps'],
'sharesOutstanding': company_quote['sharesOutstanding'],
'score': score, 'score': score,
'previousClose': company_quote['price'], #This is true because I update my db before the market opens hence the price will be the previousClose price. 'previousClose': company_quote['price'], #This is true because I update my db before the market opens hence the price will be the previousClose price.
'website': company_profile[0]['website'], 'website': company_profile[0]['website'],
'description': company_profile[0]['description'], 'description': company_profile[0]['description'],
'fullTimeEmployees': company_profile[0]['fullTimeEmployees'], 'fullTimeEmployees': company_profile[0]['fullTimeEmployees'],
'stockSplits': company_stock_split,
} }
return res_list return res_list