>From: Luigi Ballabio <
[hidden email]>
>To: Allen Kuo <
[hidden email]>
>CC:
[hidden email]
>Subject: Re: [Quantlib-dev] callable bonds
>Date: Thu, 03 Aug 2006 11:48:12 +0200
>
>
>On 08/01/2006 09:03:20 AM, Allen Kuo wrote:
> > I'm trying to build a callable bond class and was wondering what a
> > QL preferred design would be. Two possibilities are below. I liked
> > the economy of the first method but the ConvertibleBond class is
> > designed the second way, so was not sure how to proceed.
> >
> > (1)
> > class CallableBond : public Bond {
> > public:
> > CallableBond(const boost::shared_ptr<Bond> bond&
> > const boost::shared_ptr<PricingEngine>& engine,
> > const CallabilitySchedule& callability,
> > );
> > etc.
> > }
>
>I like this one, but the problem is that the engine should know what
>kind of bond it's being passed---or at least what kind of coupons it
>contains. I.e., if you choose a tree engine, fixed-rate and
>floating-rate coupons will be discounted in a different way on the
>tree. Therefore, the above mightn't be as generic as it seems.
>
>
> > (2)
> > Analogous to the ConvertibleBond class, we would have three
> > explicit constructors for each of three types of bonds (
> > CallableZeroCouponBond , CallableFloatingRateBond ,
> > CallableFixedCouponBond ).
>
>This might be less nice, but it has the advantage of specifying the
>kind of bond to be called. I would go for this one first; after the
>code is done, we might try some refactoring to bring it closer to the
>first design.
>
>
> > Doing it this way, in the future though, we
> > might need three more constructors for convertible bonds:
>
>No, convertible bonds manage callability already. (By the way, you can
>look at the relevant classes---Callability and such---so that you can
>reuse them.)
>
>Later,
> Luigi
>
>
>----------------------------------------
>
>Cogito ergo I'm right and you're wrong.
>-- Blair Houghton
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share
>your
>opinions on IT & business topics through brief surveys -- and earn cash
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV>_______________________________________________
>QuantLib-dev mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-dev