Amortizing Fixed Rate Bond

import QuantLib as ql # 1. Set Evaluation Date today = ql.Date(8, ql.February, 2023) ql.Settings.instance().evaluationDate = today # 2. Define the Schedule (e.g., 5-Year Semiannual bond) effective_date = ql.Date(8, ql.February, 2023) termination_date = ql.Date(8, ql.February, 2028) tenor = ql.Period(6, ql.Months) calendar = ql.TARGET() schedule = ql.Schedule(effective_date, termination_date, tenor, calendar, ql.Following, ql.Following, ql.DateGeneration.Backward, False) # 3. Define Notionals & Coupons (e.g., amortizing from 10,000 down to 2,000) notionals = [10000.0, 10000.0, 8000.0, 8000.0, 6000.0, 6000.0, 4000.0, 4000.0, 2000.0, 2000.0] coupons = [0.03] # 3% annual coupon rate (paid semiannually) day_counter = ql.Thirty360(ql.Thirty360.BondBasis) settlement_days = 3 # 4. Create the Amortizing Bond bond = ql.AmortizingFixedRateBond(settlement_days, notionals, schedule, coupons, day_counter)