Lean
Lean copied to clipboard
OpenInterestFutureUniverseSelectionModel doesn't work with Python
Expected Behavior
We can add a OpenInterestFutureUniverseSelectionModel
to a Python algorithm.
Actual Behavior
We can add a OpenInterestFutureUniverseSelectionModel
to a C# algorithm but not a Python algorithm.
Potential Solution
N/A
Reproducing the Problem
Run the following algorithm:
from AlgorithmImports import *
class CasualApricotBaboon(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2020, 11, 24) # Set Start Date
self.SetCash(100000) # Set Strategy Cash
self.symbols = [
Symbol.Create(Futures.Indices.SP500EMini, SecurityType.Future, Market.CME),
Symbol.Create(Futures.Metals.Gold, SecurityType.Future, Market.COMEX)
]
universe = OpenInterestFutureUniverseSelectionModel(self, lambda date_time: symbols )
self.AddUniverseSelection(universe)
We get the following error:
System Information
QC Cloud
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
master
branch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
Potential Solution
OpenInterestFutureUniverseSelectionModel
can't handle the PyObject lambda
-> Func<DateTime, IEnumerable<Symbol>>
conversion automatically. Needs to be converted, like done in other cases, like coarse/fine selection
👍🏽🤙🏽