Skip to content

Commit

Permalink
XSAU: add 2024 holidays + small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ValueRaider committed Jun 9, 2024
1 parent 588ae13 commit 1187ca7
Showing 1 changed file with 16 additions and 51 deletions.
67 changes: 16 additions & 51 deletions exchange_calendars/exchange_calendar_xsau.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,30 @@

import pandas as pd
from pandas.tseries.holiday import Holiday
import numpy as np # for concatenate

from exchange_calendars.exchange_calendar import ExchangeCalendar, HolidayCalendar

SaudiFoundingDay = Holiday("Saudi Founding Day", month=2, day=22)

NationalDayOfSaudiArabia = Holiday("National Day of Saudi Arabia", month=9, day=23)

EidAlAdhaHoliday = pd.to_datetime(
# 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(
[
"2023-06-27",
"2023-06-28",
"2023-06-29",
"2023-06-30",
"2023-07-01",
"2023-07-02",
"2022-07-07",
"2022-07-08",
"2022-07-09",
"2022-07-10",
"2022-07-11",
"2022-07-12",
"2022-07-13",
"2021-07-16",
"2021-07-17",
"2021-07-18",
"2021-07-19",
"2021-07-20",
"2021-07-21",
"2021-07-22",
]
)

EidAlFiterHoliday = pd.to_datetime(
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(
[
"2023-04-18",
"2023-04-19",
"2023-04-20",
"2023-04-21",
"2023-04-22",
"2023-04-23",
"2023-04-24",
"2023-04-25",
"2022-04-28",
"2022-04-29",
"2022-04-30",
"2022-05-01",
"2022-05-02",
"2022-05-03",
"2022-05-04",
"2022-05-05",
"2022-05-06",
"2022-05-07",
"2022-05-08",
"2021-05-13",
"2021-05-14",
"2021-05-15",
"2021-05-16",
]
)
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 Down Expand Up @@ -92,7 +57,7 @@ def _bound_min_error_msg(self, start: pd.Timestamp) -> str:

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

def _bound_max_error_msg(self, end: pd.Timestamp) -> str:
msg = super()._bound_min_error_msg(end)
Expand Down

0 comments on commit 1187ca7

Please sign in to comment.