net.finmath.marketdata.model.curves
Class DiscountCurve
- java.lang.Object
-
- net.finmath.marketdata.model.curves.AbstractCurve
-
- net.finmath.marketdata.model.curves.Curve
-
- net.finmath.marketdata.model.curves.DiscountCurve
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, ParameterObjectInterface, CurveInterface, DiscountCurveInterface
public class DiscountCurve extends Curve implements java.io.Serializable, DiscountCurveInterface
Implementation of a discount factor curve based onCurve. The discount curve is based on theCurveclass. It thus features all interpolation and extrapolation methods and interpolation entities asCurveand implements theDiscountCurveInterface. 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 ofSwapLegfor an example.- See Also:
SwapLeg,Curve, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.finmath.marketdata.model.curves.Curve
Curve.CurveBuilder, Curve.ExtrapolationMethod, Curve.InterpolationEntity, Curve.InterpolationMethod
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static DiscountCurvecreateDiscountCurveFromAnnualizedZeroRates(java.lang.String name, java.util.Calendar 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 DiscountCurvecreateDiscountCurveFromAnnualizedZeroRates(java.lang.String name, java.util.Calendar 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 DiscountCurvecreateDiscountCurveFromDiscountFactors(java.lang.String name, java.util.Calendar 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 DiscountCurvecreateDiscountCurveFromDiscountFactors(java.lang.String name, double[] times, double[] givenDiscountFactors)Create a discount curve from given times and given discount factors using default interpolation and extrapolation methods.static DiscountCurvecreateDiscountCurveFromDiscountFactors(java.lang.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 DiscountCurvecreateDiscountCurveFromDiscountFactors(java.lang.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 DiscountCurvecreateDiscountCurveFromZeroRates(java.lang.String name, java.util.Calendar 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 DiscountCurvecreateDiscountCurveFromZeroRates(java.lang.String name, java.util.Calendar 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 DiscountCurvecreateDiscountCurveFromZeroRates(java.lang.String name, double[] times, double[] givenZeroRates)Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods.static DiscountCurvecreateDiscountCurveFromZeroRates(java.lang.String name, 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 DiscountCurveInterfacecreateDiscountFactorsFromForwardRates(java.lang.String name, TimeDiscretizationInterface tenor, double[] forwardRates)Create a discount curve from given time discretization and forward rates.doublegetDiscountFactor(AnalyticModelInterface model, double maturity)Returns the discount factor for the corresponding maturity.doublegetDiscountFactor(double maturity)Returns the discount factor for the corresponding maturity.doublegetZeroRate(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.java.lang.StringtoString()-
Methods inherited from class net.finmath.marketdata.model.curves.Curve
clone, getCloneBuilder, getCloneForParameter, getExtrapolationMethod, getInterpolationEntity, getInterpolationMethod, getParameter, getValue, getValue, setParameter
-
Methods inherited from class net.finmath.marketdata.model.curves.AbstractCurve
getName, getReferenceDate, getValues
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.marketdata.model.curves.CurveInterface
clone, getCloneBuilder, getCloneForParameter, getName, getReferenceDate, getValue, getValue
-
Methods inherited from interface net.finmath.marketdata.calibration.ParameterObjectInterface
getParameter, setParameter
-
-
-
-
Method Detail
-
createDiscountCurveFromDiscountFactors
public static DiscountCurve createDiscountCurveFromDiscountFactors(java.lang.String name, java.util.Calendar 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.- 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(java.lang.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.- 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(java.lang.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.- 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(java.lang.String name, double[] times, double[] 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.
-
createDiscountCurveFromZeroRates
public static DiscountCurve createDiscountCurveFromZeroRates(java.lang.String name, java.util.Calendar 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. The discount factor is determined bygivenDiscountFactors[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(java.lang.String name, 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. The discount factor is determined bygivenDiscountFactors[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.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(java.lang.String name, java.util.Calendar 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. The discount factor is determined bygivenDiscountFactors[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(java.lang.String name, double[] times, double[] givenZeroRates)
Create a discount curve from given times and given zero rates using default interpolation and extrapolation methods. The discount factor is determined bygivenDiscountFactors[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(java.lang.String name, java.util.Calendar 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. The discount factor is determined bygivenDiscountFactors[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(java.lang.String name, java.util.Calendar 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. The discount factor is determined bygivenDiscountFactors[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(java.lang.String name, TimeDiscretizationInterface tenor, double[] 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 ratesforwardRates- Array of forward rates.- Returns:
- A new discount factor object.
-
getDiscountFactor
public double getDiscountFactor(double maturity)
Description copied from interface:DiscountCurveInterfaceReturns the discount factor for the corresponding maturity. This getter is not optimized for performance.- Specified by:
getDiscountFactorin interfaceDiscountCurveInterface- 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 double getDiscountFactor(AnalyticModelInterface model, double maturity)
Description copied from interface:DiscountCurveInterfaceReturns the discount factor for the corresponding maturity. This getter is not optimized for performance.- Specified by:
getDiscountFactorin interfaceDiscountCurveInterface- 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.
-
getZeroRate
public 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$.- Parameters:
maturity- The given maturity.- Returns:
- The zero rate.
-
getZeroRates
public double[] getZeroRates(double[] maturities)
Returns the zero rates for a given vector maturities.- Parameters:
maturities- The given maturities.- Returns:
- The zero rates.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG