I am not able to make quantlib match bloomber price, maybe I don't use the right parameters into
I have a price of : 90.012 instead of 93.508 [Huge spread between my result and bloomberg]
Below is the reproducible example :
import QuantLib as ql todaysDate= ql.Date(2,6,2023) ql.Settings.instance().setEvaluationDate(todaysDate) # Market conventions calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond) settlementDays = 2 faceValue = 100 compounding = ql.Compounded compoundingFrequency = ql.Semiannual # Bond schedule setup issueDate = ql.Date(15, 5, 2019) maturityDate = ql.Date(15, 5, 2029) tenor = ql.Period(ql.Semiannual) schedule = ql.Schedule(issueDate, maturityDate, tenor, calendar, ql.Unadjusted, ql.Unadjusted, ql.DateGeneration.Backward, False) # Bond parameters rate = 3.5/100 dayCount = ql.Thirty360(ql.Thirty360.BondBasis) bond = ql.FixedRateBond(settlementDays, faceValue, schedule, [rate], dayCount) # YTM calculation yieldRate = 4.767131/100 # YTM yieldDayCount = ql.Thirty360(ql.Thirty360.BondBasis) yieldCompoundingFrequency = ql.Semiannual cleanPrice = bond.cleanPrice(yieldRate, yieldDayCount, compounding, yieldCompoundingFrequency, issueDate) print("The clean price of the bond is: ", cleanPrice)
Can someone help me to understand what I am doing wrong ?
Side Note :
I have seen this answer but it seems that my issue is something else.