Skip to main content

Package that contains modules for US Federal Holidays and US Market Opens

Project description

us_calendar_source

The United States Calendar package contains two modules:

  1. federal_holiday: module that has functions for United States Federal Holiday
  2. market_open: module that has functions for if the United States Stock Markets are open

Federal Holiday Functions

federal_holiday.is_federal_holiday(date)

returns True if day is a federal holiday

federal_holiday.holiday_name(date)

returns name of holiday given a date, None if there is no holiday

federal_holiday.is_weekend(date)

returns True if day is on a weekend

federal_holiday.is_weekday(date)

returns True if day is on a weekday

federal_holiday.is_working_day(date)

returns True if it's a working day for federal employees

federal_holiday.is_off_day(date)

returns True if it's an off day for federal employees

Market Open Functions

Sunday

marketopen.market_open('2021-11-28') Returns False

Monday

marketopen.market_open('2021-11-29) Returns True

Thanksgiving 2023

marketopen.market_open('2023-11-23') Returns True

Fourth of July

marketopen.market_open('2021-07-04') Returns False

Installing as a package:

pip install git+https://github.com/mmcelhan/us_calendar_built.git#egg=uscalendar

Source Code

source code is here: https://github.com/mmcelhan/us_calendar_source

The testing file shows all Federal Holidays through 2030 are correctly applied, and that the stock market opens are properly returned

Examples

Federal holiday examples

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

market open examples

Sunday

marketopen.market_open('2021-11-28')

Returns False

Monday

marketopen.market_open('2021-11-29)

Returns True

Thanksgiving 2023

marketopen.market_open('2023-11-23')

Returns True

Fourth of July

marketopen.market_open('2021-07-04')

Returns False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uscalendar-0.0.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uscalendar-0.0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file uscalendar-0.0.1.tar.gz.

File metadata

  • Download URL: uscalendar-0.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for uscalendar-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7fcf3aa8fa2bcdced4773b4e721ff087610bb4c62135e1c5f98a15d86884b79c
MD5 662957c873b0a03f156992f9ca7d6639
BLAKE2b-256 3b1c69c2b4a523ac981cc9ababd62a9c4541389dedde6ba6b5ee97c563d4d343

See more details on using hashes here.

File details

Details for the file uscalendar-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: uscalendar-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

File hashes

Hashes for uscalendar-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7031696429998280f6e855f52080dbb813d439f4985a68a0be186c98431b5efe
MD5 37b9b4fc3ac8d14123c97289512597e7
BLAKE2b-256 70505949f6528515c16a2022ffc0b1b23d01eb42214299b0e727b5d60778933f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page