Module net.finmath.lib
Class DiscountCurveNelsonSiegelSvensson
- java.lang.Object
-
- net.finmath.marketdata.model.curves.AbstractCurve
-
- net.finmath.marketdata.model.curves.DiscountCurveNelsonSiegelSvensson
-
- All Implemented Interfaces:
Serializable,Cloneable,ParameterObject,Curve,DiscountCurve
public class DiscountCurveNelsonSiegelSvensson extends AbstractCurve implements Serializable, DiscountCurve
Implementation of a discount factor curve given by a Nelson-Siegel-Svensson (NSS) parameterization. In the NSS parameterization the zero rate \( r(T) \) is given by \[ r(T) = \beta_0 + \beta_1 \frac{1-x_0}{T/\tau_0} + \beta_2 ( \frac{1-x_0}{T/\tau_0} - x_0) + \beta_3 ( \frac{1-x_1}{T/\tau_1} - x_1) \] where \( x_0 = \exp(-T/\tau_0) \) and \( x_1 = \exp(-T/\tau_1) \). The sub-family of curves with \( \beta_3 = 0 \) is called Nelson-Siegel parameterization. Note: This is a time-parameterized model. The finmath lib library uses an internal mapping from date to times \( t \). This mapping does not necessarily need to correspond with the curves understanding for the parameter \( T \). For that reason this class allows to re-scale the time parameter. Currently only a simple re-scaling factor is supported. The parameter T used in the parameterization is given byT = timeScaling * t, where t is the maturity as an ACT/365 year fraction from the given reference date.- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DiscountCurveNelsonSiegelSvensson(String name, LocalDate referenceDate, double[] parameter, double timeScaling)Create a discount curve using a Nelson-Siegel-Svensson parametrization.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DiscountCurveNelsonSiegelSvenssonclone()Create a deep copied clone.CurveBuildergetCloneBuilder()Returns a curve builder bases on a clone of this curve.DiscountCurveNelsonSiegelSvenssongetCloneForParameter(double[] value)Create a clone with a modified parameter.doublegetDiscountFactor(double maturity)Returns the discount factor for the corresponding maturity.doublegetDiscountFactor(AnalyticModel model, double maturity)Return the discount factor within a given model context for a given maturity.double[]getParameter()Get the current parameter associated with the state of the objects.doublegetTimeScaling()doublegetValue(AnalyticModel model, double time)Returns the value for the time using the interpolation method associated with this curve within a given context, i.e., a model.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.voidsetParameter(double[] parameter)Deprecated.StringtoString()-
Methods inherited from class net.finmath.marketdata.model.curves.AbstractCurve
getName, getReferenceDate, getValue, getValues
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.finmath.marketdata.model.curves.Curve
getName, getReferenceDate, getValue
-
-
-
-
Constructor Detail
-
DiscountCurveNelsonSiegelSvensson
public DiscountCurveNelsonSiegelSvensson(String name, LocalDate referenceDate, double[] parameter, double timeScaling)
Create a discount curve using a Nelson-Siegel-Svensson parametrization.- Parameters:
name- The name of the curve (the curve can be referenced under this name, if added to anAnalyticModelFromCuvesAndVols.referenceDate- The reference date of this curve, i.e. the date associated with t=0.parameter- The Nelson-Siegel-Svensson parameters in the order \( ( \beta_0, \beta_1, \beta_2, \beta_3, \tau_0, \tau_1 ) \).timeScaling- The time parameter argument rescaling. SeegetDiscountFactor(AnalyticModel, double).
-
-
Method Detail
-
getDiscountFactor
public double getDiscountFactor(double maturity)
Description copied from interface:DiscountCurveReturns the discount factor for the corresponding maturity. This getter is not optimized for performance.- Specified by:
getDiscountFactorin interfaceDiscountCurve- 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(AnalyticModel model, double maturity)
Return the discount factor within a given model context for a given maturity.- Specified by:
getDiscountFactorin interfaceDiscountCurve- Parameters:
model- The model used as a context (not required for this class).maturity- The maturity in terms of ACT/365 daycount form this curve reference date. Note that this parameter might get rescaled to a different time parameter.- Returns:
- The discount factor (i.e., price of the zero coupon bond with given maturity and notional 1.
- See Also:
DiscountCurve.getDiscountFactor(net.finmath.marketdata.model.AnalyticModel, double)
-
getValue
public double getValue(AnalyticModel model, double time)
Description copied from interface:CurveReturns the value for the time using the interpolation method associated with this curve within a given context, i.e., a model. The model (context) is needed only if the curve relies on another curve. Examples are a forward curve which relies on a discount curve or a discount curve which is defined via a spread over another curve.
-
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.
-
getCloneBuilder
public CurveBuilder getCloneBuilder()
Description copied from interface:CurveReturns a curve builder bases on a clone of this curve. Using that curve builder you may create a new curve from this curve by adding points or changing properties. Note: The clone has the same name than this one.- Specified by:
getCloneBuilderin interfaceCurve- Returns:
- An object implementing the CurveBuilderInterface where the underlying curve is a clone of this curve.
-
getParameter
public double[] getParameter()
Description copied from interface:ParameterObjectGet the current parameter associated with the state of the objects.- Specified by:
getParameterin interfaceParameterObject- Returns:
- The parameter.
-
setParameter
@Deprecated public void setParameter(double[] parameter)
Deprecated.Description copied from interface:ParameterObjectSet the current parameter and change the state of the objects.- Specified by:
setParameterin interfaceParameterObject- Parameters:
parameter- The parameter associated with the new state of the objects.
-
getTimeScaling
public double getTimeScaling()
-
clone
public DiscountCurveNelsonSiegelSvensson clone() throws CloneNotSupportedException
Description copied from interface:CurveCreate a deep copied clone.- Specified by:
clonein interfaceCurve- Overrides:
clonein classAbstractCurve- Returns:
- A clone (deep copied).
- Throws:
CloneNotSupportedException- Thrown, when the curve could not be cloned.
-
getCloneForParameter
public DiscountCurveNelsonSiegelSvensson getCloneForParameter(double[] value) throws CloneNotSupportedException
Description copied from interface:ParameterObjectCreate a clone with a modified parameter.- Specified by:
getCloneForParameterin interfaceCurve- Specified by:
getCloneForParameterin interfaceParameterObject- Overrides:
getCloneForParameterin classAbstractCurve- Parameters:
value- The new parameter.- Returns:
- A clone with an otherwise modified parameter.
- Throws:
CloneNotSupportedException- Thrown, when the curve could not be cloned.
-
toString
public String toString()
- Overrides:
toStringin classAbstractCurve
-
-