net.finmath.marketdata.model.curves
Class DiscountCurveFromForwardCurve
- java.lang.Object
-
- net.finmath.marketdata.model.curves.AbstractCurve
-
- net.finmath.marketdata.model.curves.DiscountCurveFromForwardCurve
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, ParameterObjectInterface, CurveInterface, DiscountCurveInterface
public class DiscountCurveFromForwardCurve extends AbstractCurve implements java.io.Serializable, DiscountCurveInterface
A discount curve derived from a given forward curve. The discount factors df(t) are defined at t = k * d for integers k via df(t+d) = df(t) / (1 + f(t) * d) and for t = k * d and 0 < r < d via df(t+r) = df(t) / (1 + f(t) * r) where d is a given the payment offset and f(t) is the forward curve.Note that a special interpolation is performed for in-between points. Hence, creating a
ForwardCurveFromDiscountCurveand from it a DiscountCurveFromForwardCurve will not recover the original curve since interpolation points may be lost.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DiscountCurveFromForwardCurve(ForwardCurveInterface forwardCurve)Create a discount curve using a given forward curve.DiscountCurveFromForwardCurve(ForwardCurveInterface forwardCurve, double periodLengthTimeScaling)Create a discount curve using a given forward curve.DiscountCurveFromForwardCurve(java.lang.String forwardCurveName)Create a discount curve using a given forward curve.DiscountCurveFromForwardCurve(java.lang.String forwardCurveName, double periodLengthTimeScaling)Create a discount curve using a given forward curve.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object obj)CurveBuilderInterfacegetCloneBuilder()Returns a curve builder bases on a clone of this curve.doublegetDiscountFactor(AnalyticModelInterface model, double maturity)Returns the discount factor for the corresponding maturity.doublegetDiscountFactor(double maturity)Returns the discount factor for the corresponding maturity.double[]getParameter()Get the current parameter associated with the state of the objects.doublegetValue(AnalyticModelInterface 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.inthashCode()voidsetParameter(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, getName, getReferenceDate, getValue, getValues, toString
-
Methods inherited from interface net.finmath.marketdata.model.curves.CurveInterface
clone, getCloneForParameter, getName, getReferenceDate, getValue
-
-
-
-
Constructor Detail
-
DiscountCurveFromForwardCurve
public DiscountCurveFromForwardCurve(java.lang.String forwardCurveName, double periodLengthTimeScaling)Create a discount curve using a given forward curve. The discount factors df(t) are defined at t = k * d for integers k via df(t+d) = df(t) / (1 + f(t) * d) and for t = k * d and 0 < r < d via df(t+r) = df(t) / (1 + f(t) * r) where d is a given the payment offset and f(t) is the forward curve.- Parameters:
forwardCurveName- The name of the forward curve used for calculation of the discount factors.periodLengthTimeScaling- A scaling factor applied to d, adjusting for the internal double time to the period length daycount fraction (note that this may only be an approximate solution to capture daycount effects).
-
DiscountCurveFromForwardCurve
public DiscountCurveFromForwardCurve(ForwardCurveInterface forwardCurve, double periodLengthTimeScaling)
Create a discount curve using a given forward curve. The discount factors df(t) are defined at t = k * d for integers k via df(t+d) = df(t) / (1 + f(t) * d) and for t = k * d and 0 < r < d via df(t+r) = df(t) / (1 + f(t) * r) where d is a given the payment offset and f(t) is the forward curve.- Parameters:
forwardCurve- The forward curve used for calculation of the discount factors.periodLengthTimeScaling- A scaling factor applied to d, adjusting for the internal double time to the period length daycount fraction (note that this may only be an approximate solution to capture daycount effects).
-
DiscountCurveFromForwardCurve
public DiscountCurveFromForwardCurve(java.lang.String forwardCurveName)
Create a discount curve using a given forward curve. The discount factors df(t) are defined at t = k * d for integers k via df(t+d) = df(t) / (1 + f(t) * d) and for t = k * d and 0 < r < d via df(t+r) = df(t) / (1 + f(t) * r) where d is a given the payment offset and f(t) is the forward curve.- Parameters:
forwardCurveName- The name of the forward curve used for calculation of the discount factors.
-
DiscountCurveFromForwardCurve
public DiscountCurveFromForwardCurve(ForwardCurveInterface forwardCurve)
Create a discount curve using a given forward curve. The discount factors df(t) are defined at t = k * d for integers k via df(t+d) = df(t) / (1 + f(t) * d) and for t = k * d and 0 < r < d via df(t+r) = df(t) / (1 + f(t) * r) where d is a given the payment offset and f(t) is the forward curve.- Parameters:
forwardCurve- The forward curve used for calculation of the discount factors.
-
-
Method Detail
-
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.
-
getValue
public double getValue(AnalyticModelInterface model, double time)
Description copied from interface:CurveInterfaceReturns 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:
getValuein interfaceCurveInterface- Parameters:
model- An analytic model providing a context.time- Time for which the value should be returned.- Returns:
- The value at the give time.
-
getParameter
public double[] getParameter()
Description copied from interface:ParameterObjectInterfaceGet the current parameter associated with the state of the objects.- Specified by:
getParameterin interfaceParameterObjectInterface- Returns:
- The parameter.
-
setParameter
public void setParameter(double[] parameter)
Description copied from interface:ParameterObjectInterfaceSet the current parameter and change the state of the objects.- Specified by:
setParameterin interfaceParameterObjectInterface- Parameters:
parameter- The parameter associated with the new state of the objects.
-
getCloneBuilder
public CurveBuilderInterface getCloneBuilder() throws java.lang.CloneNotSupportedException
Description copied from interface:CurveInterfaceReturns 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 interfaceCurveInterface- Returns:
- An object implementing the CurveBuilderInterface where the underlying curve is a clone of this curve.
- Throws:
java.lang.CloneNotSupportedException- Thrown, when this curve could not be cloned.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG