Annual Holiday with no offset or observance #7987

Closed
MichaelWS opened this Issue Aug 11, 2014 · 17 comments

Comments

Projects
None yet
3 participants
Contributor

MichaelWS commented Aug 11, 2014

if observance is None and offset is None, Holiday breaks when Timestamp is added to None. This was a bug in the 0.14.1 before a recent PR. I will issue a pr for this shortly.

Example:

    july_3rd = Holiday('July 4th Eve', month=7,  day=3)

July 3rd is a nyse exchange early close that is observed only on July 3rd.

jreback added this to the 0.15.0 milestone Aug 11, 2014

Contributor

rockg commented Aug 11, 2014

Is this only observed when July 3rd is a weekday?

Contributor

MichaelWS commented Aug 11, 2014

yes.

Contributor

jreback commented Aug 11, 2014

July 3rd is only an observed half holiday though and only if July 4th is not observed

Contributor

MichaelWS commented Aug 11, 2014

but there are a lot of world holidays that work like this

Contributor

MichaelWS commented Aug 11, 2014

July 3rd is observed Monday Through Thursday

Contributor

jreback commented Aug 11, 2014

it's pretty specifc and tied to trading holidays
it's a general concept though - a relative holiday to another (that may or may not be observed or in a different manner)

Contributor

rockg commented Aug 11, 2014

Right, so the way the rule is now isn't right (it would be every july 3rd). There's needs to be an observance (mon-thurs) and not the other days (we don't have this capability right now). We could do something like observance = [MTWRFSU] for days of the week. Or have an offset be a Holiday object and a rule relative to that, but you would still have observance issues.

Contributor

MichaelWS commented Aug 11, 2014

Well, what my solution was for this is to maintain a list of holidays and early_closes and remove early_closes that are holidays.

Contributor

jreback commented Aug 11, 2014

@MichaelWS

need a concept of a relative holiday for this one that is dependent on another holiday (need to create this type of functionality)

maybe a DependentHoliday (or can just pass it as another argument)

Contributor

MichaelWS commented Aug 11, 2014

what functionality would be needed besides this?

Should we add day of week functionality?

Contributor

MichaelWS commented Aug 11, 2014

Also, would I be ok to remove Nones from dates?

I want to observe to Tokyo using a function that moves Sundays to Mondays and drops Saturdays

Contributor

rockg commented Aug 12, 2014

Let's take your July 3rd example. So it would be a DependentHoliday(HolidayJuly4th, offset=Day(-1), observance=?). However, if by making it dependent on July 4th holidays only show up during the week, then we may get the Mon-Thu observance for free. What if July 4th is on a Monday? We may want to implement the day of week functionality as I can see examples where it is probably useful.

I think it would be fine to remove None from dates...I don't know what they would mean.

Contributor

MichaelWS commented Aug 12, 2014

if July 4th is on a Monday, July 3rd is not observed on Friday.
I would like to have the function return None if its not observed. My example for Tokyo was Saturdays are just dropped.

Contributor

MichaelWS commented Aug 15, 2014

I implemented day of week functionality. is a tuple fine (0,1,2,3,4,5)?

Contributor

rockg commented Aug 15, 2014

Yes, that is definitely more natural given how python treats day of week in datetime

Contributor

MichaelWS commented Aug 15, 2014

ok, good enough. can I add it to my bug fix Pr?

Contributor

jreback commented Aug 15, 2014

sure

jreback closed this in #7988 Aug 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment