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:
Martin Molinero
2019-10-28 12:57:09 -03:00
parent 7e33be1853
commit 1d43dcd601
40 changed files with 477 additions and 60 deletions
@@ -36,11 +36,11 @@ class CachedAlternativeDataAlgorithm(QCAlgorithm):
# QuantConnect caches a small subset of alternative data for easy consumption for the community.
# You can use this in your algorithm as demonstrated below:
self.cboeVix = self.AddData(CBOE, "VIX").Symbol
self.cboeVix = self.AddData(CBOE, "VIX", Resolution.Daily).Symbol
# United States EIA data: https://eia.gov/
self.usEnergy = self.AddData(USEnergy, USEnergy.Petroleum.UnitedStates.WeeklyGrossInputsIntoRefineries).Symbol
self.usEnergy = self.AddData(USEnergy, USEnergy.Petroleum.UnitedStates.WeeklyGrossInputsIntoRefineries, Resolution.Daily).Symbol
# FRED data
self.fredPeakToTrough = self.AddData(Fred, Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough).Symbol
self.fredPeakToTrough = self.AddData(Fred, Fred.OECDRecessionIndicators.UnitedStatesFromPeakThroughTheTrough, Resolution.Daily).Symbol
def OnData(self, data):
if data.ContainsKey(self.cboeVix):