I got to bootstrap the OIS and Libor 3M swap curves, and now I'd like to valuate some simple Libor3M - Fix IRS with QuantLib (in python). My problem is that some of the instruments I have to valuate have custom amortization structure. Are there any examples on how to valuate a swap with a custom amortization schedule?
1 Answer
To value a Swap with amortizations, you can feed a vector (list in python) with the notionals.
calendar = ql.TARGET()
start = ql.Date(17,6,2019)
maturity = calendar.advance(start, ql.Period('2y'))
fixedSchedule = ql.MakeSchedule(start, maturity, ql.Period('1Y'))
fixedLeg = ql.FixedRateLeg(fixedSchedule, ql.Actual360(), [100, 50], [0.01])
floatSchedule = ql.MakeSchedule(start, maturity, ql.Period('6M'))
floatLeg = ql.IborLeg([100, 100, 50, 50], floatSchedule, ql.Euribor6M(), ql.Actual360())
swap = ql.Swap(fixedLeg, floatLeg)
-
$\begingroup$ David, thanks for the example, its very clear. As I see, the dates schedule (fixed, starting, end and payment date) is created automatically. Is there a way to pass also a custom date schedule with the notional vector you mentioned? $\endgroup$ May 20, 2020 at 13:24
-
$\begingroup$ Sure, ql.Schedule([ql.Date(15,6,2020), ql.Date(15,12,2020), ql.Date(15,6,2021)]) $\endgroup$ May 21, 2020 at 8:34