bugfixing earnings

This commit is contained in:
MuslemRahimi 2024-12-10 22:44:14 +01:00
parent c7003462e4
commit ab55bd72f1
2 changed files with 9 additions and 8 deletions

View File

@ -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,

View File

@ -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 @@ schedule.every(1).hours.do(run_threaded, run_cron_company_news).tag('company_new
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')