public class SeasonalCurve extends AbstractCurve implements Curve
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
CurveInterpolation.InterpolationMethod
with PIECEWISE_CONSTANT_RIGHTPOINT
.Modifier and Type | Class and Description |
---|---|
static class |
SeasonalCurve.Builder
A builder (following the builder pattern) for SeasonalCurve objects.
|
Constructor and Description |
---|
SeasonalCurve(String name,
LocalDate referenceDate,
Curve 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) |
SeasonalCurve.Builder |
getCloneBuilder()
Returns a curve builder bases on a clone of this curve.
|
Curve |
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(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.
|
void |
setParameter(double[] parameter)
Set the current parameter and change the state of the objects.
|
getName, getReferenceDate, getValue, getValues, toString
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName, getReferenceDate, getValue
public 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 double[] getParameter()
ParameterObject
getParameter
in interface ParameterObject
public void setParameter(double[] parameter)
ParameterObject
setParameter
in interface ParameterObject
parameter
- The parameter associated with the new state of the objects.public double getValue(AnalyticModel model, double time)
Curve
public Curve getCloneForParameter(double[] value) throws CloneNotSupportedException
ParameterObject
getCloneForParameter
in interface ParameterObject
getCloneForParameter
in interface Curve
getCloneForParameter
in class AbstractCurve
value
- The new parameter.CloneNotSupportedException
- Thrown, when the curve could not be cloned.public SeasonalCurve clone() throws CloneNotSupportedException
Curve
clone
in interface Curve
clone
in class AbstractCurve
CloneNotSupportedException
- Thrown, when the curve could not be cloned.public SeasonalCurve.Builder getCloneBuilder() throws CloneNotSupportedException
Curve
getCloneBuilder
in interface Curve
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)
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 © 2019. All rights reserved.