PiecewiseYieldCurve

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

PiecewiseYieldCurve

Plamen Neykov
Hi all,

I'm using the PiecewiseFlatForward and accounted some strange behaviour there
- I think it is just because the  PiecewiseYieldCurve class had not
overwritten the DiscountFactor discountImpl(Time) const method and therefore
the calculate() method of the LazyObject (resp. the
PiecewiseYieldCurve<C,I>::performCalculations() method) got never called.

I've added the following implementation in the PiecewiseYieldCurve and it
solved my problem:

template <class C, class I>
inline DiscountFactor PiecewiseYieldCurve<C,I>::discountImpl(Time t) const {
        calculate();
        return base_curve::discountImpl(t);
}


Am I seeing this correct or is there something other going wrong?

cheers
Plamen

attachment0 (189 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Quantlib-dev] PiecewiseYieldCurve

Luigi Ballabio
On 07/28/2005 01:13:18 PM, Plamen Neykov wrote:

> I'm using the PiecewiseFlatForward and accounted some strange
> behaviour there
> - I think it is just because the  PiecewiseYieldCurve class had not
> overwritten the DiscountFactor discountImpl(Time) const method and
> therefore
> the calculate() method of the LazyObject (resp. the
> PiecewiseYieldCurve<C,I>::performCalculations() method) got never
> called.
>
> Am I seeing this correct or is there something other going wrong?

It's correct. I never noticed this bug as it is only triggered when  
extrapolation = true. I fixed it in CVS and added a test.

Thanks,
        Luigi


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

There is no likelihood man can ever tap the power of the atom.
-- Robert Millikan, Nobel Prize in Physics, 1923