A few question

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

A few question

Schnettler, Pete
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



Reply | Threaded
Open this post in threaded view
|

Re: A few question

Luigi Ballabio-2
Hi Pete,

At 05:18 PM 1/30/03 -0600, Schnettler, Pete wrote:

>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());

Well, it took a while to hunt this down. If only Hull and Haug would settle
on a common way to express things... (we took our formula from the former)

The difference is in the definition of q (the discount factor). In Haug's
formula, it is defined as the discount factor at the *start* of the caplet.
Therefore, it has to be compounded with the additional discount (1/1+Ft) to
allow for the fact that the caplet is paid at the end. In Hull's formula
instead, q is defined as the discount factor at the *end* of the caplet, so
that the additional fraction is not needed---so to speak, it is already
"included" in q.

>2.  ExtendedCoxIngersollRoss extends CoxIngersollRoss in the ShortRateModels
>
>Shouldn't the constructor for ExtendedCoxIngersollRoss be instead
>(omissis)
>???

Pretty good sleuthing here... You're right. I saw Sad has corrected it
already. Too bad it wasn't in time for 0.3.1 (to be released in a couple of
working days, the packages to be released have been made already). Oh well,
we'll just have to get 0.3.2 out earlier than we thought...


>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.

Yes, this is a known limitation of the Scheduler, and it surfaced already
once or twice. I've been planning to extend the class with the possibility
to go backwards, but I haven't had time to do it yet. It's most certainly
in the todo list, though.

>  In the Scheduler, is StubDate to be used when the purchase/settlement date
>falls within a coupon period?

No. The stub date is there because in Europe, a few states use (used?) to
issue bonds whose first coupon has a different tenor than the others (e.g.,
a 6-months or a 2-years first coupon followed by a number of 1-year ones.)
The stub date tells the scheduler to build the first coupon from startDate
to stubDate, and the following ones at regular invervals starting from
stubDate.

>For the first coupon, should the AccrualStartDate fall before the
>Settlement Date or should the AccrualStartDate be the Settlement Date?

The accrual start date should be the start date of the coupon, apart from
possible adjustments. It is independent of the valuation date.

Later,
         Luigi