|
From: Chris K. <chr...@ya...> - 2011-01-16 20:21:06
|
Hi Leon, I've added an inflation-lined bond into the QL trunk, as CPIbond in ql/instruments/bonds/cpibond.cpp. If you look at the new test inflationcpiswap.cpp you'll see how it works - all comments/suggestions welcome. I've also added some other CPI-linked functionality e.g. CPI-swaps and a CPICapFloor Instrument (test is in inflationcpicapfloor.cpp). Regards, Chris On Thu, 2011-01-06 at 15:00 -0600, Leon Sit wrote: >> I am trying to implement Inflation Linked Gilt. Is there a general >> advice on what part of quantlib I can reuse? I think I can probably >> reuse InflationTermStructurem, InflationIndex, and Bond. Any >> implementation advice? >You'll probably want to inherit a class from Coupon >>that takes an >InflationIndex and uses it to implement its rate() and >>accruedAmount() >methods (possibly a ZeroInflationIndex. I find it easier to >>cope with; >the YoYInflationIndex is a bit more quirky about retrieving >>fixings.) >Once you have the coupon, you can inherit a class from Bond. The >>>constructor will assemble the correct cash flows. If you're lucky, that >would >>be all; if instead your bond price must be rescaled by some >inflation factor, >>you'll have to put that calculation somewhere. You >might override >>performCalculation to do the rescaling after calling the >base-class >>implementation. >Luigi |