Class DefaultProbabilityTermStructure
- Namespace
- NanoQL.TermStructures
- Assembly
- NanoQL.dll
The default-probability term structure: the base of the credit curves that give survival and default probabilities, default densities and hazard rates.
public abstract class DefaultProbabilityTermStructure : TermStructure
- Inheritance
-
DefaultProbabilityTermStructure
- Derived
- Inherited Members
- Extension Methods
Remarks
An extension point. Every built structure has a fixed reference date: QuantLib's constructor that takes neither a
reference date nor settlement days is the reference-date form, and the settlement-days form takes the reference date
its concrete class's Create computed from the evaluation context.
QuantLib's jumps are quotes; here they are values, each multiplying the survival probabilities past its date, and each checked to lie in (0, 1] when a probability reads it, with QuantLib's "invalid … jump value".
Constructors
DefaultProbabilityTermStructure(Date, Calendar?, DayCounter, int?, IEnumerable<double>?, IEnumerable<Date>?)
Initializes a new instance of the DefaultProbabilityTermStructure class with a fixed reference date.
protected DefaultProbabilityTermStructure(Date referenceDate, Calendar? cal, DayCounter dc, int? settlementDays = null, IEnumerable<double>? jumps = null, IEnumerable<Date>? jumpDates = null)
Parameters
referenceDateDateThe reference date.
calCalendarThe calendar used for reference and option date calculation, if any.
dcDayCounterThe day counter used for date/time conversion.
settlementDaysint?The settlement days the reference date was calculated with, if any.
jumpsIEnumerable<double>The survival-probability jumps, each applied to the probabilities past its date; none when null.
jumpDatesIEnumerable<Date>The jumps' dates, one per jump; when null or empty, the jumps fall on 31 December of the reference date's year and of the years after it, one per jump.
Exceptions
- ArgumentNullException
dcis null.- ArgumentException
Jump dates are given and their number differs from the jumps', or one of them is
default(Date).
Methods
DefaultDensity(Date, bool)
The default density at a date.
public double DefaultDensity(Date d, bool extrapolate = false)
Parameters
Returns
- double
The density.
Exceptions
- ArgumentException
disdefault(Date).- NanoQLException
The date is out of the curve's range.
DefaultDensity(double, bool)
The default density at a time.
public double DefaultDensity(double t, bool extrapolate = false)
Parameters
Returns
- double
The density.
Exceptions
- NanoQLException
The time is out of the curve's range.
DefaultDensityImpl(double)
The default density at a time, which derived curves calculate. Range checks have already been performed, so it must assume that extrapolation is required.
protected abstract double DefaultDensityImpl(double t)
Parameters
tdoubleThe time.
Returns
- double
The density.
DefaultProbability(Date, Date, bool)
The probability of default between two dates.
public double DefaultProbability(Date d1, Date d2, bool extrapolate = false)
Parameters
d1DateThe initial date, which may precede the reference date: the probability of default before it is taken as null, so that a protection rolled to the next business day still starts at its date.
d2DateThe final date.
extrapolateboolWhether to extrapolate past the curve's maximum date.
Returns
- double
The probability.
Exceptions
- ArgumentException
A date is
default(Date), ord1is afterd2.- NanoQLException
A date is out of the curve's range, or a jump isn't in (0, 1].
DefaultProbability(Date, bool)
The probability of default from the reference date to a date.
public double DefaultProbability(Date d, bool extrapolate = false)
Parameters
Returns
- double
The probability.
Exceptions
- ArgumentException
disdefault(Date).- NanoQLException
The date is out of the curve's range, or a jump before it isn't in (0, 1].
DefaultProbability(double, bool)
The probability of default from the reference date to a time.
public double DefaultProbability(double t, bool extrapolate = false)
Parameters
Returns
- double
The probability.
Exceptions
- NanoQLException
The time is out of the curve's range, or a jump before it isn't in (0, 1].
DefaultProbability(double, double, bool)
The probability of default between two times.
public double DefaultProbability(double t1, double t2, bool extrapolate = false)
Parameters
t1doubleThe initial time, which may be negative: the probability of default before the reference date is taken as null.
t2doubleThe final time.
extrapolateboolWhether to extrapolate past the curve's maximum time.
Returns
- double
The probability.
Exceptions
- ArgumentException
t1is aftert2.- NanoQLException
A time is out of the curve's range, or a jump isn't in (0, 1].
HazardRate(Date, bool)
The hazard rate at a date, with annual frequency and continuous compounding.
public double HazardRate(Date d, bool extrapolate = false)
Parameters
Returns
- double
The rate.
Exceptions
- ArgumentException
disdefault(Date).- NanoQLException
The date is out of the curve's range.
HazardRate(double, bool)
The hazard rate at a time, with annual frequency and continuous compounding.
public double HazardRate(double t, bool extrapolate = false)
Parameters
Returns
- double
The rate.
Exceptions
- NanoQLException
The time is out of the curve's range.
HazardRateImpl(double)
The hazard rate at a time: by default the default density over the survival probability, 0 where the probability is. Derived curves may override it with a more efficient calculation.
protected virtual double HazardRateImpl(double t)
Parameters
tdoubleThe time.
Returns
- double
The rate.
JumpDates()
The dates of the survival-probability jumps, one per jump.
public virtual ImmutableArray<Date> JumpDates()
Returns
- ImmutableArray<Date>
The dates, empty for a curve without jumps.
JumpTimes()
The times of the survival-probability jumps, measured from the reference date by the curve's day counter.
public virtual ImmutableArray<double> JumpTimes()
Returns
- ImmutableArray<double>
The times, one per jump, empty for a curve without jumps.
SurvivalProbability(Date, bool)
The probability of survival from the reference date to a date.
public double SurvivalProbability(Date d, bool extrapolate = false)
Parameters
Returns
- double
The probability.
Exceptions
- ArgumentException
disdefault(Date).- NanoQLException
The date is out of the curve's range, or a jump before it isn't in (0, 1].
SurvivalProbability(double, bool)
The probability of survival from the reference date to a time, measured by the curve's day counter.
public double SurvivalProbability(double t, bool extrapolate = false)
Parameters
Returns
- double
The probability.
Exceptions
- NanoQLException
The time is out of the curve's range, or a jump before it isn't in (0, 1].
SurvivalProbabilityImpl(double)
The survival probability at a time, which derived curves calculate. Range checks have already been performed, so it must assume that extrapolation is required.
protected abstract double SurvivalProbabilityImpl(double t)
Parameters
tdoubleThe time.
Returns
- double
The probability.