BDay function is bond auction day strategy

Course Name: Event Driven Trading Strategies, Section No: 8, Unit No: 10, Unit type: Quiz



Hi there, I would like to clarify a point regarding the use of below code:



condition_1 = (tlt_prices['Date'] -BDay(1)).isin (auction_dates['Date'])

condition_2 = (tlt_prices['Date'] -BDay(2)).isin (auction_dates['Date'])



When we use (tlt_prices['Date'] -BDay(1)).isin (auction_dates['Date']), am I correct to say that we are looking for days AFTER the auction date? i.e. the code is effectively checking to see if one (1) business day before a particular date in tlt_prices is an auction_dates?



The reason I am asking is because in the quiz, the question states that "In the treasury auction strategy, we have to find the dates which are one or two days before the auction date." which contradicts with the explanation in the Juypter notebook in earlier sections. My understanding is that the minus sign used with BDay signifies rolling dates backwards.



Many thanks,

Ryan

Hi Ryan,



Thanks for pointing out this issue. The MCQ wording has been modified to be more clearly expressed now.



Regards.

Hi Gaurav,



A follow up question on this, I have tried out the same strategy using the following:



condition_1 = (tlt_prices['Date'].shift(1)).isin(auction_dates['Date'])

condition_2 = (tlt_prices['Date'].shift(2)).isin(auction_dates['Date'])



If I am correct, by using the shift() function to shift the dates 1 and 2 days forward, we can also identify whether the current day is 1 or 2 days after the auction date? However, the code doesn't give the same result. Can you explain why?



Many thanks,

Ryan

Hi Ryan,



The shift(1) shifts the dates 1 day backwards. You are in effect checking if the previous was an auction date.

The -BDay(1) and shift(1) should have the same effect, but the problem at times lies with data availability.

In the screenshot attached, the "auction_signal_1" is the signal using Bday and the "auction_signal_2" is the signal using shift.

On date 2004-06-15, the signals from these two methods differ. This is because the 2004-06-11 being a working day is not in the dataset. This problem is tackled by using the Bday function.



Hope this helps!