Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBring addHoliday() function to RQuantLib #115
Comments
|
That has come up in the past, and we decided against / said we cannot do it as you cannot easily persist the data from one session to the next. Easier to do something locally:
|
|
This is what i do currently but because the holidays are outside RQuantLib, I am unable to use any inbuilt calendar functions. For my use case, i am quite happy to reload holidays in RQuantLib at the start of each session. I have not used QuantLib directly, but posts suggest that QuantLib will also not persist any changes via addHoliday() or removeHoliday() . Please do reconsider if it makes sense. Thanks! |
|
Adding interfaces to I could add them, but not export them so you would need three colons to access them as an internal function. |
|
It was quick enough so I added it: > library(RQuantLib)
> thisweek <- Sys.Date() + -2:2
> thisweek
[1] "2018-08-20" "2018-08-21" "2018-08-22" "2018-08-23" "2018-08-24"
> isHoliday("TARGET", thisweek)
[1] FALSE FALSE FALSE FALSE FALSE
> addHolidays("TARGET", Sys.Date() + -1:1)
> isHoliday("TARGET", thisweek)
[1] FALSE TRUE TRUE TRUE FALSE
> removeHolidays("TARGET", Sys.Date() + -1:1)
> isHoliday("TARGET", thisweek)
[1] FALSE FALSE FALSE FALSE FALSE
> Will commit in a moment. |
add and remove dates (closes #115)
Quantlib has addHoliday()/removeHoliday() that adds/removes a "temporary" holiday to a calendar. However, i cannot find any such feature in RQuantLib. This will be very useful for users who install RQuantLib using the binary on Windows. Also, this function will provide functionality to implement adhoc holidays, without the need for time-consuming recompilation of Quantlib.