RE: Caplet volatility structure

Posted by Luigi Ballabio-2 on
URL: http://quantlib.414.s1.nabble.com/Caplet-volatility-structure-tp2702p2705.html

At 08:48 AM 10/8/03, Perissin Francesco wrote:

>From: amar singh [mailto:[hidden email]]
>Sent: martedì, 7 ottobre 2003 20:53
>To: Perissin Francesco; '[hidden email]'
>Subject: RE: [Quantlib-users] Caplet volatility structure
>
>Francesco,
>
>Thanks very much for your help!  I actually want to study the effect of
>different combinations of model parameters , on the termstructure of
>caplet voaltilities. I was passing a dummy value as voaltility into the
>constructor of Caphelper, and using the pricing engine based on the model
>I want to study,to calculate the npv.
>
>Hi Amar
>you are right, the dummy Black Volatility will have no effect on the
>helper's NPV. Same thing holds if you are using impliedVolatility method.
>What you are not able to do at the moment is to calculate the so called
>"caplet forward volatilities" implied by the model, since the volatility
>resulting from impliedVolatility method is a double, not an array.
>Instead, you are able to calculate a vector of "caps par volatilities".

Hi all,
         the problem is, CapHelper is just a helper class for model
calibration and is not fit for doing any more than that. The solution to
your problem would be to add an impliedVolatility() method to the full
featured VanillaCapFloor instrument. Were it available, you could write:

     // Make a model...
     Handle<Model> model(new HullWhite(termStructure,a,sigma));
     // ...and an engine to price caps on it.
     Handle<PricingEngine> engine(new TreeCapFloor(model,timeSteps));

     // Make a string of 6-months floating-rate coupons.
     std::vector<Handle<CashFlow> > underlyings =
         FloatingRateCouponVector(...);

     // For each one...
     for (int i=0; i<underlyings.size(); i++) {
         Handle<CashFlow> coupon = underlyings[i];

         // ...make a single-element vector containing the coupon...
         std::vector<Handle<CashFlow> > singleCoupon(1, coupon);
         // ...and another one with the appropriate strike for this maturity.
         Rate strike = ...;
         std::vector<Rate> singleStrike(1, strike);

         // Now you can make a single-period cap, i.e., a caplet...
         VanillaCap caplet(singleCoupon, singleStrike, termStructure, engine);

         // ...calculate its value according to the model...
         double price = caplet.NPV();

         // ...and if you had this one method (which is the only thing
         // in this code currently missing from the library), you could
         // calculate its Black volatility.
         double capletVolatility = caplet.impliedVolatility(price);

         // Repeatedly printing (or collecting) the results would give you
         // the caplet-volatility term structure.
         std::cout << coupon->date() << "\t" << capletVolatility << std::endl;
     }

Right now I can't assess how much work that would be, therefore I can't
promise it will be in next release---and besides, it's wise never to do any
such promise :) However, it won't hurt to file it as a feature request on
Sourceforge. The URL is
http://sourceforge.net/tracker/?group_id=12740&atid=362740

Cheers,
         Luigi