diff --git a/app/cron_stockdeck.py b/app/cron_stockdeck.py index 28762f0..7c1bdc7 100755 --- a/app/cron_stockdeck.py +++ b/app/cron_stockdeck.py @@ -50,6 +50,12 @@ async def get_data(ticker): except: company_quote = {} + try: + with open(f"json/forward-pe/{ticker}.json", 'r') as file: + forward_pe = ujson.load(file)['forwardPE'] + except: + forward_pe = None + if data['esg_data'] == None: company_esg_score = {'ESGScore': 'n/a', 'socialScore': 'n/a', 'environmentalScore': 'n/a', 'governanceScore': 'n/a'} company_esg_rating = {'ESGRiskRating': 'n/a', 'industry': 'n/a'} @@ -70,7 +76,6 @@ async def get_data(ticker): 'ceoName': company_profile[0]['ceo'], 'companyName': company_profile[0]['companyName'], 'industry': company_profile[0]['industry'], - 'image': company_profile[0]['image'], 'sector': company_profile[0]['sector'], 'beta': company_profile[0]['beta'], 'marketCap': company_profile[0]['mktCap'], @@ -78,6 +83,10 @@ async def get_data(ticker): 'country': company_profile[0]['country'], 'exchange': company_profile[0]['exchangeShortName'], 'earning': company_quote['earningsAnnouncement'], + 'pe': company_quote['pe'], + 'eps': company_quote['eps'], + 'sharesOutstanding': company_quote['sharesOutstanding'], + 'forwardPE': forward_pe, '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'], 'description': company_profile[0]['description'], @@ -116,7 +125,7 @@ async def run(): cursor.execute("PRAGMA journal_mode = wal") cursor.execute("SELECT DISTINCT symbol FROM stocks") stocks_symbols = [row[0] for row in cursor.fetchall()] - for ticker in stocks_symbols: + for ticker in tqdm(stocks_symbols): res = await get_data(ticker) await save_stockdeck(ticker, [res]) diff --git a/app/ml_models/__pycache__/prophet_model.cpython-310.pyc b/app/ml_models/__pycache__/prophet_model.cpython-310.pyc index c3773a9..5af84d4 100644 Binary files a/app/ml_models/__pycache__/prophet_model.cpython-310.pyc and b/app/ml_models/__pycache__/prophet_model.cpython-310.pyc differ diff --git a/app/ml_models/prophet_model.py b/app/ml_models/prophet_model.py index 25449e0..3a385ba 100755 --- a/app/ml_models/prophet_model.py +++ b/app/ml_models/prophet_model.py @@ -66,11 +66,12 @@ class PricePredictor: #Test Mode async def main(): - for ticker in ['TSLA']: + for ticker in ['NVDA']: start_date = datetime(2000, 1, 1).strftime("%Y-%m-%d") end_date = datetime.today().strftime("%Y-%m-%d") df = await download_data(ticker, start_date, end_date) data = PricePredictor().run(df) + print(data) # Run the main function #asyncio.run(main())