bondhelpers.cpp bug

View: New views
2 Messages — Rating Filter:   Alert me  

bondhelpers.cpp bug

by Simon Ibbotson - Straumur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hi folks,

 

The constructor for the FixedRateBondHelper class that takes a bond as a parameter doesn’t instantiate member variable ::bond_ before use.

Either the input bond should be used (if it is assumed that the bond will not be used elsewhere) or a copy of the bond should be created for specific use with the yieldtermstructure.

Currently, neither solution is perfect:

a)       If a copy of the bond is created, then for a derived class (from FixedRateBond) to work, we’d also require a FixedRateBond::clone() method.

b)       If we use the input bond, there’s no guarantee that the bond is not used elsewhere with a different yieldcurve which would lead to uncertain results.

 

Regards,

 

Simon

 

 

Simon Ibbotson

Quantitative Analytics

Capital Markets

Straumur

 


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@...
https://lists.sourceforge.net/lists/listinfo/quantlib-dev

Re: bondhelpers.cpp bug

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2008-03-31 at 10:40 +0000, Simon Ibbotson wrote:
> The constructor for the FixedRateBondHelper class that takes a bond as
> a parameter doesn’t instantiate member variable ::bond_ before use.

True--I've fixed that. Thanks for the report.


> b)       If we use the input bond, there’s no guarantee that the bond
> is not used elsewhere with a different yieldcurve which would lead to
> uncertain results.

True, but as you wrote it's tricky to make it safe. For the time being,
I've added a warning to the documentation pointing out the problem.

Luigi


--

When all else fails, pour a pint of Guinness in the gas tank,
advance the spark 20 degrees, cry "God Save the Queen!", and pull
the starter knob.
-- MG "Series MGA" Workshop Manual



-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/quantlib-dev