finMath lib documentation
net.finmath.analytic.model.curves

## Class DiscountCurve

• ### Method Detail

• #### createDiscountCurveFromDiscountFactors

public static DiscountCurve createDiscountCurveFromDiscountFactors(String name,
LocalDate referenceDate,
double[] times,
RandomVariableInterface[] givenDiscountFactors,
boolean[] isParameter,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given discount factors using given interpolation and extrapolation methods.
Parameters:
name - The name of this discount curve.
referenceDate - The reference date for this curve, i.e., the date which defined t=0.
times - Array of times as doubles.
givenDiscountFactors - Array of corresponding discount factors.
isParameter - Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromDiscountFactors

public static DiscountCurve createDiscountCurveFromDiscountFactors(String name,
double[] times,
RandomVariableInterface[] givenDiscountFactors,
boolean[] isParameter,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given discount factors using given interpolation and extrapolation methods.
Parameters:
name - The name of this discount curve.
times - Array of times as doubles.
givenDiscountFactors - Array of corresponding discount factors.
isParameter - Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromDiscountFactors

public static DiscountCurve createDiscountCurveFromDiscountFactors(String name,
double[] times,
RandomVariableInterface[] givenDiscountFactors,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given discount factors using given interpolation and extrapolation methods.
Parameters:
name - The name of this discount curve.
times - Array of times as doubles.
givenDiscountFactors - Array of corresponding discount factors.
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromDiscountFactors

public static DiscountCurve createDiscountCurveFromDiscountFactors(String name,
double[] times,
RandomVariableInterface[] givenDiscountFactors)
Create a discount curve from given times and given discount factors using default interpolation and extrapolation methods.
Parameters:
name - The name of this discount curve.
times - Array of times as doubles.
givenDiscountFactors - Array of corresponding discount factors.
Returns:
A new discount factor object.
• #### createDiscountCurveFromDiscountFactors

public static DiscountCurve createDiscountCurveFromDiscountFactors(String name,
double[] times,
double[] givenDiscountFactors)
• #### createDiscountCurveFromZeroRates

public static DiscountCurve createDiscountCurveFromZeroRates(String name,
LocalDate referenceDate,
double[] times,
RandomVariableInterface[] givenZeroRates,
boolean[] isParameter,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given zero rates using given interpolation and extrapolation methods. The discount factor is determined by givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
Parameters:
name - The name of this discount curve.
referenceDate - The reference date for this curve, i.e., the date which defined t=0.
times - Array of times as doubles.
givenZeroRates - Array of corresponding zero rates.
isParameter - Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromZeroRates

public static DiscountCurve createDiscountCurveFromZeroRates(String name,
Date referenceDate,
double[] times,
RandomVariableInterface[] givenZeroRates,
boolean[] isParameter,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given zero rates using given interpolation and extrapolation methods. The discount factor is determined by givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
Parameters:
name - The name of this discount curve.
referenceDate - The reference date for this curve, i.e., the date which defined t=0.
times - Array of times as doubles.
givenZeroRates - Array of corresponding zero rates.
isParameter - Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromZeroRates

public static DiscountCurve createDiscountCurveFromZeroRates(String name,
LocalDate referenceDate,
double[] times,
RandomVariableInterface[] givenZeroRates,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given zero rates using given interpolation and extrapolation methods. The discount factor is determined by givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
Parameters:
name - The name of this discount curve.
referenceDate - The reference date for this curve, i.e., the date which defined t=0.
times - Array of times as doubles.
givenZeroRates - Array of corresponding zero rates.
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromZeroRates

public static DiscountCurve createDiscountCurveFromZeroRates(String name,
double[] times,
RandomVariableInterface[] givenZeroRates)
Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods. The discount factor is determined by givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
Parameters:
name - The name of this discount curve.
times - Array of times as doubles.
givenZeroRates - Array of corresponding zero rates.
Returns:
A new discount factor object.
• #### createDiscountCurveFromAnnualizedZeroRates

public static DiscountCurve createDiscountCurveFromAnnualizedZeroRates(String name,
LocalDate referenceDate,
double[] times,
RandomVariableInterface[] givenAnnualizedZeroRates,
boolean[] isParameter,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given annualized zero rates using given interpolation and extrapolation methods. The discount factor is determined by givenDiscountFactors[timeIndex] = Math.pow(1.0 + givenAnnualizedZeroRates[timeIndex], -times[timeIndex]);
Parameters:
name - The name of this discount curve.
referenceDate - The reference date for this curve, i.e., the date which defined t=0.
times - Array of times as doubles.
givenAnnualizedZeroRates - Array of corresponding zero rates.
isParameter - Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountCurveFromAnnualizedZeroRates

public static DiscountCurve createDiscountCurveFromAnnualizedZeroRates(String name,
LocalDate referenceDate,
double[] times,
RandomVariableInterface[] givenAnnualizedZeroRates,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Create a discount curve from given times and given annualized zero rates using given interpolation and extrapolation methods. The discount factor is determined by givenDiscountFactors[timeIndex] = Math.pow(1.0 + givenAnnualizedZeroRates[timeIndex], -times[timeIndex]);
Parameters:
name - The name of this discount curve.
referenceDate - The reference date for this curve, i.e., the date which defined t=0.
times - Array of times as doubles.
givenAnnualizedZeroRates - Array of corresponding zero rates.
interpolationMethod - The interpolation method used for the curve.
extrapolationMethod - The extrapolation method used for the curve.
interpolationEntity - The entity interpolated/extrapolated.
Returns:
A new discount factor object.
• #### createDiscountFactorsFromForwardRates

public static DiscountCurveInterface createDiscountFactorsFromForwardRates(String name,
TimeDiscretizationInterface tenor,
RandomVariableInterface[] forwardRates)
Create a discount curve from given time discretization and forward rates. This function is provided for "single interest rate curve" frameworks.
Parameters:
name - The name of this discount curve.
tenor - Time discretization for the forward rates
forwardRates - Array of forward rates.
Returns:
A new discount factor object.
• #### createDiscountCurveFromMonteCarloLiborModel

public static DiscountCurveInterface createDiscountCurveFromMonteCarloLiborModel(String forwardCurveName,
LIBORModelMonteCarloSimulationInterface model,
double startTime)
throws CalculationException
Create a discount curve from forwards given by a LIBORMonteCarloModel. If the model uses multiple curves, return its discount curve.
Parameters:
forwardCurveName - name of the forward curve.
model - Monte Carlo model providing the forwards.
startTime - time at which the curve starts, i.e. zero time for the curve
Returns:
a discount curve from forwards given by a LIBORMonteCarloModel.
Throws:
CalculationException - Thrown if the model failed to provide the forward rates.
• #### getZeroRate

public RandomVariableInterface getZeroRate(double maturity)
Returns the zero rate for a given maturity, i.e., -ln(df(T)) / T where T is the given maturity and df(T) is the discount factor at time $T$.
Parameters:
maturity - The given maturity.
Returns:
The zero rate.
• #### getZeroRates

public RandomVariableInterface[] getZeroRates(double[] maturities)
Returns the zero rates for a given vector maturities.
Parameters:
maturities - The given maturities.
Returns:
The zero rates.

RandomVariableInterface discountFactor,
boolean isParameter)
• #### toString

public String toString()
Overrides:
toString in class Curve
• #### getDiscountFactor

public RandomVariableInterface getDiscountFactor(double maturity)
Description copied from interface: DiscountCurveInterface
Returns the discount factor for the corresponding maturity. This getter is not optimized for performance.
Specified by:
getDiscountFactor in interface DiscountCurveInterface
Parameters:
maturity - The maturity for which the discount factor is requested.
Returns:
The discount factor (i.e., price of the zero coupon bond with given maturity and notional 1.
• #### getDiscountFactor

public RandomVariableInterface getDiscountFactor(AnalyticModelInterface model,
double maturity)
Description copied from interface: DiscountCurveInterface
Returns the discount factor for the corresponding maturity. This getter is not optimized for performance.
Specified by:
getDiscountFactor in interface DiscountCurveInterface
Parameters:
model - An analytic model providing a context. Some curves do not need this (can be null).
maturity - The maturity for which the discount factor is requested.
Returns:
The discount factor (i.e., price of the zero coupon bond with given maturity and notional 1.