QuantConnect/Lean · warning · RegressionTestException
{Time} unexpected symbol changed event {changedEvent}!
Error message
{Time} unexpected symbol changed event {changedEvent}! What it means
The extended-market futures regression asserts SymbolChangedEvents (rollovers) occur only at midnight (Time.TimeOfDay == TimeSpan.Zero). Because this algorithm trades extended market hours, an off-midnight mapping is especially suspect — it suggests the rollover leaked into the extended session rather than the daily boundary.
Source
Thrown at Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketAlgorithm.cs:82
var benchmark = AddEquity("SPY");
SetBenchmark(benchmark.Symbol);
var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
SetSecurityInitializer(security => seeder.SeedSecurity(security));
}
/// <summary>
/// Event - v3.0 DATA EVENT HANDLER: (Pattern) Basic template for user to override for receiving all subscription data in a single event
/// </summary>
/// <param name="slice">The current slice of data keyed by symbol string</param>
public override void OnData(Slice slice)
{
foreach (var changedEvent in slice.SymbolChangedEvents.Values)
{
Debug($"{Time} - SymbolChanged event: {changedEvent}");
if (Time.TimeOfDay != TimeSpan.Zero)
{
throw new RegressionTestException($"{Time} unexpected symbol changed event {changedEvent}!");
}
}
if (!Portfolio.Invested)
{
foreach(var chain in slice.FutureChains)
{
// find the front contract expiring no earlier than in 90 days
var contract = (
from futuresContract in chain.Value.OrderBy(x => x.Expiry)
where futuresContract.Expiry > Time.Date.AddDays(90)
select futuresContract
).FirstOrDefault();
// if found, trade it
if (contract != null)
{
_contractSymbol = contract.Symbol;View on GitHub (pinned to d2c3659f87)
Solutions
- Confirm extended-hours subscription does not shift the rollover slice Time off midnight.
- Verify DataMappingMode maps at the daily boundary for the extended feed.
- If extended-session rollovers are legitimate for your feed, relax the midnight assertion.
- Ensure the continuous-contract mapping clock aligns with the intended session calendar.
Example fix
// before
if (Time.TimeOfDay != TimeSpan.Zero) { throw ...; }
// after: log and investigate extended-session rollovers
if (Time.TimeOfDay != TimeSpan.Zero) { Log($"Extended-session rollover at {Time}: {changedEvent}"); } Defensive patterns
Strategy: validation
Validate before calling
foreach (var changedEvent in slice.SymbolChangedEvents.Values)
{
if (Time.TimeOfDay != TimeSpan.Zero)
{
Log($"{Time} - Extended-session rollover: {changedEvent}. Verify feed/mapping.");
}
} Prevention
- Confirm extended-hours subscription does not shift rollover Time off midnight.
- Verify DataMappingMode maps at the daily boundary.
- Pin Lean version for deterministic extended-session rollover timing.
When it happens
Trigger: A SymbolChangedEvent arrives in OnData while Time.TimeOfDay != TimeSpan.Zero in an extended-hours futures algorithm — the continuous contract remapped during the extended or regular session instead of midnight.
Common situations: Extended-hours data shifted the mapping timestamp; DataMappingMode timing changed; an extended-market subscription caused the slice Time to read an intraday value at rollover; engine version altered mapping emission for extended sessions.
Related errors
- {Time} unexpected symbol changed event {changedEvent}!
- {Time} unexpected symbol changed event {changedEvent}!
- {Time} - Unexpected symbol changed event old symbol: {change
- {Time} - Unexpected symbol changed event new symbol: {change
- Unexpected number of symbol changed events (mappings): {_map
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/956cf64b101c6773.
Report an issue: GitHub.