2
$\begingroup$

I am not able to make quantlib match bloomber price, maybe I don't use the right parameters into ql.Schedule or ql.FixedRateBond

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)

Bond DES and YASQ enter image description here enter image description here

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.

$\endgroup$
4
  • 3
    $\begingroup$ Why are you passing issueDate to bond.cleanPrice, nstead of the valuation date? $\endgroup$ Commented Jun 2, 2023 at 17:09
  • $\begingroup$ @DimitriVulis it seems that it is one of my mistake indeed, but I might have done some other mistakes since I don't match BBG price. $\endgroup$
    – TourEiffel
    Commented Jun 5, 2023 at 7:32
  • $\begingroup$ @DimitriVulis I think one of my other mistake is compounding = ql.Compounded wich should be compounding = ql.SimpleThenCompounded do you have an idea why ? $\endgroup$
    – TourEiffel
    Commented Jun 5, 2023 at 8:04
  • $\begingroup$ Did you reconcile your bond's cashflows between Quantlib and Bloomberg CSHF? $\endgroup$ Commented Jun 8, 2023 at 12:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.