bugfixing holiday

This commit is contained in:
MuslemRahimi 2024-09-02 15:55:51 +02:00
parent 432696d629
commit f640842c3d
3 changed files with 9 additions and 7 deletions

View File

@ -9,8 +9,8 @@ class GetStartEndDate:
def check_if_holiday(self): def check_if_holiday(self):
holiday_dates = { holiday_dates = {
datetime(2023, 9, 4): 'labor_day', datetime(2024, 9, 2): 'labor_day',
datetime(2023, 9, 5): 'labor_day+1', datetime(2024, 9, 3): 'labor_day+1',
datetime(2023, 11, 23): 'thanks_giving', datetime(2023, 11, 23): 'thanks_giving',
datetime(2023, 12, 25): 'christmas', datetime(2023, 12, 25): 'christmas',
datetime(2024, 1, 1): 'new_year', datetime(2024, 1, 1): 'new_year',
@ -27,7 +27,7 @@ class GetStartEndDate:
def correct_1d_interval(self, holiday): def correct_1d_interval(self, holiday):
if holiday in ('labor_day', 'labor_day+1'): if holiday in ('labor_day', 'labor_day+1'):
start_date_1d = datetime(2023, 9, 1) start_date_1d = datetime(2024, 8, 30)
elif holiday == 'thanks_giving': elif holiday == 'thanks_giving':
start_date_1d = datetime(2023, 11, 22) start_date_1d = datetime(2023, 11, 22)
elif holiday == 'new_year': elif holiday == 'new_year':
@ -61,8 +61,8 @@ class GetStartEndDate:
is_afternoon = current_time_new_york.hour > 9 or (current_time_new_york.hour == 9 and current_time_new_york.minute >= 30) is_afternoon = current_time_new_york.hour > 9 or (current_time_new_york.hour == 9 and current_time_new_york.minute >= 30)
if holiday: if holiday:
holiday_dates = { holiday_dates = {
'labor_day': datetime(2023, 9, 1), 'labor_day': datetime(2024, 8, 30),
'labor_day+1': datetime(2023, 9, 1), 'labor_day+1': datetime(2024, 8, 30),
'thanks_giving': datetime(2023, 11, 22), 'thanks_giving': datetime(2023, 11, 22),
'christmas': datetime(2023, 12, 22), 'christmas': datetime(2023, 12, 22),
'new_year': datetime(2023, 12, 29), 'new_year': datetime(2023, 12, 29),

View File

@ -303,7 +303,8 @@ async def run():
highest_open_interest = [{key: item[key] for key in ['cost_basis', 'ticker','assetType', 'date_expiration', 'put_call', 'open_interest', 'strike_price']} for item in highest_open_interest[0:4]] highest_open_interest = [{key: item[key] for key in ['cost_basis', 'ticker','assetType', 'date_expiration', 'put_call', 'open_interest', 'strike_price']} for item in highest_open_interest[0:4]]
options_flow = {'premium': highest_premium, 'volume': highest_volume, 'openInterest':highest_open_interest} options_flow = {'premium': highest_premium, 'volume': highest_volume, 'openInterest':highest_open_interest}
except: except Exception as e:
print(e)
options_flow = {} options_flow = {}
try: try:
with open(f"json/wiim/rss-feed/data.json", 'r') as file: with open(f"json/wiim/rss-feed/data.json", 'r') as file:

View File

@ -65,7 +65,8 @@ def process_page(page):
page_list.append(item) page_list.append(item)
return page_list return page_list
except: except Exception as e:
print(e)
return [] return []