Class BlackIborCouponPricer
The Black-formula pricer for Ibor coupons, capped, floored or not.
public class BlackIborCouponPricer : IborCouponPricer
- Inheritance
-
BlackIborCouponPricer
- Derived
- Inherited Members
Remarks
A fixing on or before the evaluation date gives the caplet and floorlet their intrinsic values; a later one is priced with Black's formula on a shifted lognormal volatility, or Bachelier's on a normal one. On a shifted lognormal volatility a strike at or below −shift, on an adjusted fixing above −shift, which QuantLib's Black formula refuses, prices a caplet at the adjusted fixing less the strike and a floorlet at 0, the formula's limits there (QuantLib's check, its Black formula at −shift + 1e-12), so a capped coupon struck there pays its cap and a digital coupon struck at 0 on an unshifted volatility replicates to probability 1. The timing adjustment corrects the fixing of an in-arrears coupon (Black76), or of any coupon not paid at the index's maturity (BivariateLognormal, with the correlation given).
Unsealed, as in QuantLib, whose subclasses override AdjustedFixing(IborCoupon, EvaluationContext, double?). Every member computes the coupon's values inside the call (see IborCouponPricer).
Constructors
BlackIborCouponPricer(EvaluationContext, OptionletVolatilityStructure?, BlackIborCouponPricerTimingAdjustment, double)
Initializes a new instance of the BlackIborCouponPricer class with the context's at-par switch: QuantLib's constructor without an explicit choice.
public BlackIborCouponPricer(EvaluationContext context, OptionletVolatilityStructure? v = null, BlackIborCouponPricerTimingAdjustment timingAdjustment = BlackIborCouponPricerTimingAdjustment.Black76, double correlation = 1)
Parameters
contextEvaluationContextThe evaluation context, whose UseAtParCoupons is read once.
vOptionletVolatilityStructureThe caplet volatility, or null, QuantLib's empty handle.
timingAdjustmentBlackIborCouponPricerTimingAdjustmentThe timing adjustment.
correlationdoubleThe correlation the bivariate lognormal adjustment uses.
Exceptions
- ArgumentOutOfRangeException
timingAdjustmentisn't a member of its type.
BlackIborCouponPricer(OptionletVolatilityStructure?, BlackIborCouponPricerTimingAdjustment, double, bool)
Initializes a new instance of the BlackIborCouponPricer class with an explicit choice.
public BlackIborCouponPricer(OptionletVolatilityStructure? v, BlackIborCouponPricerTimingAdjustment timingAdjustment, double correlation, bool useIndexedCoupon)
Parameters
vOptionletVolatilityStructureThe caplet volatility, or null, QuantLib's empty handle.
timingAdjustmentBlackIborCouponPricerTimingAdjustmentThe timing adjustment.
correlationdoubleThe correlation the bivariate lognormal adjustment uses.
useIndexedCouponboolWhether the pricer prices indexed coupons, rather than at-par ones.
Exceptions
- ArgumentOutOfRangeException
timingAdjustmentisn't a member of its type.
Methods
AdjustedFixing(IborCoupon, EvaluationContext, double?)
The fixing with the timing adjustment applied: unchanged for a coupon in advance under Black76, for a coupon paid at the index's maturity, and before the volatility's reference date; otherwise adjusted for the variance accumulated to the fixing date.
protected virtual double AdjustedFixing(IborCoupon coupon, EvaluationContext context, double? fixing = null)
Parameters
couponIborCouponThe coupon.
contextEvaluationContextThe evaluation context.
fixingdouble?The fixing to adjust; the coupon's index fixing, with the pricer's at-par choice, when null.
Returns
- double
The adjusted fixing.
Exceptions
- NanoQLException
The adjustment needs a volatility or a forecasting curve that isn't given.
CapletPrice(FloatingRateCoupon, double, EvaluationContext)
The price of a caplet on the coupon's rate.
public override double CapletPrice(FloatingRateCoupon coupon, double effectiveCap, EvaluationContext context)
Parameters
couponFloatingRateCouponThe coupon.
effectiveCapdoubleThe cap on the index fixing.
contextEvaluationContextThe evaluation context.
Returns
- double
The price.
Exceptions
- ArgumentException
The coupon isn't an Ibor coupon.
- NanoQLException
The index has no forecasting curve, or the caplet can't be priced.
CapletRate(FloatingRateCoupon, double, EvaluationContext)
The rate of a caplet on the coupon's rate.
public override double CapletRate(FloatingRateCoupon coupon, double effectiveCap, EvaluationContext context)
Parameters
couponFloatingRateCouponThe coupon.
effectiveCapdoubleThe cap on the index fixing.
contextEvaluationContextThe evaluation context.
Returns
- double
The rate.
Exceptions
- ArgumentException
The coupon isn't an Ibor coupon.
- NanoQLException
The caplet can't be priced.
FloorletPrice(FloatingRateCoupon, double, EvaluationContext)
The price of a floorlet on the coupon's rate.
public override double FloorletPrice(FloatingRateCoupon coupon, double effectiveFloor, EvaluationContext context)
Parameters
couponFloatingRateCouponThe coupon.
effectiveFloordoubleThe floor on the index fixing.
contextEvaluationContextThe evaluation context.
Returns
- double
The price.
Exceptions
- ArgumentException
The coupon isn't an Ibor coupon.
- NanoQLException
The index has no forecasting curve, or the floorlet can't be priced.
FloorletRate(FloatingRateCoupon, double, EvaluationContext)
The rate of a floorlet on the coupon's rate.
public override double FloorletRate(FloatingRateCoupon coupon, double effectiveFloor, EvaluationContext context)
Parameters
couponFloatingRateCouponThe coupon.
effectiveFloordoubleThe floor on the index fixing.
contextEvaluationContextThe evaluation context.
Returns
- double
The rate.
Exceptions
- ArgumentException
The coupon isn't an Ibor coupon.
- NanoQLException
The floorlet can't be priced.
SwapletPrice(FloatingRateCoupon, EvaluationContext)
The swaplet's price: the coupon's amount, discounted.
public override double SwapletPrice(FloatingRateCoupon coupon, EvaluationContext context)
Parameters
couponFloatingRateCouponThe coupon.
contextEvaluationContextThe evaluation context.
Returns
- double
The price.
Exceptions
- ArgumentException
The coupon isn't an Ibor coupon.
- NanoQLException
The index has no forecasting curve, or the coupon can't be priced.
SwapletRate(FloatingRateCoupon, EvaluationContext)
The swaplet's rate: the coupon's rate.
public override double SwapletRate(FloatingRateCoupon coupon, EvaluationContext context)
Parameters
couponFloatingRateCouponThe coupon.
contextEvaluationContextThe evaluation context.
Returns
- double
The rate.
Exceptions
- ArgumentException
The coupon isn't an Ibor coupon.
- NanoQLException
The coupon can't be priced.