R-fixedincome
R-fixedincome copied to clipboard
create a fixed daycount notation for datetime ranges
I need to create a daycount to specify fixed datetime intervals. For example, a spot rate is valid between 2 dates. So it depends on a calendar, but daycount doesn't refer to a calendar. What to do?
Suggestion:
as.daycount('fixed/2015-06-12:2015-07-12')
and use spotrate's calendar.
The problem is how to compute timefactor
and dib
that usually returns the number after /
.
One possible solution is: dib
and timefactor
methods have an optional argument for calendar.
dib(dc, calendar=NULL)
timefactor(dc, term, calendar=NULL)
and daycount could inform it has a datetime interval with a method has_daterange
, that method would be used in dib
, timefactor
simply passes through.
So, every time a curve use timefactor
it should pass a calendar.