add market cron job

This commit is contained in:
MuslemRahimi 2024-08-20 17:59:29 +02:00
parent 1d4d292146
commit 6441fa3cfe
2 changed files with 12 additions and 1 deletions

View File

@ -69,7 +69,7 @@ async def run():
tasks = [] tasks = []
for i, symbol in enumerate(tqdm(symbols), 1): for i, symbol in enumerate(tqdm(symbols), 1):
tasks.append(get_data(session, symbol)) tasks.append(get_data(session, symbol))
if i % 150 == 0: if i % 100 == 0:
await asyncio.gather(*tasks) await asyncio.gather(*tasks)
tasks = [] tasks = []
print(f'sleeping mode: {i}') print(f'sleeping mode: {i}')

View File

@ -502,6 +502,15 @@ def run_financial_statements():
] ]
run_command(command) run_command(command)
def run_market_cap():
run_command(["python3", "cron_market_cap.py"])
command = [
"sudo", "rsync", "-avz", "-e", "ssh",
"/root/backend/app/json/market-cap",
f"root@{useast_ip_address}:/root/backend/app/json"
]
run_command(command)
# Create functions to run each schedule in a separate thread # Create functions to run each schedule in a separate thread
def run_threaded(job_func): def run_threaded(job_func):
job_thread = threading.Thread(target=job_func) job_thread = threading.Thread(target=job_func)
@ -529,6 +538,8 @@ schedule.every().day.at("10:30").do(run_threaded, run_sec_filings).tag('sec_fili
schedule.every().day.at("11:00").do(run_threaded, run_executive).tag('executive_job') schedule.every().day.at("11:00").do(run_threaded, run_executive).tag('executive_job')
schedule.every().day.at("03:00").do(run_threaded, run_retail_volume).tag('retail_volume_job') schedule.every().day.at("03:00").do(run_threaded, run_retail_volume).tag('retail_volume_job')
schedule.every().day.at("11:45").do(run_threaded, run_clinical_trial).tag('clinical_trial_job') schedule.every().day.at("11:45").do(run_threaded, run_clinical_trial).tag('clinical_trial_job')
schedule.every().day.at("12:00").do(run_threaded, run_market_cap).tag('market_cap_josb')
#schedule.every().day.at("05:00").do(run_threaded, run_implied_volatility).tag('implied_volatility_job') #schedule.every().day.at("05:00").do(run_threaded, run_implied_volatility).tag('implied_volatility_job')