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 classCurveParallelShifts.MetaThe meta-bean forCurveParallelShifts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CurveParallelShiftsabsolute(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.booleanequals(Object obj)Class<Curve>getMarketDataType()Returns the market data type that the perturbation changes.intgetScenarioCount()Returns the number of scenarios for which this perturbation generates data.DoubleArraygetShiftAmounts()Gets the amount by which the y-values are shifted.ShiftTypegetShiftType()Gets the type of shift to apply to the y-values of the curve.inthashCode()static CurveParallelShifts.Metameta()The meta-bean forCurveParallelShifts.CurveParallelShifts.MetametaBean()static CurveParallelShiftsrelative(double... shiftAmounts)Creates a shift that multiplies the values at each curve node by a scaling factor.StringtoString()
-
-
-
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:ScenarioPerturbationApplies 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:
applyToin 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:ScenarioPerturbationReturns the number of scenarios for which this perturbation generates data.- Specified by:
getScenarioCountin interfaceScenarioPerturbation<Curve>- Returns:
- the number of scenarios for which this perturbation generates data
-
getMarketDataType
public Class<Curve> getMarketDataType()
Description copied from interface:ScenarioPerturbationReturns the market data type that the perturbation changes.- Specified by:
getMarketDataTypein 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:
metaBeanin 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
-
-