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())
0.4409131371427133
2.2387596685082873
2.714784836065574
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