public final class ValueSchedule extends Object implements org.joda.beans.ImmutableBean, Serializable
This represents a single initial value and any adjustments over the lifetime of a trade. Adjustments may be specified in absolute or relative terms.
The adjustments may be specified as individual steps or as a sequence of steps. An individual step is a change that occurs at a specific date, identified either by the date or the index within the schedule. A sequence of steps consists of a start date, end date and frequency, with the same change applying many times. All changes must occur on dates that are period boundaries in the specified schedule.
It is possible to specify both individual steps and a sequence, however this is not recommended. It it is done, then the individual steps and sequence steps must resolve to different dates.
The value is specified as a double with the context adding additional meaning.
If the value represents an amount of money then the currency is specified separately.
If the value represents a rate then a 5% rate is expressed as 0.05.
| Modifier and Type | Class and Description |
|---|---|
static class |
ValueSchedule.Builder
The bean-builder for
ValueSchedule. |
static class |
ValueSchedule.Meta
The meta-bean for
ValueSchedule. |
| Modifier and Type | Field and Description |
|---|---|
static ValueSchedule |
ALWAYS_0
A value schedule that always has the value zero.
|
static ValueSchedule |
ALWAYS_1
A value schedule that always has the value one.
|
| Modifier and Type | Method and Description |
|---|---|
static ValueSchedule.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
boolean |
equals(Object obj) |
double |
getInitialValue()
Gets the initial value.
|
List<ValueStep> |
getSteps()
Gets the steps defining the change in the value.
|
Optional<ValueStepSequence> |
getStepSequence()
Gets the sequence of steps changing the value.
|
int |
hashCode() |
static ValueSchedule.Meta |
meta()
The meta-bean for
ValueSchedule. |
ValueSchedule.Meta |
metaBean() |
static ValueSchedule |
of(double value)
Obtains an instance from a single value that does not change over time.
|
static ValueSchedule |
of(double initialValue,
List<ValueStep> steps)
Obtains an instance from an initial value and a list of changes.
|
static ValueSchedule |
of(double initialValue,
ValueStep... steps)
Obtains an instance from an initial value and a list of changes.
|
static ValueSchedule |
of(double initialValue,
ValueStepSequence stepSequence)
Obtains an instance from an initial value and a sequence of steps.
|
DoubleArray |
resolveValues(Schedule schedule)
Resolves the value and adjustments against a specific schedule.
|
ValueSchedule.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
public static final ValueSchedule ALWAYS_0
public static final ValueSchedule ALWAYS_1
public static ValueSchedule of(double value)
value - a single value that does not change over timepublic static ValueSchedule of(double initialValue, ValueStep... steps)
Each step fully defines a single change in the value. The date of each change can be specified as an absolute date or in relative terms.
initialValue - the initial value used for the first periodsteps - the full definition of how the value changes over timepublic static ValueSchedule of(double initialValue, List<ValueStep> steps)
Each step fully defines a single change in the value. The date of each change can be specified as an absolute date or in relative terms.
initialValue - the initial value used for the first periodsteps - the full definition of how the value changes over timepublic static ValueSchedule of(double initialValue, ValueStepSequence stepSequence)
The sequence defines changes from one date to another date using a frequency. For example, the value might change every year from 2011-06-01 to 2015-06-01.
initialValue - the initial value used for the first periodstepSequence - the full definition of how the value changes over timepublic DoubleArray resolveValues(Schedule schedule)
This converts a schedule into a list of values, one for each schedule period.
schedule - the schedulepublic static ValueSchedule.Meta meta()
ValueSchedule.public static ValueSchedule.Builder builder()
public ValueSchedule.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic double getInitialValue()
This is used for the lifetime of the trade unless specifically varied.
public List<ValueStep> getSteps()
Each step consists of a key locating the date of the change and the adjustment that occurs.
public Optional<ValueStepSequence> getStepSequence()
This allows a regular pattern of steps to be encoded. All step dates must be unique, thus the list of steps must not contain any date implied by this sequence.
public ValueSchedule.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.