33 private readonly DateTimeZone _targetTimeZone;
38 private readonly DateTimeZone _referenceTimeZone;
117 if (_previousInput ==
null)
119 _previousInput = input;
120 _resolution = GetResolution(input);
124 var isMatchingTime = CompareEndTimes(input.
EndTime, _previousInput.
EndTime);
126 if (input.
Symbol != _previousInput.
Symbol && isMatchingTime)
132 _previousInput = input;
148 return timeDifference.TotalHours > 1 ?
Resolution.Daily : timeDifference.ToHigherResolutionEquivalent(
false);
156 private DateTime AdjustDateToResolution(DateTime date)
163 return date.Date.AddHours(date.Hour);
165 return date.Date.AddHours(date.Hour).AddMinutes(date.Minute);
180 private bool CompareEndTimes(DateTime currentEndTime, DateTime previousEndTime)
185 currentEndTime = currentEndTime.ConvertToUtc(previousSymbolIsTarget ? _referenceTimeZone : _targetTimeZone);
186 previousEndTime = previousEndTime.ConvertToUtc(previousSymbolIsTarget ? _targetTimeZone : _referenceTimeZone);
188 return AdjustDateToResolution(currentEndTime) == AdjustDateToResolution(previousEndTime);
205 _previousInput =
null;