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.2.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.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uscalendar-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 68839b240172770d30f7dea88728836fb16971b1e752029d2e5f22c10d792ce6
MD5 6b5a40b45a832cb219d4ce4e5da9799b
BLAKE2b-256 7aed5a110599bbe0e6023f3f72bc6c47c48c3b9c15b431167d08149c0aaef168

See more details on using hashes here.

File details

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

File metadata

  • Download URL: uscalendar-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b64449bb1866f0a6ea23873d2230dc283b9955fa3fb4c3295f8671f15170c390
MD5 56578c87d948e391d285d0bfc4241169
BLAKE2b-256 e40e9c531ea29bd4837180e2bce080c2b8fe90045b5e117f1f3a6deaa1fb0430

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