0
$\begingroup$

Working with RQuantLib for the first time and trying to understand how the Swaption Vol Cube is being built. I am looking at volCF2CubeK.R file and my general understanding is that we are collecting ATM lognormal volatilities first in "atmMat" which is fine. Then comes the "smirk" part I don't understand. Why not just pass the entire set of vol spreads (with ATM being zero) for a particular tenor and expiry to QuantLib's SwaptionVolCube1 ? It looks like there is some interpolation involved with smirk that I don't understand why it's needed.

Also, what does CF2 and K stand for in the name of this file? Why is the file not called VolCube.R ?

atmMat = matrix(data = NA, nrow = length(expLvl), ncol = length(tenorLvl), 
dimnames = list(expLvl, tenorLvl))
for (i in 1:length(expLvl)) {
  for (j in 1:length(tenorLvl)) {
    atmMat[i, j] = tbl[tbl$Expiry == expLvl[i] & tbl$Tenor == 
    tenorLvl[j] & tbl$Spread == 0, ]$LogNormalVol
  }
}
smirk = matrix(ncol = length(strikes), nrow = length(expLvl) * 
  length(tenorLvl))
k = 0
for (i in 1:length(expLvl)) {
  for (j in 1:length(tenorLvl)) {
    k = k + 1
    for (n in 1:length(strikes)) {
      smirk[k, n] = tbl[tbl$Expiry == expLvl[i] & 
        tbl$Tenor == tenorLvl[j] & tbl$Spread == strikes[n], 
        ]$LogNormalVol - tbl[tbl$Expiry == expLvl[i] & 
        tbl$Tenor == tenorLvl[j] & tbl$Spread == 0, 
        ]$LogNormalVol
    }
  }
}
smirk <- na.spline(smirk, method = "natural")

On the C++ side, I see this call and it is the "qSwSmile" parameter from R that I am struggling with.

Handle<SwpVolStr>
        res(QuantLib::ext::shared_ptr<SwpVolStr>(new SwaptionVolCube1(swaptionVolAtm, 
        optionTenorsSmile,                                                               
        swapTenorsSmile, strikeSpreads, qSwSmile,
        swapIndex, shortSwapIndex, true,
        parameterGuess, parameterFixed, true, ec,
        .050)));

Any help is much appreciated.

Thanks.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.