when NextOptionExpiryDate is called on the same day as expiration it returns the same day instead of the next expiration day.
Example:
suppose SPX options expire on 1/18/2022. When you call NextOptionExpiryDate with a bar on that day it returns 1/18/2022. It should be the next one in February.
Example:
suppose SPX options expire on 1/18/2022. When you call NextOptionExpiryDate with a bar on that day it returns 1/18/2022. It should be the next one in February.
Rename
This is a moot point IMHO.
Hmmm, I think it's a matter of semantics. I could see folks expecting it to behave either way. Wouldn't call this a bug.
Since you know it works this way, just add a day to the date when calling the function.
CODE:
bars.DateTimes[idx].Date.AddDays(1).NextOptionExpiryDate(bars);
Thanks. That works. I didn't know that you can use bars.DateTimes[idx].Date.AddDays(1).NextOptionExpiryDate(bars);
instead of bars.NextOptionExpiryDate.
instead of bars.NextOptionExpiryDate.
Your Response
Post
Edit Post
Login is required