Re: RE: it's been a while
Posted by Luigi Ballabio-4 on Jan 28, 2002; 5:42am
URL: http://quantlib.414.s1.nabble.com/RE-it-s-been-a-while-tp1852p1854.html
At 09:22 AM 1/28/02 +0000, Ben wrote:
>I would definetly be interested in starting work on a bond class.....
>Especially if someone would be interested in vetting my work as i go
>along!! I know quite a bit about bonds (www.benwootton.co.uk is my site)
>and have been coding in c++ for 4 or 5 years - im going to post some of my
>programs on my site later this week....
>
>Would you want it to work similiar to the option class - ie a seperate
>pricing engine?
I would make the base Bond class similar to QuantLib::Instruments::Swap,
only with just one leg. Also, you should take care of the fact that bonds
usually have a different number of settlement days than deposits and swaps
(and therefore the term structure bootstrapped on them) so that discount
factors should be corrected accordingly.
Once the base class is done, most concrete bonds are to it what SimpleSwap
is to Swap---just derived classes which take care of building their coupons
and delegate the discounting to the base class.
Also, I would implement IRR, duration and such not as Bond methods, but
rather as functions on generic Coupon sequences, as in:
template <class Iter>
Rate IRR(const Iter& begin, const Iter& end);
Well, I guess I said too much already <wink>
Bye,
Luigi