A few question

Posted by Schnettler, Pete on
URL: http://quantlib.414.s1.nabble.com/A-few-question-tp2373.html

I have working on adding to the great work that Jens has done so far in
porting QuantLib to .NET

As I have going through the code, I had a few questions.

1.  In the BlackCapFloor pricing engine

the C++ code BlackCapFloor::calculate() has:

value += q * accrualTime * nominal *
                                     capletValue(start,forward,
                                                 parameters_.capRates[i],
                                                 model_->volatility());


I looked to Haug's book for an example.  On page 144 where he describes how
to calculate the caplet value and it looked the the denominator was missing
from the code.

value += ((accrualTime * nominal) / (1 + (forward * accrualTime))) * q *
       
CapletValue(start,forward,
       
parameters_.capRates[i],
                                                 model_->volatility());

When I run his example on the same page with the above change, I get Haug's
answer.

Am I missing something here??

2.  ExtendedCoxIngersollRoss extends CoxIngersollRoss in the ShortRateModels

In the constructor :

ExtendedCoxIngersollRoss::ExtendedCoxIngersollRoss(
            const RelinkableHandle<TermStructure>& termStructure,
            double theta, double k, double sigma, double x0)
        : CoxIngersollRoss(theta, k, sigma, x0),
          TermStructureConsistentModel(termStructure) {
            generateParameters();
        }
is passes to its base theta, k, sigma and x0 in that order.

in the base constructor:

 CoxIngersollRoss(Rate r0 = 0.05,
                             double theta = 0.1,
                             double k = 0.1,
                             double sigma = 0.1);
r0 comes first and then theta, k, sigma.

Shouldn't the constructor for ExtendedCoxIngersollRoss be instead

ExtendedCoxIngersollRoss::ExtendedCoxIngersollRoss(
            const RelinkableHandle<TermStructure>& termStructure,
            double theta, double k, double sigma, double x0)
        : CoxIngersollRoss(x0, theta, k, sigma),
          TermStructureConsistentModel(termStructure) {
            generateParameters();
        }
???

3.  We are postly a Bond shop, So I am taking on the Bond object(in C#).
The problem I face is to use the Scheduler to build the FixedRateCoupon.  If
I am not wrong it looks like one must start at the Maturity Date and work
there way back to the Settlement Date.  The Scheduler does not run backwards
from Maturity but instead forward from Start Date/Stub Date.

 In the Scheduler, is StubDate to be used when the purchase/settlement date
falls within a coupon period?  For the first coupon, should the
AccrualStartDate fall before the Settlement Date or should the
AccrualStartDate be the Settlement Date?

Thanks
Pete Schnettler, CFA