Fix invalid initial SymbolChanged event

- EventProvider will receive start date during initialization, this will
be used by the `MappingEventProvider` to correctly set current mapped
symbol
- Adding unit test, updating existing regression test
This commit is contained in:
Martin Molinero
2019-11-05 21:49:25 -03:00
parent e63ba13016
commit 86ffbcb3f9
16 changed files with 143 additions and 32 deletions
@@ -69,13 +69,12 @@ namespace QuantConnect.Algorithm.CSharp
Log($"{Time} - Ticker changed from: {mappingEvent.OldSymbol} to {mappingEvent.NewSymbol}");
if (Time.Date == new DateTime(2013, 06, 27))
{
// initial mapping event since we added FOXA and it's currently NWSA - GH issue 3327
// we should Not receive the initial mapping event
if (mappingEvent.NewSymbol != "NWSA"
|| mappingEvent.OldSymbol != "FOXA")
{
throw new Exception($"Unexpected mapping event {mappingEvent}");
}
_initialMapping = true;
}
else if (Time.Date == new DateTime(2013, 06, 29))
@@ -97,9 +96,9 @@ namespace QuantConnect.Algorithm.CSharp
/// </summary>
public override void OnEndOfAlgorithm()
{
if (!_initialMapping)
if (_initialMapping)
{
throw new Exception("The ticker did not generate the initial rename event");
throw new Exception("The ticker generated the initial rename event");
}
if (!_executionMapping)
{