|
From: jlee <jon...@gm...> - 2014-01-29 16:43:17
|
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] < ml-...@n7...> 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]<http://user/SendEmail.jtp?type=node&node=14919&i=0>> > 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] <http://user/SendEmail.jtp?type=node&node=14919&i=1> > > https://lists.sourceforge.net/lists/listinfo/quantlib-dev > > > > -- > <https://implementingquantlib.blogspot.com> > <https://twitter.com/lballabio> > > ------------------------------------------------------------------------------ > > 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] <http://user/SendEmail.jtp?type=node&node=14919&i=2> > 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<http://quantlib.10058.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=14918&code=am9uLmhvbm1pbmcubGVlQGdtYWlsLmNvbXwxNDkxOHwtNzA1MDY5Mzg2> > . > NAML<http://quantlib.10058.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://quantlib.10058.n7.nabble.com/PiecewiseYieldCurve-question-tp14918p14922.html Sent from the quantlib-dev mailing list archive at Nabble.com. |