Skip to content

Annual Holiday with no offset or observance #7987

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

Closed
MichaelWS opened this issue Aug 11, 2014 · 17 comments · Fixed by #7988
Closed

Annual Holiday with no offset or observance #7987

MichaelWS opened this issue Aug 11, 2014 · 17 comments · Fixed by #7988
Labels
Bug Frequency DateOffsets
Milestone

Comments

@MichaelWS
Copy link
Contributor

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.

@rockg
Copy link
Contributor

rockg commented Aug 11, 2014

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

@MichaelWS
Copy link
Contributor Author

yes.

@jreback
Copy link
Contributor

jreback commented Aug 11, 2014

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

@MichaelWS
Copy link
Contributor Author

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

@MichaelWS
Copy link
Contributor Author

July 3rd is observed Monday Through Thursday

@jreback
Copy link
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)

@rockg
Copy link
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.

@MichaelWS
Copy link
Contributor Author

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

@jreback
Copy link
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)

@MichaelWS
Copy link
Contributor Author

what functionality would be needed besides this?

Should we add day of week functionality?

@MichaelWS
Copy link
Contributor Author

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

@rockg
Copy link
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.

@MichaelWS
Copy link
Contributor Author

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.

@MichaelWS
Copy link
Contributor Author

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

@rockg
Copy link
Contributor

rockg commented Aug 15, 2014

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

@MichaelWS
Copy link
Contributor Author

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

@jreback
Copy link
Contributor

jreback commented Aug 15, 2014

sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Frequency DateOffsets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants