Class CurveParallelShifts
- java.lang.Object
-
- com.opengamma.strata.market.curve.CurveParallelShifts
-
- All Implemented Interfaces:
ScenarioPerturbation<Curve>
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class CurveParallelShifts extends Object implements ScenarioPerturbation<Curve>, org.joda.beans.ImmutableBean, Serializable
Perturbation which applies a parallel shift to a curve.The shift can be absolute or relative. An absolute shift adds the shift amount to each point on the curve. A relative shift applies a scaling to each point on the curve.
For example, a relative shift of 0.1 (10%) multiplies each value on the curve by 1.1, and a shift of -0.2 (-20%) multiplies the value by 0.8. So for relative shifts the shifted value is
(value x (1 + shift))
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CurveParallelShifts.Meta
The meta-bean forCurveParallelShifts
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CurveParallelShifts
absolute(double... shiftAmounts)
Creates a shift that adds a fixed amount to the value at every node in the curve.MarketDataBox<Curve>
applyTo(MarketDataBox<Curve> curve, ReferenceData refData)
Applies this perturbation to the market data in a box, returning a box containing new, modified data.boolean
equals(Object obj)
Class<Curve>
getMarketDataType()
Returns the market data type that the perturbation changes.int
getScenarioCount()
Returns the number of scenarios for which this perturbation generates data.DoubleArray
getShiftAmounts()
Gets the amount by which the y-values are shifted.ShiftType
getShiftType()
Gets the type of shift to apply to the y-values of the curve.int
hashCode()
static CurveParallelShifts.Meta
meta()
The meta-bean forCurveParallelShifts
.CurveParallelShifts.Meta
metaBean()
static CurveParallelShifts
relative(double... shiftAmounts)
Creates a shift that multiplies the values at each curve node by a scaling factor.String
toString()
-
-
-
Method Detail
-
absolute
public static CurveParallelShifts absolute(double... shiftAmounts)
Creates a shift that adds a fixed amount to the value at every node in the curve.- Parameters:
shiftAmounts
- the amount to add to each node value in the curve- Returns:
- a shift that adds a fixed amount to the value at every node in the curve
-
relative
public static CurveParallelShifts relative(double... shiftAmounts)
Creates a shift that multiplies the values at each curve node by a scaling factor.The shift amount is a decimal percentage. For example, a shift amount of 0.1 is a shift of +10% which multiplies the value by 1.1. A shift amount of -0.2 is a shift of -20% which multiplies the value by 0.8.
- Parameters:
shiftAmounts
- the factor to multiply the value at each curve node by- Returns:
- a shift that multiplies the values at each curve node by a scaling factor
-
applyTo
public MarketDataBox<Curve> applyTo(MarketDataBox<Curve> curve, ReferenceData refData)
Description copied from interface:ScenarioPerturbation
Applies this perturbation to the market data in a box, returning a box containing new, modified data.The original market data must not be altered. Instead a perturbed copy must be returned.
- Specified by:
applyTo
in interfaceScenarioPerturbation<Curve>
- Parameters:
curve
- the market data to perturbrefData
- the reference data- Returns:
- new market data derived by applying the perturbation to the input data
-
getScenarioCount
public int getScenarioCount()
Description copied from interface:ScenarioPerturbation
Returns the number of scenarios for which this perturbation generates data.- Specified by:
getScenarioCount
in interfaceScenarioPerturbation<Curve>
- Returns:
- the number of scenarios for which this perturbation generates data
-
getMarketDataType
public Class<Curve> getMarketDataType()
Description copied from interface:ScenarioPerturbation
Returns the market data type that the perturbation changes.- Specified by:
getMarketDataType
in interfaceScenarioPerturbation<Curve>
- Returns:
- the data type
-
meta
public static CurveParallelShifts.Meta meta()
The meta-bean forCurveParallelShifts
.- Returns:
- the meta-bean, not null
-
metaBean
public CurveParallelShifts.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getShiftType
public ShiftType getShiftType()
Gets the type of shift to apply to the y-values of the curve.- Returns:
- the value of the property, not null
-
getShiftAmounts
public DoubleArray getShiftAmounts()
Gets the amount by which the y-values are shifted.- Returns:
- the value of the property, not null
-
-