Class CapFloorTermVolCurve
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The at-the-money cap and floor term-volatility curve: the volatility of a cap or floor of a given length, interpolated in the market volatilities of caps and floors of given lengths, whatever the strike.
public sealed class CapFloorTermVolCurve : CapFloorTermVolatilityStructure
- Inheritance
-
CapFloorTermVolCurve
- Inherited Members
- Extension Methods
Remarks
The option dates and times are computed from the reference date when the curve is built, and the interpolation is a natural cubic spline over the option times, built once, which extrapolates inside the structure's range checks.
QuantLib's constructors on quotes and on volatilities coincide once a quote is a double. The floating forms, whose reference date QuantLib moves with the evaluation date, are Create(int, Calendar, BusinessDayConvention, IEnumerable<Period>, IEnumerable<double>, EvaluationContext, DayCounter?): a curve under a later evaluation date is a new curve, whose option dates are that date's, where QuantLib's moving curve can keep the previous reference date's option dates (a documented divergence).
Constructors
CapFloorTermVolCurve(Date, Calendar?, BusinessDayConvention, IEnumerable<Period>, IEnumerable<double>, DayCounter?)
Initializes a new instance of the CapFloorTermVolCurve class with a fixed reference date: the settlement date.
public CapFloorTermVolCurve(Date settlementDate, Calendar? calendar, BusinessDayConvention bdc, IEnumerable<Period> optionTenors, IEnumerable<double> vols, DayCounter? dc = null)
Parameters
settlementDateDateThe settlement date, the reference date.
calendarCalendarThe calendar of the option dates, or null, QuantLib's empty calendar, with which the option dates can't be computed.
bdcBusinessDayConventionThe convention adjusting the option dates.
optionTenorsIEnumerable<Period>The option tenors, positive and increasing.
volsIEnumerable<double>The volatilities, one per option tenor.
dcDayCounterThe day counter; Actual365Fixed, QuantLib's default, when null.
Exceptions
- ArgumentNullException
optionTenorsorvolsis null.- ArgumentException
The option tenors are empty, not positive or not increasing, there is not one volatility per option tenor, or there are fewer than two option tenors.
- ArgumentOutOfRangeException
bdcisn't a member of its type.- NanoQLException
Two tenors can't be compared, or the calendar is null.
Properties
MaxDate
Gets the latest date for which the curve returns volatilities: the last option tenor's date.
public override Date MaxDate { get; }
Property Value
OptionDates
Gets the option dates, computed from the reference date.
public ImmutableArray<Date> OptionDates { get; }
Property Value
OptionTenors
Gets the option tenors.
public ImmutableArray<Period> OptionTenors { get; }
Property Value
OptionTimes
Gets the option times, from the reference date.
public ImmutableArray<double> OptionTimes { get; }
Property Value
Methods
Create(int, Calendar, BusinessDayConvention, IEnumerable<Period>, IEnumerable<double>, EvaluationContext, DayCounter?)
A curve whose reference date is the given number of business days after the evaluation date, on the calendar: QuantLib's floating forms.
public static CapFloorTermVolCurve Create(int settlementDays, Calendar calendar, BusinessDayConvention bdc, IEnumerable<Period> optionTenors, IEnumerable<double> vols, EvaluationContext context, DayCounter? dc = null)
Parameters
settlementDaysintThe business days from the evaluation date to the reference date.
calendarCalendarThe calendar of the business days and of the option dates.
bdcBusinessDayConventionThe convention adjusting the option dates.
optionTenorsIEnumerable<Period>The option tenors, positive and increasing.
volsIEnumerable<double>The volatilities, one per option tenor.
contextEvaluationContextThe evaluation context.
dcDayCounterThe day counter; Actual365Fixed, QuantLib's default, when null.
Returns
- CapFloorTermVolCurve
The curve, with a fixed reference date.
Exceptions
- ArgumentNullException
context,calendaror a collection is null.- ArgumentOutOfRangeException
settlementDaysis negative, orbdcisn't a member of its type.- ArgumentException
The option tenors are empty, not positive or not increasing, there is not one volatility per option tenor, or there are fewer than two option tenors.
- NanoQLException
Two tenors can't be compared.
MaxStrike()
The maximum strike for which the structure returns values.
public override double MaxStrike()
Returns
- double
The strike.
MinStrike()
The minimum strike for which the structure returns values.
public override double MinStrike()
Returns
- double
The strike.
VolatilityImpl(double, double)
The volatility calculation, after the range and strike checks.
protected override double VolatilityImpl(double length, double strike)
Parameters
Returns
- double
The volatility.