0
$\begingroup$

I cannot retrieve the same price for a fixed bond using quantlib.

faceValue = 100.
couponType = ql.Semiannual
issueDate = ql.Date(19, 4, 2019)
EvalDate = ql.Date(24, 5, 2019)
Maturity = ql.Date(19, 4, 2022)
quotedYield = 3.69
couponRate = 3.84
calendar = ql.NullCalendar()
settlementDays = 0
businessConventions = ql.Following
Datesgeneration = ql.DateGeneration.Forward
period= ql.Period(ql.Semiannual)
monthEnd = False

B1 = Bond(faceValue, couponType, EvalDate, issueDate, Maturity, quotedYield, couponRate, calendar)

ql.Settings.instance().evaluationDate = EvalDate

schedule = ql.Schedule(issueDate, Maturity, period, calendar, businessConventions, businessConventions, Datesgeneration, monthEnd)

bond = ql.FixedRateBond(settlementDays, faceValue, schedule, [couponRate/100.], ql.ActualActual(ql.ActualActual.ISMA))

print("QuantLib: ", bond.dirtyPrice(quotedYield/100., ql.ActualActual(ql.ActualActual.ISMA), ql.Simple, ql.Semiannual))

I should have got 100.774 when rounded to 3 decimals but i got 100.771. 100.774 is similar to Bloomberg pricer or excel using the classical discounted cashflow method to compute the price.

Can you help me?

Thanks Is there something wrong ?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.