I was experimenting on a FixedRateBond on QuantLib python port and have a question on the use of Compounded vs. CompoundedThenSimple methods of discounting.
I am using the FixedRateBond.dirtyPrice() method to get the dirty price. But it looks like both Compounded and CompoundedThenSimple methods provide the exact same answers when the settlement date is in the first period (In my example, start date = 15-Aug-20, end date = 15-Aug-22, settlement date = 20-Aug-20). Similarly Simple and SimpleThenCompound methods provide the exact same answer.
Isn't the CompoundedThenSimple model supposed to compound until the first coupon date and then do a simple discounting till the settlement date?
My code is as follows:
issuedate = ql.Date(15,8,2020)
maturitydate = ql.Date(15,8,2022)
settledate = ql.Date(20,8,2020)
coupon = 0.04
period = ql.Period('6M')
daycount = ql.ActualActual()
dcadjustment = ql.Unadjusted
calendar = ql.NullCalendar()
eomrule = False
dategenmethod = ql.DateGeneration.Forward
settledelay = 0
facevalue = 100
yld = 0.045
couponvector = [coupon]
bsched = ql.Schedule(issuedate,maturitydate,period,calendar,dcadjustment,dcadjustment,dategenmethod,eomrule)
frb = ql.FixedRateBond(settledelay,facevalue,bsched,couponvector,daycount)
print('===== Compounded =====')
print(frb.dirtyPrice(yld,daycount,ql.Compounded,ql.Semiannual,settledate))
print(frb.cleanPrice(yld,daycount,ql.Compounded,ql.Semiannual,settledate))
print('===== Compounded Then Simple =====')
print(frb.dirtyPrice(yld,daycount,ql.CompoundedThenSimple,ql.Semiannual,settledate))
print(frb.cleanPrice(yld,daycount,ql.CompoundedThenSimple,ql.Semiannual,settledate))
print('===== Simple Then Compounded =====')
print(frb.dirtyPrice(yld,daycount,ql.SimpleThenCompounded,ql.Semiannual,settledate))
print(frb.cleanPrice(yld,daycount,ql.SimpleThenCompounded,ql.Semiannual,settledate))
print('===== Simple =====')
print(frb.dirtyPrice(yld,daycount,ql.Simple,ql.Semiannual,settledate))
print(frb.cleanPrice(yld,daycount,ql.Simple,ql.Semiannual,settledate))