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

## Class SeasonalCurve

• All Implemented Interfaces:
Serializable, Cloneable, ParameterObjectInterface, CurveInterface

public class SeasonalCurve
extends AbstractCurve
implements CurveInterface
The curve returns a value depending on the month of the time argument, that is, a call getValue(model, time) will map time to a 30/360 value using the day and month only and delegate the call to a given base curve. The value returned then is baseCurve.getValue(model, season) where season = (month-1) / 12.0 + (day-1) / (double)numberOfDays / 12.0; The base curve has to be constructed according to this time convention (e.g., as a piecewise constant curve with values at i / 12 for i=1,...,12 using Curve.InterpolationMethod with PIECEWISE_CONSTANT_RIGHTPOINT.
Author:
Christian Fries
Serialized Form
• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
static class  SeasonalCurve.CurveBuilder
A builder (following the builder pattern) for SeasonalCurve objects.
• ### Constructor Summary

Constructors
Constructor and Description
SeasonalCurve(String name, LocalDate referenceDate, CurveInterface baseCurve)
SeasonalCurve(String name, LocalDate referenceDate, Map<LocalDate,Double> indexFixings, int numberOfYearsToAverage)
Create a monthly seasonality adjustment curve by estimating historic log-returns from monthly index fixings.
• ### Method Summary

All Methods
Modifier and Type Method and Description
SeasonalCurve clone()
Create a deep copied clone.
static double[] computeSeasonalAdjustments(double[] realizedCPIValues, int lastMonth, int numberOfYearsToAverage)
Computes annualized seasonal adjustments from given monthly realized CPI values.
static double[] computeSeasonalAdjustments(LocalDate referenceDate, Map<LocalDate,Double> indexFixings, int numberOfYearsToAverage)
CurveBuilderInterface getCloneBuilder()
Returns a curve builder bases on a clone of this curve.
CurveInterface getCloneForParameter(double[] value)
Create a clone with a modified parameter.
double[] getParameter()
Get the current parameter associated with the state of the objects.
double getValue(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.
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

getName, getReferenceDate, getValue, getValues, toString
• ### 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.CurveInterface

getName, getReferenceDate, getValue
• ### Constructor Detail

• #### SeasonalCurve

public SeasonalCurve(String name,
LocalDate referenceDate,
Map<LocalDate,Double> indexFixings,
int numberOfYearsToAverage)
Create a monthly seasonality adjustment curve by estimating historic log-returns from monthly index fixings.
Parameters:
name - The name of this curve.
referenceDate - The reference date for this curve (i.e. t=0).
indexFixings - A Map<Date, Double> of consecutive monthly index fixings.
numberOfYearsToAverage - The number of years over which monthly log returns should be averaged.
• #### SeasonalCurve

public SeasonalCurve(String name,
LocalDate referenceDate,
CurveInterface baseCurve)
Parameters:
name - The name of this curve.
referenceDate - The reference date for this curve (i.e. t=0).
baseCurve - The base curve, i.e., the discount curve used to calculate the seasonal adjustment factors.
• ### Method Detail

• #### getParameter

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

public void setParameter(double[] parameter)
Description copied from interface: ParameterObjectInterface
Set the current parameter and change the state of the objects.
Specified by:
setParameter in interface ParameterObjectInterface
Parameters:
parameter - The parameter associated with the new state of the objects.
• #### getValue

public double getValue(AnalyticModelInterface model,
double time)
Description copied from interface: CurveInterface
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 CurveInterface
Parameters:
model - An analytic model providing a context.
time - Time for which the value should be returned.
Returns:
The value at the give time.
• #### getCloneForParameter

public CurveInterface getCloneForParameter(double[] value)
throws CloneNotSupportedException
Description copied from interface: ParameterObjectInterface
Create a clone with a modified parameter.
Specified by:
getCloneForParameter in interface ParameterObjectInterface
Specified by:
getCloneForParameter in interface CurveInterface
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.
• #### clone

public SeasonalCurve clone()
throws CloneNotSupportedException
Description copied from interface: CurveInterface
Create a deep copied clone.
Specified by:
clone in interface CurveInterface
Overrides:
clone in class AbstractCurve
Returns:
A clone (deep copied).
Throws:
CloneNotSupportedException - Thrown, when the curve could not be cloned.
• #### getCloneBuilder

public CurveBuilderInterface getCloneBuilder()
throws CloneNotSupportedException
Description copied from interface: CurveInterface
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 CurveInterface
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.

public static double[] computeSeasonalAdjustments(LocalDate referenceDate,
Map<LocalDate,Double> indexFixings,
int numberOfYearsToAverage)

public static double[] computeSeasonalAdjustments(double[] realizedCPIValues,
int lastMonth,
int numberOfYearsToAverage)
Computes annualized seasonal adjustments from given monthly realized CPI values.
Parameters:
realizedCPIValues - An array of consecutive monthly CPI values (minimum size is 12*numberOfYearsToAverage))
lastMonth - The index of the last month in the sequence of realizedCPIValues (corresponding to the enums in Month).
numberOfYearsToAverage - The number of years to go back in the array of realizedCPIValues.
Returns:
Array of annualized seasonal adjustments, where [0] corresponds to the adjustment for from December to January.