[R-SIG-Finance] RQuantLib DiscountCurve failed when settleDate and Holiday
Charles Duranceau
cduranceau at nial.ky
Thu Jul 6 19:54:24 CEST 2017
Hi,
I'm working with the Discount Curve function found a case where the bootstrap failed when
Error message: Error: 1st iteration: failed at 1st alive instrument, pillar October 4th, 2017, maturity October 4th, 2017, reference date July 5th, 2017: negative time (-0.00273973) given
a) Using a settlement date in parameter (t+2) and
b) there's holiday.
I present below a reproducible example.
I would like to know if this is normal and how should I use the "settleDate "correctly.
Thank you
Bets Regards
Charles
Reproducible case
library("RQuantLib")
legparam<-list(dayCounter="Thirty360",fixFreq="Semiannual",floatFreq="Quarterly")
tsQuotes <- list(d3m = 0.0363,
fut1=96.2875,
fut2=96.7875,
fut3=96.9875,
fut4=96.6875,
fut5=96.4875,
fut6=96.3875,
s2y = 0.037125,
s3y = 0.0398,
s5y = 0.0443,
s10y = 0.05165,
s15y = 0.055175)
times <- c(0.25,0.5,0.75,1,2,3,5,10,14.75)
dateValue<-as.Date("2017-06-30")
dateSett<-advance(calendar="UnitedStates/Settlement", dateValue, 2,0) # fall on the 5th this is correct as the 4th is holiday
params<-list(tradeDate=dateValue,settleDate=dateSett,dt=.25,interpWhat="zero",interpHow="linear")
setEvaluationDate(dateValue)
DiscountCurve(params,tsQuotes,times,legparam) # does not works
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RQuantLib_0.4.3
loaded via a namespace (and not attached):
[1] zoo_1.7-12 lazyeval_0.2.0 magrittr_1.5 R6_2.1.2 assertthat_0.2.0 DBI_0.6-1 tools_3.3.2 tibble_1.3.3
[9] Rcpp_0.12.10 stringi_1.1.5 grid_3.3.2 rlang_0.1.1 lattice_0.20-34
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list