PEP8 style algorithm API (#7909)
* feat: support snake-case style Python QCAlgorithm implementations * feat: add unit tests and minor fixes * feat: implement new BasePythonWrapper class for python wrappers. Used to cache methods and contains invoke functionality * feat: make python wrappers implement the new base class for pep8 style support * feat: keep overriden methods in Algorithm Python Wrapper * feat: add unit tests for custom models algorithms with PEP8 style * Bump pythonnet version to 2.0.30 * fix bugs and address peer review * Address peer review * Minor revert * feat: StubsIgnoreAttribute for ignoring members or classes by the stubs generator * Minor fixes * Minor fix * Minor fix * Bump pythonnet version to 2.0.31 * Added Greeks.Lambda_ alias of Lambda for python compatibility. Remove unused method
This commit is contained in:
@@ -28,7 +28,7 @@ class FundamentalRegressionAlgorithm(QCAlgorithm):
|
||||
|
||||
self.UniverseSettings.Resolution = Resolution.Daily
|
||||
|
||||
self.universe = self.AddUniverse(self.SelectionFunction)
|
||||
self._universe = self.AddUniverse(self.SelectionFunction)
|
||||
|
||||
# before we add any symbol
|
||||
self.AssertFundamentalUniverseData()
|
||||
@@ -69,7 +69,7 @@ class FundamentalRegressionAlgorithm(QCAlgorithm):
|
||||
|
||||
def AssertFundamentalUniverseData(self):
|
||||
# Case A
|
||||
universeDataPerTime = self.History(self.universe.DataType, [self.universe.Symbol], TimeSpan(2, 0, 0, 0))
|
||||
universeDataPerTime = self.History(self._universe.DataType, [self._universe.Symbol], TimeSpan(2, 0, 0, 0))
|
||||
if len(universeDataPerTime) != 2:
|
||||
raise ValueError(f"Unexpected Fundamentals history count {len(universeDataPerTime)}! Expected 2")
|
||||
|
||||
@@ -77,7 +77,7 @@ class FundamentalRegressionAlgorithm(QCAlgorithm):
|
||||
self.AssertFundamentalEnumerator(universeDataCollection, "A")
|
||||
|
||||
# Case B (sugar on A)
|
||||
universeDataPerTime = self.History(self.universe, TimeSpan(2, 0, 0, 0))
|
||||
universeDataPerTime = self.History(self._universe, TimeSpan(2, 0, 0, 0))
|
||||
if len(universeDataPerTime) != 2:
|
||||
raise ValueError(f"Unexpected Fundamentals history count {len(universeDataPerTime)}! Expected 2")
|
||||
|
||||
@@ -85,9 +85,9 @@ class FundamentalRegressionAlgorithm(QCAlgorithm):
|
||||
self.AssertFundamentalEnumerator(universeDataCollection, "B")
|
||||
|
||||
# Case C: Passing through the unvierse type and symbol
|
||||
enumerableOfDataDictionary = self.History[self.universe.DataType]([self.universe.Symbol], 100)
|
||||
enumerableOfDataDictionary = self.History[self._universe.DataType]([self._universe.Symbol], 100)
|
||||
for selectionCollectionForADay in enumerableOfDataDictionary:
|
||||
self.AssertFundamentalEnumerator(selectionCollectionForADay[self.universe.Symbol], "C")
|
||||
self.AssertFundamentalEnumerator(selectionCollectionForADay[self._universe.Symbol], "C")
|
||||
|
||||
def AssertFundamentalEnumerator(self, enumerable, caseName):
|
||||
dataPointCount = 0
|
||||
|
||||
Reference in New Issue
Block a user