NLP in trading

If the headline was made on a weekend then subtract BDay(0) to fetch the next business day's market open time




Q1:curr_date_open = pd.to_datetime(date).floor('d').replace(hour=9,minute=30) - BDay(0)


Q1: For this code, I dont get the logic. i) what is the floor('d') means? ii) BDay(0), (0) for what?

# Calculate the previous business day's market close time for the headline 
Q2:prev_date_close = (curr_date_open - BDay()).replace(hour=16,minute=0)

Q2: - BDay(),why is case we don't have 0 inside the bracket?

Hi Chi,



1.  Subtracing BDay(0) from a business day would result in the same date itself. If it is subtracted from a day is equivalent to the last previous working day. The floor is done at a daily frequency limit to strip the date-time object of unnecessary values of hour,minute or second.



2. BDay() is equivalent to BDay(1) so the previous day closing can be obtained.



Hope this helps!