Cap Pricing Engines
BlackCapFloorEngine
- ql.BlackCapFloorEngine(yieldTermStructure, quoteHandle)
vols = ql.QuoteHandle(ql.SimpleQuote(0.547295))
engine = ql.BlackCapFloorEngine(yts, vols)
cap.setPricingEngine(engine)
- ql.BlackCapFloorEngine(yieldTermStructure, OptionletVolatilityStructure)
BachelierCapFloorEngine
- ql.BachelierCapFloorEngine(yieldTermStructure, quoteHandle)
vols = ql.QuoteHandle(ql.SimpleQuote(0.00547295))
engine = ql.BachelierCapFloorEngine(yts, vols)
- ql.BachelierCapFloorEngine(yieldTermStructure, OptionletVolatilityStructure)
AnalyticCapFloorEngine
- ql.AnalyticCapFloorEngine(OneFactorAffineModel, YieldTermStructure)
- ql.AnalyticCapFloorEngine(OneFactorAffineModel)
OneFactorAffineModel
HullWhite : (termStructure, a=0.1, sigma=0.01)
Vasicek : (r0=0.05, a=0.1, b=0.05, sigma=0.01, lambda=0.0)
CoxIngersollRoss [NOT IMPLEMENTED]
GeneralizedHullWhite [NOT IMPLEMENTED]
yts = ql.YieldTermStructureHandle(ql.FlatForward(ql.Date().todaysDate(), 0.0121, ql.Actual360()))
models = [
ql.HullWhite (yts),
ql.Vasicek(r0=0.008),
]
for model in models:
analyticEngine = ql.AnalyticCapFloorEngine(model, yts)
cap.setPricingEngine(analyticEngine)
print(f"Cap npv is: {cap.NPV():,.2f}")
TreeCapFloorEngine
- ql.TreeCapFloorEngine(ShortRateModel, Size, YieldTermStructure)
- ql.TreeCapFloorEngine(ShortRateModel, Size)
- ql.TreeCapFloorEngine(ShortRateModel, Size, TimeGrid, YieldTermStructure)
- ql.TreeCapFloorEngine(ShortRateModel, Size, TimeGrid)
Models
HullWhite : (YieldTermStructure, a=0.1, sigma=0.01)
BlackKarasinski : (YieldTermStructure, a=0.1, sigma=0.1)
Vasicek : (r0=0.05, a=0.1, b=0.05, sigma=0.01, lambda=0.0)
G2 : (termStructure, a=0.1, sigma=0.01, b=0.1, eta=0.01, rho=-0.75)
GeneralizedHullWhite [NOT IMPLEMENTED]
CoxIngersollRoss [NOT IMPLEMENTED]
ExtendedCoxIngersollRoss [NOT IMPLEMENTED]
models = [
ql.HullWhite (yts),
ql.BlackKarasinski(yts),
ql.Vasicek(0.0065560),
ql.G2(yts)
]
for model in models:
treeEngine = ql.TreeCapFloorEngine(model, 60, yts)
cap.setPricingEngine(treeEngine)
print(f"Cap npv is: {cap.NPV():,.2f}")