public class DiscountCurve extends Curve implements Serializable, DiscountCurveInterface
Curve. The discount curve is based on the Curve class.
It thus features all interpolation and extrapolation methods and interpolation entities
as Curve and implements the DiscountCurveInterface.
Note that this version of the DiscountCurve will no longer make the
assumption that at t=0 its value is 1.0. Such a norming is not
necessary since valuation will always divide by the corresponding
discount factor at evaluation time. See the implementation of SwapLeg
for an example.SwapLeg,
Curve,
Serialized FormCurve.CurveBuilder, Curve.ExtrapolationMethod, Curve.InterpolationEntity, Curve.InterpolationMethod| Modifier and Type | Method and Description |
|---|---|
protected void |
addDiscountFactor(double maturity,
double discountFactor,
boolean isParameter) |
static DiscountCurve |
createDiscountCurveFromAnnualizedZeroRates(String name,
LocalDate referenceDate,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromAnnualizedZeroRates(String name,
LocalDate referenceDate,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromDiscountFactors(String name,
double[] times,
double[] givenDiscountFactors)
Create a discount curve from given times and given discount factors using default interpolation and extrapolation methods.
|
static DiscountCurve |
createDiscountCurveFromDiscountFactors(String name,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromDiscountFactors(String name,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromDiscountFactors(String name,
LocalDate referenceDate,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromZeroRates(String name,
Date referenceDate,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromZeroRates(String name,
double[] times,
double[] givenZeroRates)
Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods.
|
static DiscountCurve |
createDiscountCurveFromZeroRates(String name,
double[] times,
double[] givenZeroRates,
boolean[] isParameter,
Curve.InterpolationMethod interpolationMethod,
Curve.ExtrapolationMethod extrapolationMethod,
Curve.InterpolationEntity interpolationEntity)
Deprecated.
Initializing a curve without reference date is deprecated.
|
static DiscountCurve |
createDiscountCurveFromZeroRates(String name,
LocalDate referenceDate,
double[] times,
double[] 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.
|
static DiscountCurve |
createDiscountCurveFromZeroRates(String name,
LocalDate referenceDate,
double[] times,
double[] 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.
|
static DiscountCurveInterface |
createDiscountFactorsFromForwardRates(String name,
TimeDiscretizationInterface tenor,
double[] forwardRates)
Create a discount curve from given time discretization and forward rates.
|
double |
getDiscountFactor(AnalyticModelInterface model,
double maturity)
Returns the discount factor for the corresponding maturity.
|
double |
getDiscountFactor(double maturity)
Returns the discount factor for the corresponding maturity.
|
double |
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$.
|
double[] |
getZeroRates(double[] maturities)
Returns the zero rates for a given vector maturities.
|
String |
toString() |
addPoint, clone, getCloneBuilder, getCloneForParameter, getExtrapolationMethod, getInterpolationEntity, getInterpolationMethod, getParameter, getParameterIndex, getTimeIndex, getValue, getValue, setParametergetName, getReferenceDate, getValuesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclone, getCloneBuilder, getCloneForParameter, getName, getReferenceDate, getValue, getValuegetParameter, setParameterpublic static DiscountCurve createDiscountCurveFromDiscountFactors(String name, LocalDate referenceDate, double[] times, double[] givenDiscountFactors, boolean[] isParameter, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
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.public static DiscountCurve createDiscountCurveFromDiscountFactors(String name, double[] times, double[] givenDiscountFactors, boolean[] isParameter, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
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.public static DiscountCurve createDiscountCurveFromDiscountFactors(String name, double[] times, double[] givenDiscountFactors, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
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.public static DiscountCurve createDiscountCurveFromDiscountFactors(String name, double[] times, double[] givenDiscountFactors)
name - The name of this discount curve.times - Array of times as doubles.givenDiscountFactors - Array of corresponding discount factors.public static DiscountCurve createDiscountCurveFromZeroRates(String name, LocalDate referenceDate, double[] times, double[] givenZeroRates, boolean[] isParameter, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
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.public static DiscountCurve createDiscountCurveFromZeroRates(String name, Date referenceDate, double[] times, double[] givenZeroRates, boolean[] isParameter, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
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.@Deprecated public static DiscountCurve createDiscountCurveFromZeroRates(String name, double[] times, double[] givenZeroRates, boolean[] isParameter, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
name - The name of this discount curve.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.public static DiscountCurve createDiscountCurveFromZeroRates(String name, LocalDate referenceDate, double[] times, double[] givenZeroRates, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
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.public static DiscountCurve createDiscountCurveFromZeroRates(String name, double[] times, double[] givenZeroRates)
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
name - The name of this discount curve.times - Array of times as doubles.givenZeroRates - Array of corresponding zero rates.public static DiscountCurve createDiscountCurveFromAnnualizedZeroRates(String name, LocalDate referenceDate, double[] times, double[] givenAnnualizedZeroRates, boolean[] isParameter, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
givenDiscountFactors[timeIndex] = Math.pow(1.0 + givenAnnualizedZeroRates[timeIndex], -times[timeIndex]);
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.public static DiscountCurve createDiscountCurveFromAnnualizedZeroRates(String name, LocalDate referenceDate, double[] times, double[] givenAnnualizedZeroRates, Curve.InterpolationMethod interpolationMethod, Curve.ExtrapolationMethod extrapolationMethod, Curve.InterpolationEntity interpolationEntity)
givenDiscountFactors[timeIndex] = Math.pow(1.0 + givenAnnualizedZeroRates[timeIndex], -times[timeIndex]);
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.public static DiscountCurveInterface createDiscountFactorsFromForwardRates(String name, TimeDiscretizationInterface tenor, double[] forwardRates)
name - The name of this discount curve.tenor - Time discretization for the forward ratesforwardRates - Array of forward rates.public double getDiscountFactor(double maturity)
DiscountCurveInterfacegetDiscountFactor in interface DiscountCurveInterfacematurity - The maturity for which the discount factor is requested.public double getDiscountFactor(AnalyticModelInterface model, double maturity)
DiscountCurveInterfacegetDiscountFactor in interface DiscountCurveInterfacemodel - 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.public double getZeroRate(double maturity)
maturity - The given maturity.public double[] getZeroRates(double[] maturities)
maturities - The given maturities.protected void addDiscountFactor(double maturity,
double discountFactor,
boolean isParameter)
Copyright © 2017. All rights reserved.