From 41f24378940672725d6b1c7a523a2c65eb9894d2 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sat, 28 Sep 2024 17:20:19 +0200 Subject: [PATCH] update fundamental ml --- app/cron_fundamental_predictor.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/cron_fundamental_predictor.py b/app/cron_fundamental_predictor.py index 490edaf..42910bc 100755 --- a/app/cron_fundamental_predictor.py +++ b/app/cron_fundamental_predictor.py @@ -16,7 +16,7 @@ import subprocess async def save_json(symbol, data): with open(f"json/fundamental-predictor-analysis/{symbol}.json", 'w') as file: - orjson.dump(data, file) + file.write(orjson.dumps(data)) async def download_data(ticker, con, start_date, end_date): @@ -219,14 +219,13 @@ async def run(): cursor.execute("SELECT DISTINCT symbol FROM stocks WHERE marketCap >= 1E9") stock_symbols = [row[0] for row in cursor.fetchall()] - total_symbols = stock_symbols print(f"Total tickers: {len(total_symbols)}") start_date = datetime(2000, 1, 1).strftime("%Y-%m-%d") end_date = datetime.today().strftime("%Y-%m-%d") - chunk_size = len(total_symbols) #// 70 # Divide the list into N chunks + chunk_size = len(total_symbols) // 100 # Divide the list into N chunks chunks = [total_symbols[i:i + chunk_size] for i in range(0, len(total_symbols), chunk_size)] for chunk in chunks: tasks = []