Mode:
Duration:
1
2
3
4
5
6
7
8
start = ql.Date(1,12,2025)
maturity = ql.Date(1,12,2028)
nominals = [1000000]
strikes = [0.03]
cap = ql.Cap(ql.IborLeg([nominals],[ql.USDLibor(ql.Period(6,ql.Months))],[ql.Schedule(start,maturity,ql.Period(ql.Semiannual),ql.TARGET(),ql.Following,ql.Unadjusted,ql.DateGeneration.Forward,False)]), strikes)
engine = ql.BlackCapFloorEngine(yield_curve, volatility)
cap.setPricingEngine(engine)
npv = cap.NPV()Coding works best on desktop or with an external keyboard.