CapFloor using BlackCapFloorEngine

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CapFloor using BlackCapFloorEngine

Mirko Raso
Hi,
   we had trouble using the "blackcapfloorengine" engine to value a cap where the current coupon is already fixed.
    The error is:

                  negative time (-0.07123) given

    Looking at the code, we noticed that algorithm try to find the variance value for the past fixing date so giving
    the error reported above (due to the checkRange() method of the TermStructure).
   
    If we are on right, a simple solution could be, as for the analyticcapfloorengine, to check the fixingTime and, if negative, put
    the variance to zero without using the volatility_->blackVariance() method.
   
    Thanks in advance,

    Elisabetta & Mirko

    P.S.
         
    This is an extract of our code:  

       ....
      // declarations
       ....
       std::vector<boost::shared_ptr<CashFlow> > capLeg;
       boost::shared_ptr<CapFloor> myCapFloor;  


       ....

       Date AsOfDate (12, December, 2006);
        // Set Evaluation Date       
        Settings::instance().evaluationDate() = AsOfDate;
      
       ...
   
       boost::shared_ptr<Xibor> index(new Euribor6M(yieldTS));

       ...

       Date startDate(28, November, 2006);
       Date maturityDate = startDate +Period(5,Years);

       Schedule schedule(startDate, maturityDate, Period(couponFrequency),  index->calendar(), accrualConvention,
                                    paymentConvention, false, false );


        capLeg = FloatingRateCouponVector(schedule, paymentConvention,   std::vector<Real>(1,nominal),  2,  index,
                                                                   std::vector<Real>(),  std::vector<Spread>(),    dayCounter);

         Handle<Quote> vol(boost::shared_ptr<Quote>(new SimpleQuote(0.1)));
         boost::shared_ptr<PricingEngine> myEngine(new BlackCapFloorEngine(vol));

        myCapFloor = boost::shared_ptr<CapFloor>( new Cap(capLeg, std::vector<Rate>(1, strike),   yieldTS,  myEngine));

        double result = myCapFloor->NPV();

        ...
--
________________________________________________
Mirko Raso
Quantitative Analyst - Iccrea Banca S.p.A.
Dipartimento Risk Management
Modelli Analisi Quantitative
Via Lucrezia Romana 41/47 - 00178 Roma
Phone: +39 06 7207 5407
    
[hidden email]

__________________________________________________________________________________________________________________________________

Questo messaggio e gli eventuali allegati sono confidenziali e contengono informazioni riservate soltanto al destinatario espressamente indicato.
Qualsiasi utilizzo non autorizzato del presente messaggio e dei suoi eventuali allegati è vietato e potrebbe costituire reato.
Qualora abbiate ricevuto il presente messaggio per errore, Vi preghiamo di volerlo distruggere, insieme agli eventuali allegati, e di segnalarci l'errore via e-mail.
A meno che non sia espressamente indicato, le dichiarazioni contenute in questo messaggio, nonché nei suoi eventuali allegati, sono riconducibili
esclusivamente al mittente e non possono essere considerate come autorizzate da ICCREA BANCA S.p.A.
Tali dichiarazioni pertanto non impegnano ICCREA BANCA S.p.A. nei confronti del destinatario o di terzi. ICCREA BANCA S.p.A. ritiene ma non garantisce
che questo messaggio, e i suoi eventuali allegati, siano immuni da virus.
ICCREA BANCA S.p.A. si riserva il diritto di accedere e controllare tutte le comunicazioni trasmesse attraverso la propria rete aziendale.

__________________________________________________________________________________________________________________________________

Reply | Threaded
Open this post in threaded view
|

Re: CapFloor using BlackCapFloorEngine

Luigi Ballabio
On Mon, 2006-12-11 at 13:16 +0100, Mirko Raso wrote:
>    we had trouble using the "blackcapfloorengine" engine to value a
> cap where the current coupon is already fixed.
>     The error is:
>    
>     If we are on right, a simple solution could be, as for the
> analyticcapfloorengine, to check the fixingTime and, if negative, put
>     the variance to zero without using the
> volatility_->blackVariance() method.

Mirko,
        you are right. The issue was fixed---apologies for the delay.

Ciao,
        Luigi



----------------------------------------

Green's Law of Debate:
Anything is possible if you don't know what you're talking about.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users