|
From: Luigi B. <lui...@gm...> - 2017-11-27 11:03:42
|
Hello Fabrice,
we had the same problem with other hierarchies, and we exported a few
utility functions to perform the casts. See for instance as_coupon and
similar in cashflows.i, or as_iborindex in indexes.i. You might export
something similar for curves.
Luigi
On Thu, Nov 23, 2017 at 11:38 AM Fabrice Lecuyer <
fab...@qu...> wrote:
> Hi all,
>
>
>
> I’ve run into an “inheritance issue” for which I’m uncertain of the way
> forward. Note that I’m using QuantLib in C# through SWIG.
>
>
>
> I’m building a set of yield curves (PiecewiseYieldCurve) of various
> flavors: some are inheriting InterpolatedDiscountCurve, some from
> InterpolatedZeroCurve, etc.
>
> In order to use those curves as exogenous discounting curves for other
> calibration instruments (SwapRateHelper for instance) and to be able to
> store them all in a single place, I store them in a Dictionary<string,
> YieldTermStructureHandle>.
>
> I also want to be able to display them using dates, not times, as the
> pillar points. While I can call discounts() on YieldTermStructureHandle,
> the dates() accessor is unavailable, because it is not defined in
> YieldTermStructure. It doesn’t seem that I can dereference the handle
> (I’m in C#) and downcast the YieldTermStructure to a PiecewiseYieldCurve that
> I could query for dates.
>
> Furthermore, in C++ the dates() accessor is never defined as a virtual
> function of a base class, despite being present in all the classes
> inheriting from InterpolatedCurve<Interpolator>. I realize this would not
> solve my issue, but maybe a DateInterpolatedCurve class, between
> InterpolatedCurve and say InterpolatedDiscountCurve, which would hold
> mutable std::vector<Date> dates_ and const std::vector<Date>& dates()
> const; would make sense.
>
>
>
> What’s the best way forward in order for me to be able to retrieve the
> pillar dates of those curves while retaining the capacity to store them all
> under one base class handle type regardless of their “flavor”?
>
>
>
> Regards,
>
> Fabrice Lecuyer
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|