Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in DateChangeTimeKeeper #8470

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Engine/DataFeeds/DateChangeTimeKeeper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,12 @@ private bool TryEmitPassedExchangeDate()
// This data date passed, and it should have emitted as an exchange tradable date when detected
// as a date change in the data itself, if not, emit it now before moving to the next data date
var currentDataDate = _tradableDatesInDataTimeZone.Current;
if (_previousNewExchangeDate < currentDataDate &&
_exchangeHours.IsDateOpen(currentDataDate, _config.ExtendedMarketHours))
var currentExchangeTime = currentDataDate.ConvertTo(_config.DataTimeZone, _config.ExchangeTimeZone);
var currentExchangeDate = currentExchangeTime.Date;
if (_previousNewExchangeDate < currentExchangeDate &&
_exchangeHours.IsDateOpen(currentExchangeDate, _config.ExtendedMarketHours))
{
var nextExchangeDate = currentDataDate;
var nextExchangeDate = currentExchangeDate;
SetExchangeTime(nextExchangeDate);
EmitNewExchangeDate(nextExchangeDate);
return true;
Expand Down
4 changes: 3 additions & 1 deletion Engine/DataFeeds/SubscriptionDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,10 @@ private bool TryGetNextDate(out DateTime date)
while (_timeKeeper.TryAdvanceUntilNextDataDate())
{
date = _timeKeeper.DataTime.Date;
var exchangeDateTime = date.ConvertTo(_config.DataTimeZone, _config.ExchangeTimeZone);
var exchangeDate = exchangeDateTime.Date;

if (_pastDelistedDate || date > _delistingDate)
if (_pastDelistedDate || exchangeDate > _delistingDate)
{
// if we already passed our delisting date we stop
_pastDelistedDate = true;
Expand Down