From 4d2356f48a3753a5f62294585e66e17ec6dee49c Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Thu, 21 Nov 2024 11:22:43 +0100 Subject: [PATCH] update median price calculation for analyst --- app/cron_analyst_ticker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/cron_analyst_ticker.py b/app/cron_analyst_ticker.py index 336751f..bb2d68a 100755 --- a/app/cron_analyst_ticker.py +++ b/app/cron_analyst_ticker.py @@ -46,8 +46,8 @@ def get_summary(res_list): - # Filter the data for the last 12 months - filtered_data = [item for item in res_list if start_date_12m <= datetime.strptime(item['date'], '%Y-%m-%d').date() <= end_date] + # Filter the data for the last 12 months and consider the last N ratings + filtered_data = [item for item in res_list if start_date_12m <= datetime.strptime(item['date'], '%Y-%m-%d').date() <= end_date][:30] # Initialize dictionary to store the latest price target for each analyst