- java.lang.Object
-
- net.finmath.marketdata.model.curves.AbstractCurve
-
- net.finmath.marketdata.model.bond.BondCurve
-
- All Implemented Interfaces:
Serializable
,Cloneable
,ParameterObject
,Curve
public class BondCurve extends AbstractCurve
Implements the bond curve as a curve object, seeCurve
. The bond curve is built as a product of a given reference discount curve and spread curve. Since it is not clear in general if the reference curve or the spread curve are given in terms of discount factors or zero rates, this class distinguishes between all possible cases of types. For the curve types provided seeBondCurve.Type
.- Version:
- 1.0
- Author:
- Moritz Scherrmann
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BondCurve.Type
Possible curve types, where the first term stands for the reference discount curve and the second term stands for the spread curve.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CurveBuilder
getCloneBuilder()
Returns a curve builder bases on a clone of this curve.double
getDiscountFactor(double time)
double
getDiscountFactor(AnalyticModel model, double time)
String
getName()
Get the name of the curve.double[]
getParameter()
Get the current parameter associated with the state of the objects.Curve
getReferenceCurve()
LocalDate
getReferenceDate()
Return the reference date of this curve, i.e.Curve
getSpreadCurve()
String
getType()
double
getValue(double time)
Returns the value for the time using the interpolation method associated with this curve.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$.void
setParameter(double[] parameter)
Set the current parameter and change the state of the objects.-
Methods inherited from class net.finmath.marketdata.model.curves.AbstractCurve
clone, getCloneForParameter, getValues, toString
-
-
-
-
Constructor Detail
-
BondCurve
public BondCurve(String name, LocalDate referenceDate, Curve referenceCurve, Curve spreadCurve, BondCurve.Type type)
Creates a bond curve.- Parameters:
name
- Name of the curve.referenceDate
- The reference date for this curve, i.e., the date which defined t=0.referenceCurve
- The reference discount curve.spreadCurve
- The given spread curve.type
- The types of the given curves "referenceCurve" and "spreadCurve" (discount factor or zero rate)
-
-
Method Detail
-
getValue
public double getValue(double time)
Description copied from interface:Curve
Returns the value for the time using the interpolation method associated with this curve.- Specified by:
getValue
in interfaceCurve
- Overrides:
getValue
in classAbstractCurve
- Parameters:
time
- Time for which the value should be returned.- Returns:
- The value at the give time.
-
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.- Parameters:
model
- An analytic model providing a context.time
- Time for which the value should be returned.- Returns:
- The value at the give time.
-
getDiscountFactor
public double getDiscountFactor(double time)
-
getDiscountFactor
public double getDiscountFactor(AnalyticModel model, double 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.
-
getCloneBuilder
public CurveBuilder getCloneBuilder() throws CloneNotSupportedException
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.- Returns:
- An object implementing the CurveBuilderInterface where the underlying curve is a clone of this curve.
- Throws:
CloneNotSupportedException
- Thrown, when this curve could not be cloned.
-
getName
public String getName()
Description copied from interface:Curve
Get the name of the curve.- Specified by:
getName
in interfaceCurve
- Overrides:
getName
in classAbstractCurve
- Returns:
- The name of this curve
-
getReferenceDate
public LocalDate getReferenceDate()
Description copied from interface:Curve
Return the reference date of this curve, i.e. the date associated with t=0. May be null in case the curve is not associated with a fixed date (e.g. a time homogenous model).- Specified by:
getReferenceDate
in interfaceCurve
- Overrides:
getReferenceDate
in classAbstractCurve
- Returns:
- The date identified as t=0.
-
getReferenceCurve
public Curve getReferenceCurve()
-
getSpreadCurve
public Curve getSpreadCurve()
-
getType
public String getType()
-
getParameter
public double[] getParameter()
Description copied from interface:ParameterObject
Get the current parameter associated with the state of the objects.- Returns:
- The parameter.
-
setParameter
public void setParameter(double[] parameter)
Description copied from interface:ParameterObject
Set the current parameter and change the state of the objects.- Parameters:
parameter
- The parameter associated with the new state of the objects.
-
-