I need help in understanding Quantlib's interpretation of yield curve and rates. The rate output retrieved from yield curve differs from expectation for non continuous cases.

Illustration: Let's start by defining the yield curve ..

tod = ql.Date(5,5,2022)
ardates = [tod,  tod+ql.Period(1,ql.Weeks),  tod+ql.Period(1,ql.Months),  tod+ql.Period(3,ql.Months),
           tod+ql.Period(6,ql.Months),tod+ql.Period(1,ql.Years),tod+ql.Period(2,ql.Years) ]
arzeros = [0.43902, 0.80713,1.0581, 1.19588,1.64246, 2.2557, 2.72901]

I can retrive the values from the yield curve as follows .. This is working as expected for ql.Continuous

print(arc1.zeroRate(0, ql.Continuous).rate())
print(arc1.zeroRate(1, ql.Continuous).rate())
print(arc1.zeroRate(2, ql.Continuous).rate())


But if I try to get yield curve using other compounding approaches, I get very different numbers.

print(arc1.zeroRate(0, ql.Compounded, ql.Annual).rate())
print(arc1.zeroRate(1, ql.Compounded, ql.Annual).rate())
print(arc1.zeroRate(2, ql.Compounded, ql.Annual).rate())

0.5541257006801319 vs. expectation of ~ 0.4419
8.38168766530322   vs. expectation of ~ 2.2639 (i.e. e^(1*2.2387%)  -1 )
14.101360454177165 vs. expectation of ~ 2.7519 (i.e. e^(2*2.7147%)^0.5 -1 )

Can you good folks help me understand why the results differ from my expectation. Is my expectation incorrect in the first place ?

Regards, Rohit

  • $\begingroup$ Related if not a Duplicate. $\endgroup$
    – Kurt G.
    Commented May 8, 2022 at 15:08

1 Answer 1


There was an error in the question itsef. The rates are consumed as decimals, so 2.72901 is regarded as 272.9% instead of 2.72901%, hence the difference in actual vs. expected behavior.


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