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

Futures Early Close Removing The Entire Day #7501

Closed
4 tasks done
AlexCatarino opened this issue Oct 5, 2023 · 2 comments · Fixed by #7503 or #7605
Closed
4 tasks done

Futures Early Close Removing The Entire Day #7501

AlexCatarino opened this issue Oct 5, 2023 · 2 comments · Fixed by #7503 or #7605
Assignees
Labels

Comments

@AlexCatarino
Copy link
Member

Expected Behavior

The algorithm receives data until the early close and then resumes when the market opens.

Actual Behavior

The algorithm with ES is skipping the entire day. E.g Jan 16th 2012
Accoring to the MHDB market-hours-database.json#L20590, it should trade until 12 PM.

Potential Solution

Reproducing the Problem

# region imports
from AlgorithmImports import *
# endregion

class DeterminedTanGaur(QCAlgorithm):
    def Initialize(self):
        self.SetStartDate(2012, 1, 12)
        self.SetEndDate(2012, 1, 19)
        self.future = self.AddFuture(
            Futures.Indices.SP500EMini, 
            Resolution.Minute,
            dataMappingMode=DataMappingMode.OpenInterest,
            extendedMarketHours=True
        )

    def OnData(self, data):
        if self.Time.day in [15, 16, 17]:
            self.Plot(self.future.Symbol, 'Price', self.future.Price)

The plot shows a gap during the 16th.

We have the data: 20120116_es_minute_trade_201203_20120316.csv

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
@cperotlsq
Copy link

Hey @AlexCatarino, @Martin-Molinero, @Marinovsky, I think this issue might have been closed prematurely as the PR seems to only fix one date (the one originally used as an example).

I took the list of CME holidays from the market-hours-database.json and then intersected that with the early close days given by pandas market calendars. This yields a total of 169 more dates from 1998 through 2024 that are marked as holidays but pandas market calendars says are early close days (see screenshot below).

Maybe we can reopen the issue and look more into this?

Thanks,
Cameron

Screenshot_2023-10-10_11-42-55

@Martin-Molinero
Copy link
Member

Hi @cperotlsq! Thanks for the report, we will look into it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants