Class 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
    • 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 interface ScenarioPerturbation<Curve>
        Parameters:
        curve - the market data to perturb
        refData - 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 interface ScenarioPerturbation<Curve>
        Returns:
        the number of scenarios for which this perturbation generates data
      • meta

        public static CurveParallelShifts.Meta meta()
        The meta-bean for CurveParallelShifts.
        Returns:
        the meta-bean, not null
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object