Skip to content

Commit

Permalink
update BrazilExchange calendar: B3 no longer follows local holidays i…
Browse files Browse the repository at this point in the history
…n Sao Paulo
  • Loading branch information
felipenoris committed Jan 25, 2022
1 parent f187c87 commit c86cd40
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "4f18b42c-503e-5345-9536-bb0f25fc7038"
license = "MIT"
authors = ["Felipe Noronha <felipenoris@gmail.com>"]
repo = "https://github.com/JuliaFinance/BusinessDays.jl.git"
version = "0.9.14"
version = "0.9.15"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
6 changes: 3 additions & 3 deletions src/calendars/brazil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ function isholiday(::BrazilExchange, dt::Dates.Date)

if (
# Aniversário de São Paulo
( mm == 1 && dd == 25 && yy != 2022 )
( mm == 1 && dd == 25 && yy < 2022 )
||
# Revolucão
( mm == 7 && dd == 9 && yy != 2020 )
( mm == 7 && dd == 9 && yy != 2020 && yy < 2022 )
||
# Consciência Negra (since 2007)
( yy >= 2007 && mm == 11 && dd == 20 && yy != 2020 )
( yy >= 2007 && mm == 11 && dd == 20 && yy != 2020 && yy < 2022 )
# Christmas Eve
||
( mm == 12 && dd == 24)
Expand Down
29 changes: 29 additions & 0 deletions test/calendar_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,35 @@ test_bdays(:WeekendsOnly, (2019, 8, 23), (2019, 8, 24), 1)

# BrazilExchange 2022 calendar
@test isholiday(hc_brazil_exc, Dates.Date(2022, 1, 25)) == false # updated by Ofício Circular 150/2020-PRE
@test isholiday(hc_brazil_exc, Dates.Date(2022, 7, 9)) == false
@test isholiday(hc_brazil_exc, Dates.Date(2022, 11, 20)) == false
@test isholiday(hc_brazil_exc, Dates.Date(2022, 2, 28)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 3, 1)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 4, 15)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 4, 21)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 6, 16)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 9, 7)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 10, 12)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 11, 2)) == true
@test isholiday(hc_brazil_exc, Dates.Date(2022, 11, 15)) == true

@test BusinessDays.listholidays(hc_brazil_exc, Dates.Date(2022, 1, 1), Dates.Date(2022, 12, 31)) == [
Dates.Date("2022-01-01"), # Confraternização Universal (Sábado)
Dates.Date("2022-02-28"), # Carnaval (segunda)
Dates.Date("2022-03-01"), # Carnaval (Terça)
Dates.Date("2022-04-15"), # Paixão de Cristo
Dates.Date("2022-04-21"), # Tiradentes
Dates.Date("2022-05-01"), # Dia do Trabalho (Domingo)
Dates.Date("2022-06-16"), # Corpus Christi
Dates.Date("2022-09-07"), # Independência do Brasil
Dates.Date("2022-10-12"), # Nossa Senhora Aparecida
Dates.Date("2022-11-02"), # Finados
Dates.Date("2022-11-15"), # Proclamação da República
Dates.Date("2022-12-24"), # Véspera de Natal (sábado)
Dates.Date("2022-12-25"), # Natal (Domingo)
Dates.Date("2022-12-30"), # Véspera do ano novo
Dates.Date("2022-12-31") # Ano novo (Sábado)
]

# USSettlement HolidayCaledar tests
# Federal Holidays listed on https://www.opm.gov/policy-data-oversight/snow-dismissal-procedures/federal-holidays/#url=2015
Expand Down

2 comments on commit c86cd40

@felipenoris
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/53128

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.15 -m "<description of version>" c86cd40561ecc5a02bf0917d1b04b65a76d46186
git push origin v0.9.15

Please sign in to comment.