Address reviews

- Replacing `BaseData.AdjustResolution` for `DefaultResolution` and
`SupportedResolutions`
- Making `Resolution` nullable for `Algorithm.AddData` methods
- The `ISubscriptionDataConfigService` will set the default resolution
if none was provided and assert it is supported
- Fix bug with `PythonData` `IsSparseData` and `RequiresMapping`
resolution
This commit is contained in:
Martin Molinero
2019-10-30 14:04:30 -03:00
parent 1d43dcd601
commit 68ad2f51b6
22 changed files with 409 additions and 193 deletions
@@ -47,13 +47,13 @@ namespace QuantConnect.Algorithm.CSharp
SetEndDate(2013, 07, 02);
var foxa = QuantConnect.Symbol.Create("FOXA", SecurityType.Equity, Market.USA);
_symbol = AddData<CustomDataUsingMapping>(foxa, Resolution.Tick).Symbol;
_symbol = AddData<CustomDataUsingMapping>(foxa).Symbol;
foreach (var config in SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(_symbol))
{
if (config.Resolution != Resolution.Minute)
{
throw new Exception("Expected resolution to be adjust to Minute");
throw new Exception("Expected resolution to be set to Minute");
}
}
}
@@ -78,7 +78,7 @@ namespace QuantConnect.Algorithm.CSharp
_initialMapping = true;
}
else if(Time.Date == new DateTime(2013, 06, 29))
else if (Time.Date == new DateTime(2013, 06, 29))
{
if (mappingEvent.NewSymbol != "FOXA"
|| mappingEvent.OldSymbol != "NWSA")
@@ -173,10 +173,25 @@ namespace QuantConnect.Algorithm.CSharp
return ParseEquity(config, line, date);
}
public override Resolution AdjustResolution(Resolution resolution)
/// <summary>
/// Gets the default resolution for this data and security type
/// </summary>
/// <remarks>This is a method and not a property so that python
/// custom data types can override it</remarks>
public override Resolution DefaultResolution()
{
return Resolution.Minute;
}
/// <summary>
/// Gets the supported resolution for this data and security type
/// </summary>
/// <remarks>This is a method and not a property so that python
/// custom data types can override it</remarks>
public override List<Resolution> SupportedResolutions()
{
return new List<Resolution> { Resolution.Minute };
}
}
}
}