Login  Register

Re: PiecewiseYieldCurve question

Posted by jlee on Jan 29, 2014; 4:42pm
URL: http://quantlib.414.s1.nabble.com/PiecewiseYieldCurve-question-tp14918p14922.html

Thanks for the quick reply. Let me give this a way and see. Thanks for your help!


On 29 January 2014 15:57, Luigi Ballabio [via QuantLib] <[hidden email]> wrote:
Hello,
    template arguments have to be specified at compile time, so I'm
afraid there's no way except a big

    if (traits == "Discount" && interpolation == "Linear")
        return make_shared<PiecewiseYieldCurve<Discount,Linear> >(...);
    else if (traits == "Discount" && interpolation == "LogLinear")
        return make_shared<PiecewiseYieldCurve<Discount,LogLinear> >(...);

To minimize inconvenience, I'd put the above inside a function so that
I'd only write it once. Then in client code I'd just write

    shared_ptr<YieldTermStructure> curve = make_piecewise(traits,
interpolation, helpers, ...);

Luigi


On Wed, Jan 29, 2014 at 2:49 PM, jlee <[hidden email]> wrote:

> Hi all,
> Pretty new to QuantLib and have been playing with the Example sources. I
> have a question regarding the PiecewiseYieldCurve object. If I want to make
> the first two parameters (traitid and interpolatorid) an input variable how
> can I do this? Specifically, I'm looking at the swapvaluation.cpp example
> where it is using "Discount" and "LogLinear". I want to make it a user input
> so the interpolation method can be changed. Sorry it's probably more of a
> C++ question as I'm a bit weak on templates.
>
> Thank you,
> Jon
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/PiecewiseYieldCurve-question-tp14918.html
> Sent from the quantlib-dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> WatchGuard Dimension instantly turns raw network data into actionable
> security intelligence. It gives you real-time visual feedback on key
> security issues and trends.  Skip the complicated setup - simply import
> a virtual appliance and go from zero to informed in seconds.
> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev



If you reply to this email, your message will be added to the discussion below:
http://quantlib.10058.n7.nabble.com/PiecewiseYieldCurve-question-tp14918p14919.html
To unsubscribe from PiecewiseYieldCurve question, click here.
NAML