CDS example

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

CDS example

Luca Billi
Hi all,

I'm looking at the CDS example in the repository and I see that the
bootstraping scheme
doesn't work if I use only one calibrating instrument.
The exception thrown says it needs at least 2 instruments.

Is this the expected behavior?

The error is caused by the BackwardFlat interpolation class requiring 2 points.
Technically, for flat interpolation one point might be enough.

Thanks,

Luca

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: CDS example

japari
Hi Luca, I am aware of the problem. It is the class IterativeBootstrap that
performs the test. Maybe it should delegate it. I made a temporary change on the
code and I could calibrate to one instrument (but I did not want to break all
the bootstrappers so I could not keep it :-)

True, in this case one instrument should be enough for *any* interpolation since
we should have an extra point for todays date but no instrument associated with
it. The value of the probability at that point depends on the value associated
to the one at the date of the intrument, on the probability model and on the
interpolator. (Plays the role of DF(t=0)=1 if you want).

As you say in the backwardflat case is more evident but independently of the
interpolator the region from t=0 to the first point should always be covered (we
might want to price an instruments with monthly payments) even when calling the
interpolator with the extrapoltaion "off".

The test (in "IterativeBootstrap<Curve>::setup"):
        Size n = ts_->instruments_.size();
        QL_REQUIRE(n >= Interpolator::requiredPoints, (...)

makes the comparison with the number of instruments and not with the number of
points in the bootstrapped curve (not necessarily the same number) We might fix
it asking the term structure and not counting the instruments; "setup" is called
right at the end of the calibrated term structure constructor and we have a ptr
to it. I havent done this myself since it affects all bootstrappers and need to
test a lot after it.

To be honest I havent finish going through the last commit of the code, I am
still modifying my client code to test the bootstrapping.

Regards, sorry for the long reply.

PP

Quoting Luca Billi <[hidden email]>:

> Hi all,
>
> I'm looking at the CDS example in the repository and I see that the
> bootstraping scheme
> doesn't work if I use only one calibrating instrument.
> The exception thrown says it needs at least 2 instruments.
>
> Is this the expected behavior?
>
> The error is caused by the BackwardFlat interpolation class requiring 2
> points.
> Technically, for flat interpolation one point might be enough.
>
> Thanks,
>
> Luca
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
>



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: CDS example

Luigi Ballabio
On Wed, 2008-05-14 at 00:24 +0200, [hidden email] wrote:
> True, in this case one instrument should be enough for *any* interpolation since
> we should have an extra point for todays date but no instrument associated with
> it.

True. Since we have an additional point for today's date (and since this
also holds for all other bootstrapped curves) I changed the check in
IterativeBootstrap so that it requires a number of instruments equal to
the number of required points minus one. The cases that used to work
should be unaffected (since they passed the stricter condition already)
and indeed, the existing test cases still pass.

Thanks for the report.

Luigi


--

Westheimer's Discovery:
A couple of months in the laboratory can frequently save a
couple of hours in the library.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: CDS example

Ferdinando M. Ametrano-3
On Wed, May 14, 2008 at 12:17 PM, Luigi Ballabio
<[hidden email]> wrote:
> Since we have an additional point for today's date (and since this
> also holds for all other bootstrapped curves)
mmm... I'm not so sure this is always the case. E.g. if you model the
YieldTermStructure as interpolated zero rates, the zero rate at time
t=0 is not unambiguously defined. For the time being the code defaults
to a given value, but this is not really needed and as a matter of
fact is often problematic, as it can break bootstrapping when using
global interpolation.

> I changed the check in
> IterativeBootstrap so that it requires a number of instruments equal to
> the number of required points minus one.

why don't we skip this early check altogether and adopt the lazy
approach of delegating the check to the interpolation class?

ciao -- Nando

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev