public class SeasonalCurve extends AbstractCurve implements CurveInterface
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.| Modifier and Type | Class and Description |
|---|---|
static class |
SeasonalCurve.CurveBuilder
A builder (following the builder pattern) for SeasonalCurve objects.
|
| 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.
|
| 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.
|
getName, getReferenceDate, getValue, getValues, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getReferenceDate, getValuepublic SeasonalCurve(String name, LocalDate referenceDate, Map<LocalDate,Double> indexFixings, int numberOfYearsToAverage)
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.public SeasonalCurve(String name, LocalDate referenceDate, CurveInterface baseCurve)
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.public double[] getParameter()
ParameterObjectInterfacegetParameter in interface ParameterObjectInterfacepublic void setParameter(double[] parameter)
ParameterObjectInterfacesetParameter in interface ParameterObjectInterfaceparameter - The parameter associated with the new state of the objects.public double getValue(AnalyticModelInterface model, double time)
CurveInterfacegetValue in interface CurveInterfacemodel - An analytic model providing a context.time - Time for which the value should be returned.public CurveInterface getCloneForParameter(double[] value) throws CloneNotSupportedException
ParameterObjectInterfacegetCloneForParameter in interface ParameterObjectInterfacegetCloneForParameter in interface CurveInterfacegetCloneForParameter in class AbstractCurvevalue - The new parameter.CloneNotSupportedException - Thrown, when the curve could not be cloned.public SeasonalCurve clone() throws CloneNotSupportedException
CurveInterfaceclone in interface CurveInterfaceclone in class AbstractCurveCloneNotSupportedException - Thrown, when the curve could not be cloned.public CurveBuilderInterface getCloneBuilder() throws CloneNotSupportedException
CurveInterfacegetCloneBuilder in interface CurveInterfaceCloneNotSupportedException - 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)
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.Copyright © 2017. All rights reserved.