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:
@@ -47,7 +47,15 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
SetEndDate(2013, 07, 02);
|
||||
|
||||
var foxa = QuantConnect.Symbol.Create("FOXA", SecurityType.Equity, Market.USA);
|
||||
_symbol = AddData<CustomDataUsingMapping>(foxa).Symbol;
|
||||
_symbol = AddData<CustomDataUsingMapping>(foxa, Resolution.Tick).Symbol;
|
||||
|
||||
foreach (var config in SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(_symbol))
|
||||
{
|
||||
if (config.Resolution != Resolution.Minute)
|
||||
{
|
||||
throw new Exception("Expected resolution to be adjust to Minute");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -164,6 +172,11 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
return ParseEquity(config, line, date);
|
||||
}
|
||||
|
||||
public override Resolution AdjustResolution(Resolution resolution)
|
||||
{
|
||||
return Resolution.Minute;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user