Module net.finmath.lib
Class ForwardCurveFromDiscountCurve
java.lang.Object
net.finmath.marketdata.model.curves.AbstractCurve
net.finmath.marketdata.model.curves.CurveInterpolation
net.finmath.marketdata.model.curves.AbstractForwardCurve
net.finmath.marketdata.model.curves.ForwardCurveFromDiscountCurve
- All Implemented Interfaces:
Serializable
,Cloneable
,ParameterObject
,Curve
,ForwardCurve
A forward curve derived from a given discount curve.
The forward with fixing in \( t \) is calculated as
\(
(\frac{1}{dcf(t,t+d)} ( \frac{df(t)}{df(t+d)}-1 )
\)
where \( dcf(t,t+d) \) is the daycount-fraction between t and t+d and \( t \mapsto df(t) \) is the given referenceDiscountCurveNameForForwardCurve.
The payment offset \( t+d \) is either generated from the paymentOffsetCode or directly specified if paymentOffsetCode=NaN.
The referenceDiscountCurveNameForForwardCurve is referenced by name and evaluated late (which allows use of
this construct in a calibration process referencing changing discount curves.
- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class net.finmath.marketdata.model.curves.CurveInterpolation
CurveInterpolation.Builder, CurveInterpolation.ExtrapolationMethod, CurveInterpolation.InterpolationEntity, CurveInterpolation.InterpolationMethod, CurveInterpolation.Point
-
Constructor Summary
ConstructorsConstructorDescriptionForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, String discountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention, double daycountScaling, double periodOffset)
Create a forward curve using a given referenceDiscountCurveForForwards.ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, String discountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention, DayCountConvention daycountConvention, double periodOffset)
Create a forward curve using a given referenceDiscountCurveForForwards.ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode)
Create a forward curve using a given referenceDiscountCurveForForwards.ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention)
Create a forward curve using a given referenceDiscountCurveForForwards.ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention, double daycountScaling, double periodOffset)
Create a forward curve using a given referenceDiscountCurveForForwards.ForwardCurveFromDiscountCurve(String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode)
Create a forward curve using a given referenceDiscountCurveForForwards. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getForward(AnalyticModel model, double fixingTime)
Returns the forward for the corresponding fixing time.double
getForward(AnalyticModel model, double fixingTime, double paymentOffset)
Returns the forward for the corresponding fixing time and paymentOffset.double[]
Get the current parameter associated with the state of the objects.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.toString()
Methods inherited from class net.finmath.marketdata.model.curves.AbstractForwardCurve
getDiscountCurveName, getForwards, getPaymentBusinessdayCalendar, getPaymentDateRollConvention, getPaymentOffset, getPaymentOffsetCode
Methods inherited from class net.finmath.marketdata.model.curves.CurveInterpolation
addPoint, clone, getCloneBuilder, getCloneForParameter, getExtrapolationMethod, getInterpolationEntity, getInterpolationMethod, getParameterIndex, getPoints, getTimeIndex, getTimes, setParameter
Methods inherited from class net.finmath.marketdata.model.curves.AbstractCurve
getName, getReferenceDate, 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
clone, getCloneBuilder, getCloneForParameter, getName, getReferenceDate
Methods inherited from interface net.finmath.marketdata.calibration.ParameterObject
setParameter
-
Constructor Details
-
ForwardCurveFromDiscountCurve
public ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, String discountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention, DayCountConvention daycountConvention, double periodOffset)Create a forward curve using a given referenceDiscountCurveForForwards.- Parameters:
name
- The name under which the forward curve can be referenced.referenceDiscountCurveName
- The (pseudo-)discount curve that the forwards are calculated from.discountCurveName
- The name of the discount curve associated with this forward curve (usually OIS).referenceDate
- The reference date used in the interpretation of times (i.e., the referenceDate where t=0).paymentOffsetCode
- The payment offset. If null, the parameter p has to be provided to the getForward method.paymentOffsetBusinessdayCalendar
- The calendar used to generate the payment date from the paymentOffetCode.paymentOffsetDateRollConvention
- The date roll convention used to generate the payment date from the paymentOffsetCode.daycountConvention
- The daycount convention \( dcf(t,t+d) \) use the time-scale the performance ratio derived from the discount factors.periodOffset
- An offset in ACT/365 applied to the fixing to construct the period start (the negative of the fixingOffset of the period).
-
ForwardCurveFromDiscountCurve
public ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, String discountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention, double daycountScaling, double periodOffset)Create a forward curve using a given referenceDiscountCurveForForwards.- Parameters:
name
- The name under which the forward curve can be referenced.referenceDiscountCurveName
- The (pseudo-)discount curve that the forwards are calculated from.discountCurveName
- The name of the discount curve associated with this forward curve (usually OIS).referenceDate
- The reference date used in the interpretation of times (i.e., the referenceDate where t=0).paymentOffsetCode
- The payment offset. If null, the parameter p has to be provided to the getForward method.paymentOffsetBusinessdayCalendar
- The calendar used to generate the payment date from the paymentOffetCode.paymentOffsetDateRollConvention
- The date roll convention used to generate the payment date from the paymentOffsetCode.daycountScaling
- The scaling factor applied to the paymentOffset measured in ACT/365.periodOffset
- An offset in ACT/365 applied to the fixing to construct the period start (the negative of the fixingOffset of the period).
-
ForwardCurveFromDiscountCurve
public ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention, double daycountScaling, double periodOffset)Create a forward curve using a given referenceDiscountCurveForForwards. Note that the referenceDiscountCurveForForwards is also used as the discount curve associated with the forwards (i.e. single curve).- Parameters:
name
- The name under which the forward curve can be referenced.referenceDiscountCurveName
- The (pseudo-)discount curve that the forwards are calculated from.referenceDate
- The reference date used in the interpretation of times (i.e., the referenceDate where t=0).paymentOffsetCode
- The payment offset. If null, the parameter p has to be provided to the getForward method.paymentOffsetBusinessdayCalendar
- The calendar used to generate the payment date from the paymentOffetCode.paymentOffsetDateRollConvention
- The date roll convention used to generate the payment date from the paymentOffsetCode.daycountScaling
- The scaling factor applied to the paymentOffset measured in ACT/365.periodOffset
- An offset in ACT/365 applied to the fixing to construct the period start (the negative of the fixingOffset of the period).
-
ForwardCurveFromDiscountCurve
public ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentOffsetBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentOffsetDateRollConvention)Create a forward curve using a given referenceDiscountCurveForForwards. Note that the referenceDiscountCurveForForwards is also used as the discount curve associated with the forwards (i.e. single curve).- Parameters:
name
- The name under which the forward curve can be referenced.referenceDiscountCurveName
- The (pseudo-)discount curve that the forwards are calculated from.referenceDate
- The reference date used in the interpretation of times (i.e., the referenceDate where t=0).paymentOffsetCode
- The payment offset. If null, the parameter p has to be provided to the getForward method.paymentOffsetBusinessdayCalendar
- The calendar used to generate the payment date from the paymentOffetCode.paymentOffsetDateRollConvention
- The date roll convention used to generate the payment date from the paymentOffsetCode.
-
ForwardCurveFromDiscountCurve
public ForwardCurveFromDiscountCurve(String name, String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode)Create a forward curve using a given referenceDiscountCurveForForwards. Note that the referenceDiscountCurveForForwards is also used as the discount curve associated with the forwards (i.e. single curve).- Parameters:
name
- The name under which the forward curve can be referenced.referenceDiscountCurveName
- The (pseudo-)discount curve that the forwards are calculated from.referenceDate
- The reference date used in the interpretation of times (i.e., the referenceDate where t=0).paymentOffsetCode
- The payment offset. If null, the parameter p has to be provided to the getForward method.
-
ForwardCurveFromDiscountCurve
public ForwardCurveFromDiscountCurve(String referenceDiscountCurveName, LocalDate referenceDate, String paymentOffsetCode)Create a forward curve using a given referenceDiscountCurveForForwards. Note that the referenceDiscountCurveForForwards is also used as the discount curve associated with the forwards (i.e. single curve). The name of the this forward curve will be"ForwardCurveFromDiscountCurve(" + referenceDiscountCurveName + "," + paymentOffsetCode + ")",
but code should not reply on this. Instead you should use getName() to get the name of the curve.- Parameters:
referenceDiscountCurveName
- The (pseudo-)discount curve that the forwards are calculated from.referenceDate
- The reference date used in the interpretation of times (i.e., the referenceDate where t=0).paymentOffsetCode
- The payment offset. If null, the parameter p has to be provided to the getForward method.
-
-
Method Details
-
getForward
Description copied from interface:ForwardCurve
Returns the forward for the corresponding fixing time.- Specified by:
getForward
in interfaceForwardCurve
- Parameters:
model
- An analytic model providing a context. Some curves do not need this (can be null).fixingTime
- The fixing time of the index associated with this forward curve.- Returns:
- The forward.
-
getForward
Description copied from interface:ForwardCurve
Returns the forward for the corresponding fixing time and paymentOffset.- Specified by:
getForward
in interfaceForwardCurve
- Parameters:
model
- An analytic model providing a context. Some curves do not need this (can be null).fixingTime
- The fixing time of the index associated with this forward curve.paymentOffset
- The payment offset (as internal day count fraction) specifying the payment of this index. Used only as a fallback and/or consistency check.- Returns:
- The forward.
-
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 classCurveInterpolation
- Parameters:
time
- Time for which the value should be returned.- Returns:
- The value at the give time.
-
getValue
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 interfaceCurve
- Overrides:
getValue
in classCurveInterpolation
- 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:ParameterObject
Get the current parameter associated with the state of the objects.- Specified by:
getParameter
in interfaceParameterObject
- Overrides:
getParameter
in classCurveInterpolation
- Returns:
- The parameter.
-
toString
- Overrides:
toString
in classAbstractForwardCurve
-