Skip to content

Commit

Permalink
Fix futures and options expiry functions
Browse files Browse the repository at this point in the history
It's not clear how long these functions have been broken. The source of
the break started in 2008, when Jeff removed the generics and methods
for years(), quarters(), months(), etc. This might have been okay for
awhile, but perhaps S3 dispatch has become more restrictive since then
(e.g. a guess: methods in packages must be registered, not just named
like a S3 method).

The fix appears to be simple: use .indexmon() to replace the defunct
months.xts() method that isn't registered. Also delete the months.xts()
method to avoid more confusion.

Fixes #257.
  • Loading branch information
joshuaulrich committed Nov 14, 2018
1 parent fd8e659 commit bd675f7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions R/months.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ function(x) {
which(format(index(x),"%d") > 14 &
format(index(x),"%d") < 22 &
format(index(x),"%w")==5 &
as.numeric(months(x,TRUE)) %in% c(3,6,9,12))
}
months.xts <- function(x, abbreviate)
{
months(structure(.index(x), class=c('POSIXt','POSIXct')))
(.indexmon(x)+1) %in% c(3,6,9,12))
}

`nmicroseconds` <-
Expand Down

0 comments on commit bd675f7

Please sign in to comment.