Class BachelierCapFloorEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The Bachelier-Black-formula cap/floor engine: normal volatilities.
public static class BachelierCapFloorEngine
- Inheritance
-
BachelierCapFloorEngine
- Inherited Members
Remarks
A static class: Calculate runs QuantLib's four steps (playbook §2.1) and returns the instrument's results,
with BlackCapFloorEngine's additional results under the same keys, from the Bachelier formulas, which
take no displacement and accept negative strikes and forwards. A collar's results hold no optionletsStdDev,
as QuantLib's don't, and a caplet the engine prices whose coupon is paid before the evaluation date has no
forward, refused where QuantLib prices on its Null<Rate>() sentinel, a documented divergence.
QuantLib's constructors on a volatility value and on a quote coincide once a quote is a double: the overload on a double builds, at each call, the constant volatility QuantLib's builds, on no calendar, with its reference date the context's evaluation date and QuantLib's default type, shifted lognormal, which the engine reads as a normal volatility. Its day counter defaults to QuantLib's, Actual365Fixed, for null.
Methods
Calculate(CapFloor, EvaluationContext, YieldTermStructure, OptionletVolatilityStructure)
Prices a cap, floor or collar on an optionlet volatility structure.
public static InstrumentResults Calculate(CapFloor capFloor, EvaluationContext context, YieldTermStructure discountCurve, OptionletVolatilityStructure vol)
Parameters
capFloorCapFloorThe instrument.
contextEvaluationContextThe evaluation context.
discountCurveYieldTermStructureThe discount curve.
volOptionletVolatilityStructureThe volatility structure, normal.
Returns
- InstrumentResults
The results: the expired results when the instrument has expired.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentException
The structure's volatilities aren't normal, or a Bachelier formula refuses its inputs.
- NanoQLException
A cash flow isn't a floating-rate coupon, a forward can't be computed, a priced caplet has no forward, or the structure refuses a fixing date or a strike.
Calculate(CapFloor, EvaluationContext, YieldTermStructure, double, DayCounter?)
Prices a cap, floor or collar on a constant normal volatility.
public static InstrumentResults Calculate(CapFloor capFloor, EvaluationContext context, YieldTermStructure discountCurve, double vol, DayCounter? dc = null)
Parameters
capFloorCapFloorThe instrument.
contextEvaluationContextThe evaluation context.
discountCurveYieldTermStructureThe discount curve.
voldoubleThe normal volatility.
dcDayCounterThe volatility's day counter; Actual365Fixed, QuantLib's default, when null.
Returns
- InstrumentResults
The results: the expired results when the instrument has expired.
Exceptions
- ArgumentNullException
The instrument, the context or the discount curve is null.
- ArgumentException
A Bachelier formula refuses its inputs.
- NanoQLException
A cash flow isn't a floating-rate coupon, a forward can't be computed, or a priced caplet has no forward.