From 57819880a7bae7c6c6521c34cb2f5c1b2e1988ab Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sat, 28 Sep 2024 15:52:03 +0200 Subject: [PATCH] update dashboard --- app/cron_dashboard.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/cron_dashboard.py b/app/cron_dashboard.py index f982e18..add0433 100644 --- a/app/cron_dashboard.py +++ b/app/cron_dashboard.py @@ -18,7 +18,6 @@ load_dotenv() benzinga_api_key = os.getenv('BENZINGA_API_KEY') fmp_api_key = os.getenv('FMP_API_KEY') - query_template = """ SELECT marketCap @@ -81,11 +80,11 @@ def remove_duplicates(elements): def weekday(): today = datetime.today() - yesterday = today - timedelta(1) - - while yesterday.weekday() >= 5: # 5 = Saturday, 6 = Sunday - yesterday -= timedelta(2) - + if today.weekday() >= 5: # 5 = Saturday, 6 = Sunday + yesterday = today - timedelta(2) + else: + yesterday = today - timedelta(1) + return yesterday.strftime('%Y-%m-%d')