Doubt applying BDay

Course: Event Driven Trading Strategies, Section No: 13, Unit No: 4

Hello, here we're searching for the 1st business day after Christmas as it's the day we're out of our trade. However we're finding too the second business day after Christmas 'just in case' the first one is holiday too. However, BDay class is not done for finding true business day? I mean, BDay never would catch a holiday as 'business day'.

https://i.imgur.com/RJxjZej.png

Hello Daniel, 



You are correct in pointing out that the BDay class itself doesn't inherently detect holidays.



The reason we use BDay here is to calculate business days relative to a given date. While it doesn't automatically exclude holidays, it does provide a convenient way to find the next business day after a given date by taking into account weekends (Saturdays and Sundays).



In our specific case, we're using it in combination with the numpy.vectorize function to efficiently apply it to an array of years. We then check if the resulting dates fall on our list of observed holidays to make sure we're not incorrectly marking them as business days.



So, while BDay itself doesn't handle holidays, we're incorporating it into our workflow with additional logic to ensure accurate identification of the first and second business days after Christmas, taking into account potential holidays.



If you have any further questions or need clarification on this, please feel free to ask!

I'm still lost… If BDay class doesn't false detect holiday with business day, why we don't just only use:

 

bus_days_aft_xmas = np.append(func(years,1))

Instead of:
 
bus_days_aft_xmas = np.append(func(years,1), func(years,2))

I mean, identifying the first and second business days instead only the first business day after Xmas has any advantage?

Thanks in advance.

Hi Daniel,



We will get back to you on this.



Thanks,

Akshay

Hi Daniel,



Let me explain this with an example. On 25th Dec 2011, it was a Sunday. If we had used func(years,1), then the next BDay would have been 26th Dec, 2011 (Monday) but in 2011 26th December was a holiday. You can check the holiday calender for 2011 here. In this case we would have missed setting the signal as 0. Hence, to accommodate such instances we are taking two business days as offset.