14 May 00:24
Re: CDS example
From: <japari <at> free.fr>
Subject: Re: CDS example
Newsgroups: gmane.comp.finance.quantlib.devel
Date: 2008-05-13 22:24:12 GMT
Subject: Re: CDS example
Newsgroups: gmane.comp.finance.quantlib.devel
Date: 2008-05-13 22:24:12 GMT
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 itTrue, 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 <luca.billi <at> gmail.com>: > 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 > QuantLib-dev <at> lists.sourceforge.net > 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/
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 <luca.billi <at> gmail.com>:
> 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.
>
RSS Feed