quantlib SWIG C# MonotonicLogCubicNaturalSpline

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

quantlib SWIG C# MonotonicLogCubicNaturalSpline

Moon Yan
Hi,
I am new to the SWIG thing. Basicly, I want to build a yield term structure through bootstrapping using MonotonicLogCubicNaturalSpline, however, I can't figure out how to using MonotonicLogCubicNaturalSpline in QuantLib SWIG c#, or other interpolation scheme in bootstrapping for that matter. How should the QlArray be built?  Thanks for any advise.
Reply | Threaded
Open this post in threaded view
|

Re: quantlib SWIG C# MonotonicLogCubicNaturalSpline

Luigi Ballabio
Hello,
    cubic interpolation of the yield term structure is not available
in the C# wrapper as released.  You'll have to modify
piecewiseyieldcurve.i and regenerate the wrappers to enable it.
First, create a traits class to specify the kind of cubic
interpolation you want: something like

%{
class MyCubic : public QuantLib::LogCubic {
    MyCubic() :
QuantLib::LogCubic(QuantLib::CubicInterpolation::Spline, true) {}
};
%}

should do the work. Then, add a line like

export_piecewise_curve(MyPiecewiseCubic,ZeroYield,MyCubic);

(replace Discount with ZeroYield or ForwardRate if that's what you
want to interpolate).
Then run SWIG on the updated wrappers (I think there's a .bat for this
that passes the correct parameters) and recompile.

Luigi


On Tue, Mar 6, 2012 at 5:06 PM, Moon Yan <[hidden email]> wrote:

>
> Hi,
> I am new to the SWIG thing. Basicly, I want to build a yield term structure
> through bootstrapping using MonotonicLogCubicNaturalSpline, however, I can't
> figure out how to using MonotonicLogCubicNaturalSpline in QuantLib SWIG c#,
> or other interpolation scheme in bootstrapping for that matter. How should
> the QlArray be built?  Thanks for any advise.
> --
> View this message in context: http://old.nabble.com/quantlib-SWIG-C--MonotonicLogCubicNaturalSpline-tp33451931p33451931.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users