From 375a816f7497f22cd34432e310077a03eb82ddd7 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 8 Jan 2025 11:09:01 +0100 Subject: [PATCH] update cron job --- app/cron_options_gex_dex.py | 15 ++++++++------- app/primary_cron_job.py | 4 +++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/cron_options_gex_dex.py b/app/cron_options_gex_dex.py index 688bdaf..e01c8dc 100644 --- a/app/cron_options_gex_dex.py +++ b/app/cron_options_gex_dex.py @@ -7,10 +7,6 @@ import sqlite3 import time from tqdm import tqdm -from concurrent.futures import ThreadPoolExecutor -from functools import partial -import asyncio -import aiohttp load_dotenv() @@ -92,7 +88,8 @@ def get_overview_data(): total_symbols = stocks_symbols+etf_symbols counter = 0 - total_symbols = ['GME'] + #Test mode + #total_symbols = ['GME','SPY'] for symbol in tqdm(total_symbols): try: url = f"https://api.unusualwhales.com/api/stock/{symbol}/greek-exposure" @@ -123,7 +120,8 @@ def get_strike_data(): total_symbols = stocks_symbols+etf_symbols counter = 0 - total_symbols = ['GME'] + #Test mode + #total_symbols = ['GME','SPY'] for symbol in tqdm(total_symbols): try: url = f"https://api.unusualwhales.com/api/stock/{symbol}/greek-exposure/strike" @@ -152,7 +150,8 @@ def get_expiry_data(): total_symbols = stocks_symbols+etf_symbols counter = 0 - total_symbols = ['GME'] + #total_symbols = ['GME','SPY'] + #total_symbols = ['GME','SPY'] for symbol in tqdm(total_symbols): try: url = f"https://api.unusualwhales.com/api/stock/{symbol}/greek-exposure/expiry" @@ -176,6 +175,8 @@ def get_expiry_data(): if __name__ == '__main__': get_overview_data() + time.sleep(60) get_strike_data() + time.sleep(60) get_expiry_data() diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index 554e5f8..7920648 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -91,6 +91,8 @@ def run_options_jobs(): now = datetime.now(ny_tz) week = now.weekday() if week <= 5: + run_command(["python3", "cron_options_gex_dex.py"]) + time.sleep(60) run_command(["python3", "cron_options_stats.py"]) time.sleep(60) run_command(["python3", "cron_options_historical_volume.py"]) @@ -342,7 +344,7 @@ def run_threaded(job_func): # Schedule the job to run -schedule.every().day.at("03:00").do(run_threaded, run_options_jobs).tag('options_job') +schedule.every().day.at("00:00").do(run_threaded, run_options_jobs).tag('options_job') schedule.every().day.at("01:00").do(run_threaded, run_db_schedule_job) #schedule.every().day.at("05:00").do(run_threaded, run_options_gex).tag('options_gex_job') schedule.every().day.at("05:00").do(run_threaded, run_export_price).tag('export_price_job')