public virtual void test_bind_no_seasonality() { RatesCurveGroupDefinition test = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(CURVE_DEFN1, GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).addForwardCurve(CURVE_DEFN_I, GB_RPI).build(); LocalDate valuationDate = LocalDate.of(2015, 11, 10); LocalDate lastFixingDate = LocalDate.of(2015, 10, 31); LocalDate otherFixingDate = LocalDate.of(2015, 9, 30); double lastFixingValue = 234.56; IDictionary <Index, LocalDateDoubleTimeSeries> map = ImmutableMap.of(GB_RPI, LocalDateDoubleTimeSeries.builder().put(lastFixingDate, 234.56).put(otherFixingDate, lastFixingValue - 1).build()); RatesCurveGroupDefinition testBound = test.bindTimeSeries(valuationDate, map); IList <CurveDefinition> list = testBound.CurveDefinitions; assertEquals(list.Count, 2); assertTrue(list[0] is InterpolatedNodalCurveDefinition); assertTrue(list[1] is InflationNodalCurveDefinition); InflationNodalCurveDefinition seasonDef = (InflationNodalCurveDefinition)list[1]; assertEquals(seasonDef.CurveWithoutFixingDefinition, CURVE_DEFN_I); assertEquals(seasonDef.LastFixingMonth, YearMonth.from(lastFixingDate)); assertEquals(seasonDef.LastFixingValue, lastFixingValue); assertEquals(seasonDef.Name, CURVE_NAME_I); assertEquals(seasonDef.YValueType, ValueType.PRICE_INDEX); // Check the default assertTrue(seasonDef.SeasonalityDefinition.SeasonalityMonthOnMonth.equalWithTolerance(DoubleArray.filled(12, 1d), 1.0E-10)); assertEquals(seasonDef.SeasonalityDefinition.AdjustmentType, ShiftType.SCALED); }
//------------------------------------------------------------------------- public virtual void test_bind() { RatesCurveGroupDefinition test = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(CURVE_DEFN1, GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).addForwardCurve(CURVE_DEFN_I, GB_RPI).addSeasonality(CURVE_NAME_I, SEASONALITY_ADDITIVE_DEF).build(); LocalDate valuationDate = LocalDate.of(2015, 11, 10); LocalDate lastFixingDate = LocalDate.of(2015, 10, 31); LocalDate otherFixingDate = LocalDate.of(2015, 9, 30); double lastFixingValue = 234.56; IDictionary <Index, LocalDateDoubleTimeSeries> map = ImmutableMap.of(GB_RPI, LocalDateDoubleTimeSeries.builder().put(lastFixingDate, 234.56).put(otherFixingDate, lastFixingValue - 1).build()); RatesCurveGroupDefinition testBound = test.bindTimeSeries(valuationDate, map); IList <CurveDefinition> list = testBound.CurveDefinitions; assertEquals(list.Count, 2); assertTrue(list[0] is InterpolatedNodalCurveDefinition); assertTrue(list[1] is InflationNodalCurveDefinition); InflationNodalCurveDefinition seasonDef = (InflationNodalCurveDefinition)list[1]; assertEquals(seasonDef.CurveWithoutFixingDefinition, CURVE_DEFN_I); assertEquals(seasonDef.LastFixingMonth, YearMonth.from(lastFixingDate)); assertEquals(seasonDef.LastFixingValue, lastFixingValue); assertEquals(seasonDef.Name, CURVE_NAME_I); assertEquals(seasonDef.SeasonalityDefinition, SEASONALITY_ADDITIVE_DEF); assertEquals(seasonDef.YValueType, ValueType.PRICE_INDEX); }