Skip to content

Commit

Permalink
update cron job
Browse files Browse the repository at this point in the history
  • Loading branch information
MuslemRahimi committed Jan 8, 2025
1 parent e56c0eb commit 375a816
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 8 additions & 7 deletions app/cron_options_gex_dex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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()

4 changes: 3 additions & 1 deletion app/primary_cron_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 375a816

Please sign in to comment.