-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Trading Calendar thinks some trading days are holidays #8592
Comments
Hey @fumoboy007! mind clarifying which asset, security type/market the issue refers too? |
@Martin-Molinero I am looking at the US equity market. I did a little more checking and it looks like the issue is pretty widespread. Reproduction CodeThe following code gets the daily trade bars for class CheckTradingDayAccuracy(QCAlgorithm):
def initialize(self):
self.set_start_date(2005, 1, 1)
self._spy = self.add_equity(
ticker='SPY',
resolution=Resolution.DAILY,
fill_forward=False
).symbol
def on_data(
self,
data: Slice
):
bar = data.bars.get(self._spy)
if bar is None:
return
current_date = bar.time.date()
trading_day = self.trading_calendar.get_trading_day(
day=current_date
)
if trading_day.public_holiday:
self.debug(f"The Trading Calendar thinks {current_date.isoformat()} is a public holiday even though it is not.")
if trading_day.weekend:
self.debug(f"The Trading Calendar thinks {current_date.isoformat()} is a weekend even though it is not.") Output
|
…f the generic settlement calendar. Fixes QuantConnect#8592.
#8594 should fix this issue. I didn’t see an existing |
Edit: Leaving issue open though: we should potentially consider removing the usage of |
Sounds good! |
Expected Behavior
The
TradingDay
for2020-11-11
should not be marked as a public holiday.Actual Behavior
The
TradingDay
for2020-11-11
is marked as a public holiday even though it was not.Potential Solution
Probably a data issue? I don’t know whether this is a one-off issue or whether there are more inaccuracies.
Reproducing the Problem
System Information
n/a
Checklist
master
branchThe text was updated successfully, but these errors were encountered: