self.get_expiration¶
- strategies.strategy.Strategy.get_expiration(self, chains, exchange='SMART')¶
Returns expiration dates for an option chain for a particular exchange.
Using the chains dictionary obtained from get_chains finds all of the expiry dates for the option chains on a given exchange. The return list is sorted.
- Parameters
chains (dictionary of dictionaries) – The chains dictionary created by get_chains method.
exchange (str optional) – The exchange such as SMART, CBOE. Default is SMART.
- Returns
Sorted list of dates in the form of 20221013.
- Return type
list of datetime.dates
Example
>>> # Will return the expiry dates for SPY >>> asset = "SPY" >>> expiry_dates = self.get_expiration(asset)