Hello, I am trying to add weekly options to options universe, but using IncludeWeeklys() or even OnlyWeeklys() don't seem to work for me.

Consider this sample project, it always returns the same number of contracts. I am using option.SetFilter() with custom filter function:

  1. def OptionsFilter(self, option_filter_universe):
  2. monthly = len([x for x in option_filter_universe.StandardsOnly()])
  3. weekly = len([x for x in option_filter_universe.WeeklysOnly()])
  4. both = len([x for x in option_filter_universe.IncludeWeeklys()])
  5. self.Log(f"monthly: {monthly}; weekly: {weekly}; both: {both}")
  6. return option_filter_universe.Contracts([])

Here is the log:

2022-10-03 09:31:00 : monthly: 1770; weekly: 1770; both: 1770
2022-10-04 09:31:00 : monthly: 1770; weekly: 1770; both: 1770
2022-10-05 09:31:00 : monthly: 1770; weekly: 1770; both: 1770
2022-10-06 09:31:00 : monthly: 1862; weekly: 1862; both: 1862
…

 

Perhaps I am doing something wrong, or is this a bug?

Author

Yuri Lopukhov

November 2022