I'd like to check how QuantLib does interpolation on rates if I use ZeroCurve constructor. As it was mentioned here, by using curve.nodes()
you can get a list of rates, used for interpolation.
So, if I build a curve with spot rates with the following code
import QuantLib as ql
todays_date = ql.Date(12, 3, 2020)
spot_dates = [todays_date + ql.Period(i, ql.Years) for i in [0, 1, 2, 3, 4, 5]]
spot_rates = [0.01, 0.02, 0.03, 0.04, 0.05, 0.06]
spot_curve = ql.ZeroCurve(
spot_dates, spot_rates,
ql.SimpleDayCounter(),
ql.NullCalendar(),
ql.Linear(),
ql.Compounded,
ql.Annual
)
I got back
spot_curve.nodes()
((Date(12,3,2020), 0.009950330853148023),
(Date(12,3,2021), 0.01980262729617973),
(Date(12,3,2022), 0.02955880224154438),
(Date(12,3,2023), 0.03922071315328132),
(Date(12,3,2024), 0.04879016416943205),
(Date(12,3,2025), 0.05826890812397582))
I've realized that the issue is the compounding. By indicating that input rates are Continuously compounded, nodes()
matches with the input.
spot_curve = ql.ZeroCurve(
spot_dates, spot_rates,
ql.SimpleDayCounter(),
ql.NullCalendar(),
ql.Linear(), ql.Continuous, ql.Annual
)
spot_curve.nodes()
((Date(12,3,2020), 0.01),
(Date(12,3,2021), 0.02),
(Date(12,3,2022), 0.03),
(Date(12,3,2023), 0.04),
(Date(12,3,2024), 0.05),
(Date(12,3,2025), 0.06))
Based on that discovery, the question is: Does QuantLib always interpolates in continues rates (with zero rates constructor)? Is this a convention?