I have a very detailed prompt Like
expiry_json = json.load(open('/root/apps/cdn/expiry.json'))
expiry_json["stockwise"]
symbol="BANKNIFTY"
tradevariation = "options"
expiry_json["stockwise"][tradevariation][symbol]
Now expiry_json["stockwise"][tradevariation][symbol] looks like
['2023-09-20',
'2023-09-28',
'2023-10-04',
'2023-10-11',
'2023-10-18',
'2023-10-26',
'2023-11-30',
'2023-12-28',
'2024-03-28',
'2024-06-27',
'2023-09-20',
'2023-09-28',
'2023-10-04',
'2023-10-11',
'2023-10-18',
'2023-10-26',
'2023-11-30',
'2023-12-28',
'2024-03-28',
'2024-06-27',
'2023-11-08',
'2023-11-15',
'2023-11-22',
'2023-11-30',
'2023-12-06',
'2023-12-28',
'2024-01-25',
'2024-03-28',
'2024-06-27',
'2024-09-26',
'2023-11-08',
'2023-11-15',
'2023-11-22',
'2023-11-30',
'2023-12-06',
'2023-12-28',
'2024-01-25',
'2024-03-28',
'2024-06-27',
'2024-09-26']
I want you to find today's date and the preceeding date matches with this expiry day or not. if it matches then it will print yes.
holiday_json = json.load(open('/root/apps/cdn/holidays.json', 'r'))
holiday_json["FO"]
this looks like
[{'tradingDate': '26-Jan-2023',
'weekDay': 'Thursday',
'description': 'Republic Day',
'Sr_no': 1},
{'tradingDate': '18-Feb-2023',
'weekDay': 'Saturday',
'description': 'Mahashivratri',
'Sr_no': 2},
{'tradingDate': '07-Mar-2023',
'weekDay': 'Tuesday',
'description': 'Holi',
'Sr_no': 3},
{'tradingDate': '30-Mar-2023',
'weekDay': 'Thursday',
'description': 'Ram Navami',
'Sr_no': 4},
{'tradingDate': '04-Apr-2023',
'weekDay': 'Tuesday',
'description': 'Mahavir Jayanti',
'Sr_no': 5},
{'tradingDate': '07-Apr-2023',
'weekDay': 'Friday',
'description': 'Good Friday',
'Sr_no': 6},
{'tradingDate': '14-Apr-2023',
'weekDay': 'Friday',
'description': 'Dr. Baba Saheb Ambedkar Jayanti',
'Sr_no': 7},
{'tradingDate': '22-Apr-2023',
'weekDay': 'Saturday',
'description': 'Id-Ul-Fitr (Ramzan ID)',
'Sr_no': 8},
{'tradingDate': '01-May-2023',
'weekDay': 'Monday',
'description': 'Maharashtra Day',
'Sr_no': 9},
{'tradingDate': '29-Jun-2023',
'weekDay': 'Thursday',
'description': 'Bakri Id',
'Sr_no': 10},
{'tradingDate': '29-Jul-2023',
'weekDay': 'Saturday',
'description': 'Moharram',
'Sr_no': 11},
{'tradingDate': '15-Aug-2023',
'weekDay': 'Tuesday',
'description': 'Independence Day',
'Sr_no': 12},
{'tradingDate': '19-Sep-2023',
'weekDay': 'Tuesday',
'description': 'Ganesh Chaturthi',
'Sr_no': 13},
{'tradingDate': '02-Oct-2023',
'weekDay': 'Monday',
'description': 'Mahatma Gandhi Jayanti',
'Sr_no': 14},
{'tradingDate': '24-Oct-2023',
'weekDay': 'Tuesday',
'description': 'Dussehra',
'Sr_no': 15},
{'tradingDate': '12-Nov-2023',
'weekDay': 'Sunday',
'description': 'Diwali-Laxmi Pujan*',
'Sr_no': 16},
{'tradingDate': '14-Nov-2023',
'weekDay': 'Tuesday',
'description': 'Diwali-Balipratipada',
'Sr_no': 17},
{'tradingDate': '27-Nov-2023',
'weekDay': 'Monday',
'description': 'Gurunanak Jayanti',
'Sr_no': 18},
{'tradingDate': '25-Dec-2023',
'weekDay': 'Monday',
'description': 'Christmas',
'Sr_no': 19}]
now i want you to check that if the preceeding day is holiday. if it is holiday then it will check the day before that.