Skip to content

Fix XSAU bound_max error msg. #445

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

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 21 additions & 29 deletions exchange_calendars/exchange_calendar_xsau.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,27 @@
NationalDayOfSaudiArabia = Holiday("National Day of Saudi Arabia", month=9, day=23)

# https://www.saudiexchange.sa/wps/portal/saudiexchange/about-saudi-exchange/exchange-media-centre/saudi-exchange-holiday-calendar?locale=en
EidAlAdhaHoliday = pd.to_datetime(np.concatenate(
[
pd.date_range('2024-06-13', '2024-06-23'),
pd.date_range('2023-06-27', '2023-07-02'),
pd.date_range('2022-07-07', '2022-07-13'),
pd.date_range('2021-07-16', '2021-07-22')
]))

EidAlFiterHoliday = pd.to_datetime(np.concatenate(
[
pd.date_range('2024-04-05', '2024-04-15'),
pd.date_range('2023-04-18', '2023-04-25'),
pd.date_range('2022-04-28', '2022-05-08'),
pd.date_range('2021-05-13', '2021-05-16')
]))
EidAlAdhaHoliday = pd.to_datetime(
np.concatenate(
[
pd.date_range("2024-06-13", "2024-06-23"),
pd.date_range("2023-06-27", "2023-07-02"),
pd.date_range("2022-07-07", "2022-07-13"),
pd.date_range("2021-07-16", "2021-07-22"),
]
)
)

EidAlFiterHoliday = pd.to_datetime(
np.concatenate(
[
pd.date_range("2024-04-05", "2024-04-15"),
pd.date_range("2023-04-18", "2023-04-25"),
pd.date_range("2022-04-28", "2022-05-08"),
pd.date_range("2021-05-13", "2021-05-16"),
]
)
)


class XSAUExchangeCalendar(ExchangeCalendar):
Expand All @@ -48,24 +54,10 @@ class XSAUExchangeCalendar(ExchangeCalendar):
def bound_min(cls) -> pd.Timestamp:
return pd.Timestamp("2021-01-01")

def _bound_min_error_msg(self, start: pd.Timestamp) -> str:
msg = super()._bound_min_error_msg(start)
return (
msg
+ f"(The exchange {self.name} does not have complete holidays prior to 2021.)"
)

@classmethod
def bound_max(cls) -> pd.Timestamp:
return pd.Timestamp("2024-12-31")

def _bound_max_error_msg(self, end: pd.Timestamp) -> str:
msg = super()._bound_min_error_msg(end)
return (
msg
+ f"(The exchange {self.name} does not have complete holidays beyond 2023.)"
)

@property
def regular_holidays(self):
return HolidayCalendar([SaudiFoundingDay, NationalDayOfSaudiArabia])
Expand Down
Loading