# Interpolation for discount curve building QuantLib for bonds

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.

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())

• Yes, that is correct Sep 18 '20 at 8:13