Open cryptobiotic opened 2 years ago
How do you load a calendar from another package in the python version?
Unfortunately, at this moment, bizdays doesn't have this feature. But I believe this is a great feature to be implemented. Actually, the R version exports the calendar as a JSON and one possibility is having this JSON calendar loaded in the Python version. I just need to assure that that JSON calendar can be correctly loaded by the Python version.
The Python version's getdate
is sligthly different when compared to the R version.
But I have plans to make both versions equivalent.
About your last question, this can be perfectly done with the Calendar constructor.
import pandas_market_calendars as mcal
import bizdays
cal = mcal.get_calendar('NYSE')
calbd = bizdays.Calendar(
holidays=cal.holidays(),
weekdays=['Saturday', 'Sunday'],
name='NYSE')
How do you load a calendar from another package in the python version? In R I use bizdays all the time, its amazing. In that example, let's say I wanted to find the "last bizday" in a sequence and reference the Rmetrics/NYSE calendar: bizdays::getdate("last bizday",as.Date(timeSequence(from = as.Date('2020-01-01'), to = as.Date('2022-12-31'), by = "1 month")),"Rmetrics/NYSE")
In the python version, if i loaded for example: import pandas_market_calendars as mcal cal = mcal.get_calendar('NYSE') holidays = cal.holidays() How can i pass these holidays to bizdays for getdate?
Thanks!!