I think I have the same question as was asked here but I still haven't been able to resolve my issue:
Excel YIELD function equivalent in python Quantlib
I am trying to calculate the yield on a bond and match it to the results I am getting in Excel/MatLab.
In Excel and MatLab I can get the same results but I need to implement in Python. (0.75358%)
=YIELD("16/03/2020","21/11/2029",0.0275,118.607,100,2,3)
=YIELD(settlement,maturity,rate,pr,redemption,frequency,basis)
So I know I need to create a ql.FixedRateBond and then use the bondYield function.
I think frequency above is matched by ql.Seminannual and basis is my dayCount convention of ql.Actual365Fixed().
But I must be going wrong with some of the additional Python parameters because my Python answer is wayyy off.
Can someone help me with where I might be going wrong in my Python specification below?
settlement= ql.Date(16,3,2020)
maturity= ql.Date(21,11,2029)
bond = ql.FixedRateBond(0, ql.TARGET(), 100, start, maturity, ql.Period('6M'), [0.0275], ql.Actual365Fixed())
bond.bondYield(118.6070, ql.Actual365Fixed(), ql.Compounded, ql.Semiannual)
(Python results 0.6284% btw)