eddelbuettel / rquantlib

R interface to the QuantLib library
119 stars 50 forks source link

Error: effective date later than or equal to termination date #86

Closed peterqzhang closed 7 years ago

peterqzhang commented 7 years ago

The following code gives the error, "effective date later than or equal to termination date". The volatility matrix is the implied vol of six swaptions, 3 expiry (1,3,5 years) and 2 tenors (5, 10 years).

Please advise.

Thanks,

Peter

params <- list(tradeDate=as.Date('2017-4-11'), settleDate=as.Date('2017-4-11'), payFixed=TRUE, dt=delta_t, strike=.02, method="HWAnalytic", interpWhat="zero", interpHow= "spline")

tsQuotes <- list(d1m =0.0099, d3m = 0.0115511, d6m = 0.012219785152, d9m = 0.012942868128, d1y = 0.013466375577, s2y = 0.01557, s3y =0.01711, s5y =0.01933, s10y =0.02258, s15y =0.02422)

swaptionMaturities <- c(1,3,5) swapTenors <- c(5,10) volMatrix <- matrix( c(0.00739,0.00761, 0.0081,0.00798, 0.00825,0.00796), ncol=2, byrow=TRUE)

Pricing the Bermudan swaptions

pricing <- RQuantLib::BermudanSwaption(params, tsQuotes, swaptionMaturities, swapTenors, volMatrix)

peterqzhang commented 7 years ago

This error disappeared after I installed 0.4.3. The default version installed by "install.packages" is 0.4.2.

eddelbuettel commented 7 years ago

Nice.