Caplet volatility structure

Posted by amar singh on
URL: http://quantlib.414.s1.nabble.com/Caplet-volatility-structure-tp2702.html

 
How can I get the term structure of calpet volatilities implied by a given model? ( I had used the following for cap volatility, and was wondering if startDate in cap/caphelper could somehow be changed to make it a caplet .Or is there some other better way?) :
 
Handle<Model> modelHW(new HullWhite(rhTermStructure),0.05,0.02);//to plot the curve for a=0.05 / sigma = 0.02
for (double t=1;t<30;t++)
{
 CapHelper capHelperObj(Period(t,Years),RelinkableHandle<MarketElement>(Handle<MarketElement>( new SimpleMarketElement(0.1)),indexSixMonths,rhTermStructure);  //dummy volatility of 0.1
capHelperObj.setPricingEngine(
            Handle<PricingEngine>(new AnalyticalCapFloor(modelHW)));
double npv = capHelperObj.modelprice();
double impliedVolatity = capHelperObj.impliedVolatility(npv, 1e-4,
                1000, 0.05, 0.50)*100.0;
}
 
Regards,
Amar


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search