self.get_expiration#

lumibot.strategies.strategy.Strategy.get_expiration(self, chains)#

Returns expiration dates for an option chain for a particular exchange.

Using the chains dictionary obtained from get_chains finds all 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 2022-10-13.

Return type:

list of datetime.date

Example

>>> # Will return the expiry dates for SPY
>>> asset = "SPY"
>>> expiry_dates = self.get_expiration(asset)