Posted by
Hyung-Seok Hahm on
URL: http://quantlib.414.s1.nabble.com/Implement-Bermudan-swaption-in-QuantLibXL-tp291.html
Hi all,
I'm trying to implement Bermudan swaption in QuantLibXL.
There is a swaption example, named InterestRateDerivatives.xls as one of the StandaloneExamples in QuantLIbXL. Plus, there is another example for Bermudan swaption named BermudanSwaption.cpp as one of the Quantlib examples.
Basically what I'm trying to do is fill in the gap between these two examples. The problem lies in the fact that ShortRateModel and CalibrationHelper have not been implemented yet. To be more specific, I need to implement the following segment in BermudanSwaption.cpp.
void calibrateModel(
const boost::shared_ptr<ShortRateModel>& model,
const std::vector<boost::shared_ptr<CalibrationHelper> >& helpers) {
LevenbergMarquardt om;
model->calibrate(helpers, om,
EndCriteria(400, 100, 1.0e-8, 1.0e-8, 1.0e-8));
// Output the implied Black volatilities
for (Size i=0; i<numRows; i++) {
Size j = numCols - i -1; // 1x5, 2x4, 3x3, 4x2, 5x1
Size k = i*numCols + j;
Real npv = helpers[i]->modelValue();
Volatility implied = helpers[i]->impliedVolatility(npv, 1e-4,
100000, 0.05, 0.50);
Volatility diff = implied - swaptionVols[k];
std::cout << i+1 << "x" << swapLenghts[j]
<< std::setprecision(5) << std::noshowpos
<< ": model " << std::setw(7) << io::volatility(implied)
<< ", market " << std::setw(7)
<< io::volatility(swaptionVols[k])
<< " (" << std::setw(7) << std::showpos
<< io::volatility(diff) << std::noshowpos << ")\n";
}
}
I do not have a clue how to expose model->calibrate part in QuantLibXL.
I've been struggling with this for days, so any suggestion would be appreciatedl.
Thanks.
- Hyung
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users