The United States Calendar package contains two modules:
- federal_holiday: module that has functions for United States Federal Holiday
- market_open: module that has functions for if the United States Stock Markets are open
returns True if day is a federal holiday
returns name of holiday given a date, None if there is no holiday
returns True if day is on a weekend
returns True if day is on a weekday
returns True if it's a working day for federal employees
returns True if it's an off day for federal employees
marketopen.market_open('2021-11-28') Returns False
marketopen.market_open('2021-11-29) Returns True
marketopen.market_open('2023-11-23') Returns True
marketopen.market_open('2021-07-04') Returns False
pip install git+https://github.com/mmcelhan/federalholiday.git#egg=federalholiday
source code is here: https://github.com/mmcelhan/federal_holiday_calendar_source
The testing file shows all Federal Holidays through 2030 are correctly applied
from uscalendar import federalholiday as fh
fh.is_federal_holiday(‘2030-01-01’) # New Years Day, 2030
Returns True
fh.is_federal_holiday(‘2030-1-1’) # to test date formatting
Returns True
fh.is_federal_holiday(‘2030-1-2’) # not a holiday
Returns False
fh.holiday_name(‘2030-01-01’)
Returns ‘New Years Day’
fh.is_day_off(‘2030-01-01’)
Returns True
fh.is_off_day(‘2030-01-01’)
Returns True