1

I am new to QuantLib, and I am trying to price a credit-sensitive amortizing floating-rate bond. The final payment for the bond may be less than par.

If I price a non-amortizing floating-rate bond, I can use the class FloatingRateBond and the parameter redemption=x to model the final payment. When I try to using that parameter for an AmortizingFloatingRateBond, it appears to be unavailable. I do not know whether that is the appropriate class to use in this case (i.e., a floating-rate bond with arbitrary timing of principal payments and a possible non-par redemption).

Here is a code sample that works for a par redemption, which I based on the QuantLib cookbook, any suggestions what to use for a non-par redemption?

from QuantLib import *
today = Date(1, October, 2020)
Settings.instance().evaluationDate = today
forecast_curve = RelinkableYieldTermStructureHandle()
discount_curve = RelinkableYieldTermStructureHandle()
index = USDLibor(Period('3M'), forecast_curve)
issueDate = Date(13, October, 2020)
maturityDate = Date(13, October, 2022)
schedule = Schedule(issueDate, maturityDate, Period(Quarterly), UnitedStates(), Following, Following, DateGeneration.Backward, False)
bond = AmortizingFloatingRateBond(settlementDays=3, 
                                  notional=[100,90,80], 
                                  schedule=schedule, 
                                  index=index, 
                                  accrualDayCounter=Actual360(),
                                  spreads=[0.0])
bond.setPricingEngine(DiscountingBondEngine(discount_curve))
forecast_curve.linkTo(FlatForward(0, UnitedStates(), 0.002, Actual360()))
DM = SimpleQuote(0.0)
discount_curve.linkTo(ZeroSpreadedTermStructure(forecast_curve, QuoteHandle(DM)))

print('price',bond.cleanPrice(),'\n')

for i, cf in enumerate(bond.cashflows()):
    print((i + 1), cf.date(), cf.amount())
chwarr
  • 6,777
  • 1
  • 30
  • 57

0 Answers0