Curve Building with Cubic Spline

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

Curve Building with Cubic Spline

suhasg
I have modified discountcurve.i SWIG interface to export CubicDiscountCurve, but I am not sure how to use it. We specifically need to use LogCubicNaturalSpline method for interpolation. Can you please give me an example in Python of how to use this interpolation method?
I have tried various combinations of following but none have worked.

logcubic = LogCubicNaturalSpline(LogCubicNaturalSpline.secondDerivative(LogCubicNaturalSpline(0,0)),
LogCubicNaturalSpline.secondDerivative(LogCubicNaturalSpline(0,0)),True)

forecastingCurve = CubicDiscountCurve(libordates,disfactors,Actual360(),calendar,logcubic)

Also, is there a general way to find out a previous fixing date for LIBOR curve? Our curves are stored in database and I extract settlement date curve points from the database. But when settlement date is between 2 fixing dates, I need to provide the previous fixing date and rate. What is the correct way to derive the last fixing date for different settlement dates?

Thank you.
Reply | Threaded
Open this post in threaded view
|

答复: Curve Building with Cubic Spline

cheng li
Hi suhasg,

1. The function name CubicDiscountCurve has already indicated that the
interpolation trais should be set as Cubic. You can’t mess
CubicDiscountCurve and LogCubicNaturalSpline together. If you really want to
use LogCubic NaturalSpline, you have to do below:

a. Add a line “export_discount_curve(LogCubic DiscountCurve, LogCubic);”
at the end of discountcurve.i
b. change the file interpolation.i accordingly to export LogCubic traits. Be
cafeful! you have to do more than other traits since you have to export the
constructor of LogCubic. The reason is that currently the default choice of
LogCubic traits is MonotonicLogCubicNatural not LogCubicNatural.

2. This problem is simpler than the first one. Historical fixing can be
handled by Index method addFixing. You can add specific value on a specific
date as historical fixing for that index.

Regards,
Cheng

-----邮件原件-----
发件人: suhasg [mailto:[hidden email]]
发送时间: 2014年8月14日 0:16
收件人: [hidden email]
主题: [Quantlib-users] Curve Building with Cubic Spline

I have modified discountcurve.i SWIG interface to export CubicDiscountCurve,
but I am not sure how to use it. We specifically need to use
LogCubicNaturalSpline method for interpolation. Can you please give me an
example in Python of how to use this interpolation method?
I have tried various combinations of following but none have worked.

logcubic =
LogCubicNaturalSpline(LogCubicNaturalSpline.secondDerivative(LogCubicNatural
Spline(0,0)),
LogCubicNaturalSpline.secondDerivative(LogCubicNaturalSpline(0,0)),True)

forecastingCurve =
CubicDiscountCurve(libordates,disfactors,Actual360(),calendar,logcubic)

Also, is there a general way to find out a previous fixing date for LIBOR
curve? Our curves are stored in database and I extract settlement date curve
points from the database. But when settlement date is between 2 fixing
dates, I need to provide the previous fixing date and rate. What is the
correct way to derive the last fixing date for different settlement dates?

Thank you.



--
View this message in context:
http://quantlib.10058.n7.nabble.com/Curve-Building-with-Cubic-Spline-tp15756
.html
Sent from the quantlib-users mailing list archive at Nabble.com.

----------------------------------------------------------------------------
--
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users