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

## Class 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 by T = timeScaling * t, where t is the maturity as an ACT/365 year fraction from the given reference date.
Version:
1.0
Author:
Christian Fries
Serialized Form
• ### Constructor Summary

Constructors
Constructor and Description
DiscountCurveNelsonSiegelSvensson(String name, LocalDate referenceDate, double[] parameter, double timeScaling)
Create a discount curve using a Nelson-Siegel-Svensson parametrization.
• ### Method Summary

All Methods
Modifier and Type Method and Description
DiscountCurveNelsonSiegelSvensson clone()
Create a deep copied clone.
CurveBuilder getCloneBuilder()
Returns a curve builder bases on a clone of this curve.
DiscountCurveNelsonSiegelSvensson getCloneForParameter(double[] value)
Create a clone with a modified parameter.
double getDiscountFactor(AnalyticModel model, double maturity)
Return the discount factor within a given model context for a given maturity.
double getDiscountFactor(double maturity)
Returns the discount factor for the corresponding maturity.
double[] getParameter()
Get the current parameter associated with the state of the objects.
double getTimeScaling()
double getValue(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.
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.
void setParameter(double[] parameter)
Deprecated.
String toString()
• ### 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 an AnalyticModelFromCuvesAndVols.
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. See getDiscountFactor(AnalyticModel, double).
• ### Method Detail

• #### getDiscountFactor

public double getDiscountFactor(double maturity)
Description copied from interface: DiscountCurve
Returns the discount factor for the corresponding maturity. This getter is not optimized for performance.
Specified by:
getDiscountFactor in interface DiscountCurve
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:
getDiscountFactor in interface DiscountCurve
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.
DiscountCurve.getDiscountFactor(net.finmath.marketdata.model.AnalyticModel, double)
• #### getValue

public double getValue(AnalyticModel model,
double time)
Description copied from interface: Curve
Returns 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.
Specified by:
getValue in interface Curve
Parameters:
model - An analytic model providing a context.
time - Time for which the value should be returned.
Returns:
The value at the give time.
• #### 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: Curve
Returns 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:
getCloneBuilder in interface Curve
Returns:
An object implementing the CurveBuilderInterface where the underlying curve is a clone of this curve.
• #### getParameter

public double[] getParameter()
Description copied from interface: ParameterObject
Get the current parameter associated with the state of the objects.
Specified by:
getParameter in interface ParameterObject
Returns:
The parameter.
• #### setParameter

@Deprecated
public void setParameter(double[] parameter)
Deprecated.
Description copied from interface: ParameterObject
Set the current parameter and change the state of the objects.
Specified by:
setParameter in interface ParameterObject
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: Curve
Create a deep copied clone.
Specified by:
clone in interface Curve
Overrides:
clone in class AbstractCurve
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: ParameterObject
Create a clone with a modified parameter.
Specified by:
getCloneForParameter in interface ParameterObject
Specified by:
getCloneForParameter in interface Curve
Overrides:
getCloneForParameter in class AbstractCurve
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:
toString in class AbstractCurve