From: Luigi B. <lui...@gm...> - 2010-12-24 09:53:54
|
On Tue, 2010-12-14 at 15:20 +0100, Martino Fornasa wrote: > I'm trying to build a function to calculate the net yield (after taxes) > of a fixed rate bond. In order to do that, I need to differentiate > between coupon-cashflows and, for example, redemption cashflows. > > With a plain-vanilla fixed-rate bond I can assume that only the last > cashflow is a redemption. > In the general case what is my best option? Till now the better option I > can think is to intersect the cashflow vector with the redemption > vector. Any ideas? Yes, it's either that or switching on the type of each cashflow (you can try casting to Coupon, or use a visitor; <ql/cashflows/cashflows.cpp> has examples of both approaches.) Luigi -- Vin: It's like this fellow I knew in El Paso. One day, he just took all his clothes off and jumped in a mess of cactus. I asked him that same question, "Why?" Calvera: And? Vin: He said, "It seemed like a good idea at the time." -- The Magnificent Seven |