0
$\begingroup$
import QuantLib as ql

ql.Settings.instance().evaluationDate = ql.Date(2,3,2020)
maturity = ql.Date(10, 5, 2023)
coupon = 0.09
issueDate = ql.Date(30, 12, 2019)
frequency = ql.Semiannual
dayCount = ql.Thirty360()
price = 104.5
bond = ql.FixedRateBond(2, ql.TARGET(), 100.0, issueDate, maturity, ql.Period(frequency), [coupon], dayCount)
yld = bond.bondYield(price, dayCount, ql.Compounded,frequency)
print(yld)


cleanPrice = bond.cleanPrice(yld, dayCount, ql.Compounded, frequency)
print(cleanPrice)

dirtyPrice = bond.dirtyPrice(yld, dayCount, ql.Compounded, frequency)
print(dirtyPrice)

accrued = (dirtyPrice - cleanPrice)
print(accrued)
$\endgroup$
  • $\begingroup$ One cannot properly compute call option value (and hence correctly estimate yield) without some kind of calibrated stochastic model of interest rates. If you want a simple one, QuantLib provides Black-Karasinski. I have no idea if the implementation is any good. $\endgroup$ – Brian B Jul 6 at 14:00
1
$\begingroup$

You get yield to maturity (YTM) - the yield assuming the calls are not exercised even if they are in the money.

According to the master himself http://quantlib.10058.n7.nabble.com/Yield-to-call-for-callable-bonds-td17004.html

there's no straighforward way. One workaround would be to instantiate a second bond with maturity equal to the callability date of the first, and calculate the yield on that one.

There does not seem to be a straighforward way to have yields that e.g. Bloomberg Terminal YA screen provides - yield to worst, yield to next call, etc.

| improve this answer | |
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.