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

XSES: holidays are only recorded to the year 2023 #295

Closed
ValueRaider opened this issue Mar 18, 2023 · 8 comments
Closed

XSES: holidays are only recorded to the year 2023 #295

ValueRaider opened this issue Mar 18, 2023 · 8 comments
Labels
calendar update Calendar needs updating

Comments

@ValueRaider
Copy link

import exchange_calendars as xcal
xcal.get_calendar("XSES", start="2023-01-01", end="2024-01-01")

ValueError: The XSES holidays are only recorded to the year 2023, cannot instantiate the XSES calendar through to 2024-01-01 00:00:00.

@maread99
Copy link
Collaborator

Hi @ValueRaider.

XSES and some other calendars rely on hardcoded holidays. If such a calendar is created with an end date beyond the date to which holidays have been included then this error is necessarily raised.

It's not a bug, just requires any user who wants the calendar to end later to offer a PR adding holidays, in this case for 2024.

Users tend to offer up these PRs towards the end of the each year.

For now, the following works:

cal = xcals.get_calendar("XSES", start="2023-01-01", end="2023-12-31")

@MMCMA
Copy link

MMCMA commented Apr 11, 2023

I don't even see 2023 for "XSES" - how can it be fixed?

cal = xcals.get_calendar("XSES", start="2023-01-01", end="2023-12-31")

Traceback (most recent call last):
  File "C:\ProgramData\mambaforge\envs\py310\lib\site-packages\IPython\core\interactiveshell.py", line 3460, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-9-57e402b3d4ed>", line 1, in <module>
    cal = xcals.get_calendar("XSES", start="2023-01-01", end="2023-12-31")
  File "C:\ProgramData\mambaforge\envs\py310\lib\site-packages\exchange_calendars\calendar_utils.py", line 291, in get_calendar
    return cached if cached is not None else self._fabricate(name, **kwargs)
  File "C:\ProgramData\mambaforge\envs\py310\lib\site-packages\exchange_calendars\calendar_utils.py", line 184, in _fabricate
    calendar = factory(**kwargs)
  File "C:\ProgramData\mambaforge\envs\py310\lib\site-packages\exchange_calendars\exchange_calendar.py", line 316, in __init__
    raise ValueError(self._bound_max_error_msg(end))
ValueError: The XSES holidays are only recorded to the year 2022, cannot instantiate the XSES calendar through to 2023-12-31 00:00:00.

@maread99
Copy link
Collaborator

$ pip install --upgrade exchange_calendars

@MMCMA
Copy link

MMCMA commented Apr 11, 2023

version is 4.2.5 - not sure if this is the problem.

@maread99
Copy link
Collaborator

The 2023 dates for XSES were added via this PR which was merged prior to the 4.2.5 release.

@MMCMA, could you run the following and post the print please...

import exchange_calendars as xcals
print(xcals.__version__)
cal = xcals.get_calendar("XSES", start="2023-01-01", end="2023-12-31")
print(cal.last_session)

@MMCMA
Copy link

MMCMA commented Apr 12, 2023

It seems I had version 4.2.4 (installed via conda-forge) - though the print(xcals.__version__) showed 0.0.0 not sure what is the problem with the forge package - switching and upgrading with pip solved the problem. Thanks and sorry.

@maread99
Copy link
Collaborator

No worries @MMCMA. We don't actively support conda (although someone might upload a version there). Glad you got it working.

@maread99 maread99 added the calendar update Calendar needs updating label Apr 12, 2023
@ValueRaider
Copy link
Author

Fixed by #343

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

No branches or pull requests

3 participants