NYSE Exchange Calendar
See original GitHub issue@glossner I have been working on an update for the MarketCalendar, which made me encounter a couple of things that I wanted your thoughts on.
-
In holidays_nyse.py, the date 1990-12-24 was in both lists, ChristmasEve1pmEarlyCloseAdhoc and ChristmasEve2pmEarlyCloseAdhoc. In the tests you seem to be checking whether the close was at 2pm, so I removed the date from the 1pm list. This is correct, right?
-
In a couple of places in NYSEExchangeCalendar, you (or shall I say we) rounded the times before 1901-12-14 because of a 4min timezone shift. Thinking about it, this may actually not be a good idea since technically that would be the incorrect time. Correct me if I’m wrong, but we would artifically be adding 4 minutes, and the following isn’t what a user might expect:
sched = nyse.schedule("1901-12-12", "1901-12-16")
sched
>>>
market_open market_close
1901-12-12 1901-12-12 15:00:00+00:00 1901-12-12 20:00:00+00:00
1901-12-13 1901-12-13 15:00:00+00:00 1901-12-13 20:00:00+00:00
1901-12-14 1901-12-14 15:00:00+00:00 1901-12-14 17:00:00+00:00
1901-12-16 1901-12-16 15:00:00+00:00 1901-12-16 20:00:00+00:00
sched.market_open.dt.tz_convert(nyse.tz)
>>>
1901-12-12 1901-12-12 10:04:00-04:56 # a user would have to know that these need to be rounded
1901-12-13 1901-12-13 10:04:00-04:56 # and are actually 4 minutes off
1901-12-14 1901-12-14 10:00:00-05:00
1901-12-16 1901-12-16 10:00:00-05:00
Name: market_open, dtype: datetime64[ns, America/New_York]
s
>>>
1901-12-12 1901-12-12 10:00:00-04:56
1901-12-13 1901-12-13 10:00:00-04:56
1901-12-14 1901-12-14 10:00:00-05:00
1901-12-16 1901-12-16 10:00:00-05:00
dtype: datetime64[ns, America/New_York]
s == sched.market_open
>>>
1901-12-12 False
1901-12-13 False
1901-12-14 True
1901-12-16 True
dtype: bool
If you want to, you can check out #150 PR and/or my fork, where I have implemented the calculations without rounding and have all tests pass with only minor tweaks.
Any thoughts or suggestions regarding this or the update are greatly appreciated.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@glossner, regarding special/multiple breaks, that may be a bit tricky and only rarely used so I will think about how to implement that at a later date.
@rsheftel, these changes are already part of #150! Unless you disagree, I didn’t consider this pressing enough to create a separate PR for it.
I am going to take the liberty to close this issue and keep an eye on #150 instead.
Thanks!
@Stryder-Git are these changes part of your #150 PR, or did you make another branch to submit a different PR?