Vix futures expiration code

Course Name: Event Driven Trading Strategies, Section No: 10, Unit No: 6, Unit type: Notebook



Refering to below code, if we want to trade 1 and 2 days before expiration, shouldn't we check for shift(1/2) instead of shift(-1/-2) instead?



condition_1 = (vixy_prices['Date'].shift(-1)).isin(expiration_dates['Date'])

condition_2 = (vixy_prices['Date'].shift(-2)).isin(expiration_dates['Date'])



Thanks,

Ryan

Hi Ryan,



We do want to trade before the expiry! And that's why we do shift(-1) which is the "today + 1 day" and shift(-2) which is "today + 2 day". We then check if "today + 1 day" or "today + 2 day" is in the "expiration_dates" or not.



That way, the condition is true, when the "next"/"next to next" day is an expiry. and based on the condition we add the trading signal today, which is, thus before the expiry.



Hope this helps!