1
$\begingroup$

I'm trying to figure out how to build a discount curve to price bonds from spot rates using some advance interpolation methods like PiecewiseLogCubicDiscount. I know I can build this curve with BondHelpers if I have par bond yield, but what if I only have spot rates? The only example I've seen so far has liner interpolation on rates.

$\endgroup$
2
$\begingroup$

If you have the spot rates, you don't need helpers and you can build the curve directly with spot rates and dates. You have several interpolation possibilities that have the same required inputs: dates, yields, dayCounter. There are other optional parameters that have defaults.

Here are some example of the classes, where the names are hopefully self explanatory:

import QuantLib as ql
dates = [ql.Date(31,12,2019),  ql.Date(31,12,2020),  ql.Date(31,12,2021)]
zeros = [0.01, 0.02, 0.03]

ql.ZeroCurve(dates, zeros, ql.ActualActual())
ql.LogLinearZeroCurve(dates, zeros, ql.ActualActual())
ql.CubicZeroCurve(dates, zeros, ql.ActualActual())
ql.NaturalCubicZeroCurve(dates, zeros, ql.ActualActual())
ql.LogCubicZeroCurve(dates, zeros, ql.ActualActual())
ql.MonotonicCubicZeroCurve(dates, zeros, ql.ActualActual())
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.