Feature improve regression tests (#6245)
* add data count properties * 'add history count property * assert data counts * update missing override * consider override/virtual cases * implement data count * add message handler for regression tests * use regression test message handler * set algorithm manager for regression test message handler * update data count * check if stats are present, check if algo manager is not null * update * add c# algo * make same as c# algo * use new line * logic shifted to RegressionTestMessageHandler * cleanup * auto cleanup * skip non deterministic data count * change data count * use inheritance * improve stats * update couht * add sma indicator to c# and customSMA to python * call base method before executing further * skip test * revert to original * add duplicate sma * skip regression test
This commit is contained in:
@@ -21,18 +21,20 @@ from AlgorithmImports import *
|
||||
### <meta name="tag" content="options" />
|
||||
class OptionExerciseAssignRegressionAlgorithm(QCAlgorithm):
|
||||
|
||||
def Initialize(self):
|
||||
UnderlyingTicker = "GOOG"
|
||||
|
||||
def Initialize(self):
|
||||
self.SetCash(100000)
|
||||
self.SetStartDate(2015,12,24)
|
||||
self.SetEndDate(2015,12,28)
|
||||
|
||||
option = self.AddOption("GOOG")
|
||||
self.equity = self.AddEquity(self.UnderlyingTicker);
|
||||
self.option = self.AddOption(self.UnderlyingTicker);
|
||||
|
||||
# set our strike/expiry filter for this option chain
|
||||
option.SetFilter(self.UniverseFunc)
|
||||
self.option.SetFilter(self.UniverseFunc)
|
||||
|
||||
self.SetBenchmark("GOOG")
|
||||
self.SetBenchmark(self.equity.Symbol)
|
||||
self._assignedOption = False
|
||||
|
||||
def OnData(self, slice):
|
||||
@@ -43,7 +45,7 @@ class OptionExerciseAssignRegressionAlgorithm(QCAlgorithm):
|
||||
contracts = filter(lambda x:
|
||||
x.Expiry.date() == self.Time.date() and
|
||||
x.Strike < chain.Underlying.Price and
|
||||
x.Right == OptionRight.Call, chain)
|
||||
x.Right == OptionRight.Call, chain)
|
||||
|
||||
# sorted the contracts by their strikes, find the second strike under market price
|
||||
sorted_contracts = sorted(contracts, key = lambda x: x.Strike, reverse = True)[:2]
|
||||
|
||||
Reference in New Issue
Block a user