diff options
Diffstat (limited to 'R/cds_functions_generic.R')
| -rw-r--r-- | R/cds_functions_generic.R | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/R/cds_functions_generic.R b/R/cds_functions_generic.R index 1e0b54b8..ae28341f 100644 --- a/R/cds_functions_generic.R +++ b/R/cds_functions_generic.R @@ -656,6 +656,9 @@ indexspread <- function(index, tradedate=Sys.Date()){ }
indextheta <- function(index, tradedate=Sys.Date()){
+ if(nrow(index$cs)<=4){
+ return( NA )
+ }
current.pv <- indexpv(index, tradedate=tradedate)$bp
newmaturity <- index$cs$unadj.dates[nrow(index$cs)-4]
index$quotes$maturity <- newmaturity
|
