Add BaseData.AdjustResolution
- Adding `BaseData.AdjustResolution()` that should return a valid resolution for the given data and security type. This allows us to set a limitation which is useful to avoid invalid data requests or unnecessary fill forward situations. The user will be notified through a console message. - Adding unit and regression test - Updating example algorithms custom data resolution - Some performance improvements. Wont change console color if `SelectedOptimization` is defined
This commit is contained in:
@@ -44,7 +44,11 @@ class CustomDataUsingMapFileRegressionAlgorithm(QCAlgorithm):
|
||||
self.initialMapping = False
|
||||
self.executionMapping = False
|
||||
self.foxa = Symbol.Create("FOXA", SecurityType.Equity, Market.USA)
|
||||
self.symbol = self.AddData(CustomDataUsingMapping, self.foxa).Symbol
|
||||
self.symbol = self.AddData(CustomDataUsingMapping, self.foxa, Resolution.Tick).Symbol
|
||||
|
||||
for config in self.SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(self.symbol):
|
||||
if config.Resolution != Resolution.Minute:
|
||||
raise ValueError("Expected resolution to be adjust to Minute")
|
||||
|
||||
def OnData(self, slice):
|
||||
date = self.Time.date()
|
||||
@@ -86,4 +90,8 @@ class CustomDataUsingMapping(PythonData):
|
||||
|
||||
def RequiresMapping(self):
|
||||
'''True indicates mapping should be done'''
|
||||
return True
|
||||
return True
|
||||
|
||||
def AdjustResolution(self, resolution):
|
||||
'''Adjust resolution'''
|
||||
return Resolution.Minute
|
||||
Reference in New Issue
Block a user