Re: [Quantlib-dev] seasonality for inflation term structures

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Re-Quantlib-dev-seasonality-for-inflation-term-structures-tp5950.html

On Tue, 2008-04-29 at 01:50 -0700, Chris Kenyon wrote:

> We want to give users with the ability to provide a seasonality
> correction to the term structures.
>
> The get/set is defined in the base InflationTermStructure class as:
>
> public:
>     void setSeasonality(const boost::shared_ptr<Seasonality>
> &seasonality = boost::shared_ptr<Seasonality>());
>     boost::shared_ptr<Seasonality> seasonality() const;        
>     bool hasSeasonalityCorrection() const;

I'm not sure that I like the setter. Of course observability can be
implemented correctly, but I'd prefer curves to be immutables. What I'm
worried about is the following scenario:

Handle<InflationTermStructure> ts;

InflationInstrument I1(..., ts);
InflationInstrument I2(..., ts);

I1.someResult(...);  // for some reason, calls setSeasonality()

at which point the value of I2 changes. We had such a bug in the past
when calculating the implied volatility of an option would modify the
underlying equity process for other instruments. It wasn't pretty.

My proposal of adding seasonality by wrapping the curve was so that I1
could (if needed) take the passed term structure, wrap it, and use the
wrapped curve without modifying the original one.

Thoughts?

Later,
        Luigi


--

All parts should go together without forcing. You must remember that
the parts you are reassembling were disassembled by you. Therefore, if
you can't get them together again, there must be a reason. By all
means, do not use a hammer.
-- IBM maintenance manual, 1925



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users