diff --git a/app/cron_share_statistics.py b/app/cron_share_statistics.py index 3225913..22af4c3 100644 --- a/app/cron_share_statistics.py +++ b/app/cron_share_statistics.py @@ -84,11 +84,18 @@ async def run(): cursor.execute("SELECT DISTINCT symbol FROM stocks") stock_symbols = [row[0] for row in cursor.fetchall()] + counter = 0 + for ticker in tqdm(stock_symbols): data_dict = await get_data(ticker, con) if data_dict.keys(): await save_as_json(ticker, data_dict) - + + counter += 1 + if counter % 100 == 0: + print(f"Processed {counter} tickers, waiting for 10 seconds...") + await asyncio.sleep(10) + con.close() try: diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index a1c977e..62b03ee 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -99,6 +99,17 @@ def run_share_statistics(): ] subprocess.run(command) +def run_retail_volume(): + week = datetime.today().weekday() + if week <= 5: + subprocess.run(["python3", "cron_retail_volume.py"]) + command = [ + "sudo", "rsync", "-avz", "-e", "ssh", + "/root/backend/app/json/retail-volume", + f"root@{useast_ip_address}:/root/backend/app/json" + ] + subprocess.run(command) + def run_cron_market_movers(): week = datetime.today().weekday() if week <= 4: @@ -300,6 +311,7 @@ def run_threaded(job_func): schedule.every().day.at("10:15").do(run_threaded, run_share_statistics).tag('share_statistics_job') schedule.every().day.at("10:30").do(run_threaded, run_sec_filings).tag('sec_filings_job') schedule.every().day.at("11:00").do(run_threaded, run_executive).tag('executive_job') +schedule.every().day.at("11:30").do(run_threaded, run_retail_volume).tag('retail_volume_job') schedule.every().day.at("13:30").do(run_threaded, run_stockdeck).tag('stockdeck_job')