I am trying to compute all possible expiration dates for a given date. So far I figured out the following rules:
- Every Mon, Wed, Fri until start_date + 5 weeks (SPY/SPX only)
- Every Fri until start_date + 2 months
- Every 3rd Fri until start_date + 6 months
However I have trouble figuring out longer dated options and LEAPs. I have tried to "reverse engineer" the rules by looking at current expiration dates of SPY and kind of figured out that the last two rules must approximately be
- Every 3rd Fri of Jan, Jun, Sep until start_date + 2 years
- Every 3rd Fri of Jan until start_date + 3 years
Those don't quite fit the expiration dates I get for the SPY option chain however. I also know that there are a few redundant dates but that's easily filtered out.
My question is: Is there already a library that accomplishes this and/or are the rules somewhere written down? My google searches didn't yield any promising results.
I need this to construct historic option chains, so the next step will be computing all possible strikes given the underlying. If you guys have any pointers in that regard, I'd appreciate the help.
Submitted November 05, 2020 at 09:21AM by k0rnflex