From ab55bd72f1b66f89f67f9abe8179b103bad926d8 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 10 Dec 2024 22:44:14 +0100 Subject: [PATCH] bugfixing earnings --- app/cron_earnings.py | 14 +++++++------- app/primary_cron_job.py | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/cron_earnings.py b/app/cron_earnings.py index f476c8d..aef4450 100644 --- a/app/cron_earnings.py +++ b/app/cron_earnings.py @@ -88,13 +88,13 @@ async def get_data(session, ticker): nearest_recent = min(recent_dates, key=lambda x: datetime.strptime(x["date"], "%Y-%m-%d")) try: date = nearest_recent['date'] - eps_prior = float(nearest_recent['eps_prior']) if nearest_recent['eps_prior'] != '' else 0 - eps_surprise = float(nearest_recent['eps_surprise']) if nearest_recent['eps_surprise'] != '' else 0 - eps = float(nearest_recent['eps']) if nearest_recent['eps'] != '' else 0 - revenue_prior = float(nearest_recent['revenue_prior']) if nearest_recent['revenue_prior'] != '' else 0 - revenue_surprise = float(nearest_recent['revenue_surprise']) if nearest_recent['revenue_surprise'] != '' else 0 - revenue = float(nearest_recent['revenue']) if nearest_recent['revenue'] != '' else 0 - if revenue !=0 and revenue_prior != 0 and eps_prior != 0 and eps != 0 and revenue_surprise != 0 and eps_surprise != 0: + eps_prior = float(nearest_recent['eps_prior']) if nearest_recent['eps_prior'] != '' else None + eps_surprise = float(nearest_recent['eps_surprise']) if nearest_recent['eps_surprise'] != '' else None + eps = float(nearest_recent['eps']) if nearest_recent['eps'] != '' else None + revenue_prior = float(nearest_recent['revenue_prior']) if nearest_recent['revenue_prior'] != '' else None + revenue_surprise = float(nearest_recent['revenue_surprise']) if nearest_recent['revenue_surprise'] != '' else None + revenue = float(nearest_recent['revenue']) if nearest_recent['revenue'] != '' else None + if revenue is not None and revenue_prior is not None and eps_prior is not None and eps is not None and revenue_surprise is not None and eps_surprise is not None: res_list = { 'epsPrior':eps_prior, 'epsSurprise': eps_surprise, diff --git a/app/primary_cron_job.py b/app/primary_cron_job.py index 9bfdf91..00c1eba 100755 --- a/app/primary_cron_job.py +++ b/app/primary_cron_job.py @@ -298,6 +298,7 @@ def run_threaded(job_func): # Schedule the job to run + schedule.every().day.at("01:00").do(run_threaded, run_options_bubble_ticker).tag('options_ticker_job') schedule.every().day.at("02:00").do(run_threaded, run_db_schedule_job) schedule.every().day.at("05:00").do(run_threaded, run_options_gex).tag('options_gex_job') @@ -359,7 +360,7 @@ def run_threaded(job_func): schedule.every(2).minutes.do(run_threaded, run_dashboard).tag('dashboard_job') -schedule.every(10).seconds.do(run_threaded, run_if_not_running(run_cron_options_flow, 'options_flow_job')).tag('options_flow_job') +schedule.every(20).seconds.do(run_threaded, run_if_not_running(run_cron_options_flow, 'options_flow_job')).tag('options_flow_job')