Skip to content

Commit

Permalink
bugfixing earnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MuslemRahimi committed Dec 10, 2024
1 parent c700346 commit ab55bd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions app/cron_earnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion app/primary_cron_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')



Expand Down

0 comments on commit ab55bd7

Please sign in to comment.