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

Revert XKRX lunar/solar calendar based holidays to hardcoded dates #128

Open
maread99 opened this issue Jan 3, 2022 · 7 comments
Open

Comments

@maread99
Copy link
Collaborator

maread99 commented Jan 3, 2022

Given that we have a list of Korean holidays hardcoded in, how would people feel about removing all of the Korean Lunar/Solar calendar stuff? The code's not thread-safe at initialisation time, and it's relatively slow to do its computations. I'm happy to open up the PR removing it, and add any remaining necessary hardcoded holidays.

Originally posted by @philiptromans in #125 (comment)

@maread99
Copy link
Collaborator Author

maread99 commented Jan 3, 2022

Hi @philiptromans.

XKRX is certainly slow.

Would you know how many annual holidays, that are currently evaluated automatically from consideration of lunar/solar calendars, would require being hardcoded instead?

Quite a lot of work on the current implementation was undertaken by @elbakramer who might want to comment on the proposed changes?

Reverting these holidays to hardcoded dates would be @gerrymanoim's call.

If you were to go ahead with a PR, perhaps you'd be good enough to bear in mind bug #94 (perhaps it'd come out in the wash if these holidays are changed back to hardcoded dates?).

Cheers

@maread99
Copy link
Collaborator Author

maread99 commented Mar 3, 2022

@philiptromans, I saw your latest PR #152 (thanks!) and the suggestion again that XKRX is moved to hardcoded holidays.

I notice @elbakramer hasn't commented here. Also there was no response to a couple of open issues that I asked for input on back in October (#94 and #95). Given all of which, I thnk it's fair to say elbakramer's probably hasn't got an ongoing interest in the calendar.

Personally, I would also prefer to move to hardcoded dates. If the calendar is being used then it's not a lot of work for someone to update it each year. In return we'd:

@gerrymanoim, what do you reckon, should we move to hardcoded holidays if @philiptromans is happy to PR it?

@gerrymanoim
Copy link
Owner

Hey sorry for the delay. Fine by me! If it is causing us maintenance headaches, let's move it back to hardcoded.

@philiptromans
Copy link

philiptromans commented Mar 8, 2022 via email

@maread99
Copy link
Collaborator Author

In PR #177 I've proposed moving all the special offsets implementation from ExchangeCalendar to XKRXExchangeCalendar. It was originally incorporated to ExchangeCalendar for the benefit of XKRXExchangeCalendar. No other calendar uses it.

If XKRXExchangeCalendar were to be moved to hardcoded dates then I suspect all this could be lost from XKRXExchangeCalendar, together with the apply_special_offsets method that I've left on ExchangeCalendar as a hook into the constructor.

@maread99
Copy link
Collaborator Author

maread99 commented Jun 1, 2022

Worth noting that if this were to go to hardcoded dates then I believe the whole of the pandas_extensions directory would be made redundant. (EDIT 24-06-24 exchange_calendar_xmos.py now uses .pandas_extensions.offsets.MultipleWeekmaskCustomBusinessDay, i.e. would need to leave at least this functionality somewhere)

TestXKRXCalendar.test_feb_29_2022_in_lunar_calendar

(bit of an aside but kind of related. Noted here for reference.)

The above test is currently raising a DeprecationWarning:

exchange_calendars\exchange_calendars\pandas_extensions\korean_holiday.py:75: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
    if dt >= since:

The dt parameter of korean_holiday.alternative_holiday_func(dt, is_already_holiday, since) is occasionally receiving a pd.DatetimeIndex as opposed to a pd.Timestamp. The reason's not obvious to me - the callers are somewhere within the modules of pandas_extensions. Also, I haven't been able to recreate the warning outside of the test. EDIT - see #300.

@maread99
Copy link
Collaborator Author

Also, see #311 including comment re broken update_xkrx_holidays script.

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

No branches or pull requests

3 participants