Skip to main content

Calendário de dias úteis, dias corridos e dias 360 (30/360).

Project description

Workadays:

Pacote para calcular dias úteis, dias corridos e dias na base 360 (30/360).

Há calendários de feriados do Brasil, Estados Unidos, Luxemburgo, Reino Unido e Argentina.

Considera o novo feriado dos EUA, Juneteenth. Consulte: https://pt.wikipedia.org/wiki/Juneteenth

Considera o novo feriado nacional de 20/Nov (Conciência Negra)

Calendário de dias úteis:

import datetime as dt
from workadays import workdays as wd

Dias corridos

d1 = dt.date(2018, 1, 7)
d2 = dt.date(2020, 12, 31)
print(wd.days(d1, d2))                          # 1089

Dias corridos, base 30U/360, método americano

d1 = dt.date(2018, 1, 7)
d2 = dt.date(2020, 12, 31)
print(wd.days360(d1, d2, method_eu=False))     # 1074

Dias corridos, base 30E/360, método europeu

d1 = dt.date(2018, 1, 7)
d2 = dt.date(2020, 12, 31)
print(wd.days360(d1, d2, method_eu=True))     # 1073

Diferença de dias úteis entre duas datas

d1 = dt.date(2018, 1, 7)
d2 = dt.date(2020, 12, 31)
print(wd.networkdays(d1, d2))                # 750

Diferença de dias úteis entre duas datas sem calendário de feriados (considera apenas os finais de semana como dia não útil)

d1 = dt.date(2018, 1, 7)
d2 = dt.date(2020, 12, 31)
print(wd.networkdays(d1, d2, country=None))  # 779

# Soma 252 dias úteis com calendário de feriados padrão do Brasil

d1 = dt.date(2018, 1, 7)
print(wd.workdays(d1, 252))                  # 09/01/2019

Soma 252 dias úteis a data de referência utilizando o calendário Brasil e de SP

d1 = dt.date(2018, 1, 7)
print(wd.workdays(d1, 252, country=None))    # 25/12/2018

Verifica se é feriado

d1 = dt.date(2018, 1, 7)
print('É feriado? ', wd.is_holiday(d1, country='BR', years=range(2020, 2021)))

Verifica se é final de semana

d1 = dt.date(2018, 1, 7)
print('É final de semana? ', wd.is_weekend(d1))

Verifica se é dia útil

d1 = dt.date(2018, 1, 7)
print('É dia útil? ', wd.is_workday(d1, country='BR', years=range(2020, 2021)))

Verifica se é ano bissexto

print('É ano bissexto? ', wd.is_leap_year(2008))

Exibe a lista de feriados do Brasil e de São Paulo

for date in wd.get_holidays(country='BR', state='SP', years=range(2020, 2022)):
    print(date)

Exibe a lista de feriados da Inglaterra e das Libor's

for date in wd.get_holidays(country='England', years=range(2019, 2023)):
    print(date)

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

workadays-2023.12.30.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

workadays-2023.12.30-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file workadays-2023.12.30.tar.gz.

File metadata

  • Download URL: workadays-2023.12.30.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for workadays-2023.12.30.tar.gz
Algorithm Hash digest
SHA256 32999c996f45e126bb85bb1a2b2cbc8f4043609132015efcc77af675fa133592
MD5 65cafd086d364f98fdce79ce9bbce81b
BLAKE2b-256 c68a046bad09b2f0f68731190f09f3c4d582e49feb07c1292b1f55d221f36ee4

See more details on using hashes here.

File details

Details for the file workadays-2023.12.30-py3-none-any.whl.

File metadata

File hashes

Hashes for workadays-2023.12.30-py3-none-any.whl
Algorithm Hash digest
SHA256 97cf5feb72982212aa74783d17a296434d1a9890885f6d08426096124fcf99b6
MD5 151d9fdc5bd05333d76abacd639543b1
BLAKE2b-256 efe16260bb0358ce71a15494b1248eef9eece7bedf60241f94b0b9b2d1c3a14c

See more details on using hashes here.

Supported by

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