//-------------------------------------------------------------------------
        public virtual void coverage()
        {
            CurveParallelShifts test = CurveParallelShifts.absolute(1d, 2d, 4d);

            coverImmutableBean(test);
            CurveParallelShifts test2 = CurveParallelShifts.relative(2d, 3d, 4d);

            coverBeanEquals(test, test2);
        }
        public virtual void test_relative()
        {
            CurveParallelShifts test = CurveParallelShifts.relative(0.1d, 0.2d, 0.4d);

            Curve baseCurve = InterpolatedNodalCurve.of(Curves.zeroRates("curve", DayCounts.ACT_365F), DoubleArray.of(1, 2, 3), DoubleArray.of(5, 6, 7), CurveInterpolators.LOG_LINEAR);

            MarketDataBox <Curve> shiftedCurveBox = test.applyTo(MarketDataBox.ofSingleValue(baseCurve), REF_DATA);

            assertEquals(shiftedCurveBox.getValue(0), ParallelShiftedCurve.relative(baseCurve, 0.1d));
            assertEquals(shiftedCurveBox.getValue(1), ParallelShiftedCurve.relative(baseCurve, 0.2d));
            assertEquals(shiftedCurveBox.getValue(2), ParallelShiftedCurve.relative(baseCurve, 0.4d));
        }
示例#3
0
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         CurveParallelShifts other = (CurveParallelShifts)obj;
         return(JodaBeanUtils.equal(shiftType, other.shiftType) && JodaBeanUtils.equal(shiftAmounts, other.shiftAmounts));
     }
     return(false);
 }