Closed nfarsi closed 8 years ago
What version of RQuantLib are you using? @tleitch has put a lot of extensions in, and (speaking from the top of my head) also alleviate this hard-coded constraint.
Version 1.6.2
There is no RQuantLib of that version number. You may be confusing this with the QuantLib version number.
Make sure you have RQuantLib 0.4.3. If you are on Windows see the README.md here at the top-level page to see how to get a pre-built binary.
Yes, I gave you the QuantLib version sorry. I used the following: binaries from CRAN Windows binaries: r-release: RQuantLib_0.4.2.zip
I will try using the source file RQuantLib_0.4.3.tar.gz and create a binary file from it Thank you.
As I said and wrote, there binaries for Windows for you.
I did
install.packages("drat")' install.packages("RQuantLib", type = "binary")
Installing package into ‘C:/Users/nfars/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/RQuantLib_0.4.2.zip' Content type 'application/zip' length 7259952 bytes (6.9 MB) downloaded 6.9 MB
package ‘RQuantLib’ successfully unpacked and MD5 sums checked
=> all went well but I am still having the same problems, parameters for the terms structure of interest rates and payFixed parameters value seem to be hard coded. I.e changing their respective value does not affect the value of the bermudan swaption
Ok, good. At least you have current code with a lot of other FI updates.
For this, I guess we need a code contribution from you or someone else...
Please check out SabrSwaption. It takes a vol cube input and will calculate both European and Bermudan swaptions and has no expiration/maturity limititaions. We have used it at the CFTC and so far results are reasonable for roughly $1T of reported swaption trades, though there are outliers I’m working to address.
The function AffineSwaption takes a flat strike structure vol matrix if you don’t need to add skew. I built it to get around the drawbacks in BermudanSwaption that you have identified.
Thank you for the info. The problème i have is whatever I do, I cannot download RQuantLib version 0.4.3 Therefore both function AffineSwaption and SabrSwaption cannot be used in version 0.4.2. Even though on the PDF file they appear. Asking about them via ?AffineSwaption I get no documentation available for it.
You did
install.packages("drat")
install.packages("RQuantLib", type = "binary")
and you missed on step in between these two to actually use drat:
drat::addRepo("ghrr")
as the point of using drat is to point to the repo that has the 0.4.3 binary for you.
I will add something to the documentation of BermudanSwaption to point to SabrSwaption as a richer replacement. Of course, you only see that if you actually get hold of the new version.
Great!!! Thank you Dirk, I have now the RQuantLib version 0.4.3 version. I will test the AffineSwaption and SabrSwaption as suggested by Terry and will revert back
I did some testts and AffineSwaption will allow me to do everything I need so all good. Thank you Dirk and Terry.
I'll leave this open chiefly as a reminder to mark BermudanSwaption as somewhat-deprecated / available for historic continuity only.
Thanks and congrats to @tleitch for writing such a fine replacement.
Glad it's of use. The Bermudan solution in the SabrSwaption (which is misnamed because SABR is path independent) is based on Peter Casper's markovfunctional. It uses the entire vol surfce on the path. I decided to have a single interface for the vol cube based valuation. AffineSwaption is similar, it does a European based on the vol matrix (flat vol by strike) but it also does a Bermudan that follows the nearest expiration/tenor to the final maturity.
I marked that in the documentation.
There is I know several parameters that are hard coded but most importantly to make it usable the following is needed 1) the term structure of interest rates seems to be hard coded at 0.05 (par of ts or tsQuotes), i.e. changing the term structure to other value does not change the Bermudan swaption value. For example below does not change the bermudan swaption value
tsQuotes <- list(d1w =0.08, d1m =0.08, d3m =0.08, d1y=0.08, s3y =0.08, s5y =0.08, s10y =0.08, s15y =0.08)
2) In the list of parameters (params), when I set payFixed =FALSE, it does not change the value of the bermudan swaption. In other words, a payer's swaption is hard coded, therefore it is not possible to calculate the value of the receivers swaption.
Finally, I really like the RQuantLib in R, it is so much easier to use than in Python, where the C++ source files need to be compiled etc. Would be great though if someone could get the Bermudan Swaption to work in R