public virtual void test_filtered_exception_atEnd() { DummyFraCurveNode node1 = DummyFraCurveNode.of(Period.ofDays(5), GBP_LIBOR_1M, TICKER); DummyFraCurveNode node2 = DummyFraCurveNode.of(Period.ofDays(10), GBP_LIBOR_1M, TICKER); DummyFraCurveNode node3 = DummyFraCurveNode.of(Period.ofDays(11), GBP_LIBOR_1M, TICKER, EXCEPTION_2D); ImmutableList <DummyFraCurveNode> nodes = ImmutableList.of(node1, node2, node3); ParameterizedFunctionalCurveDefinition test = ParameterizedFunctionalCurveDefinition.builder().dayCount(ACT_365F).valueFunction(VALUE_FUNCTION).derivativeFunction(DERIVATIVE_FUNCTION).sensitivityFunction(SENSITIVITY_FUNCTION).initialGuess(INITIAL_PARAMS).name(CURVE_NAME).nodes(nodes).parameterMetadata(PARAM_METADATA).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).build(); assertThrowsIllegalArg(() => test.filtered(VAL_DATE, REF_DATA), "Curve node dates clash.*"); }
public virtual void test_filtered_dropOther_middle() { DummyFraCurveNode node1 = DummyFraCurveNode.of(Period.ofDays(3), GBP_LIBOR_1M, TICKER); DummyFraCurveNode node2 = DummyFraCurveNode.of(Period.ofDays(4), GBP_LIBOR_1M, TICKER, DROP_OTHER_2D); DummyFraCurveNode node3 = DummyFraCurveNode.of(Period.ofDays(11), GBP_LIBOR_1M, TICKER); ImmutableList <DummyFraCurveNode> nodes = ImmutableList.of(node1, node2, node3); ParameterizedFunctionalCurveDefinition test = ParameterizedFunctionalCurveDefinition.builder().dayCount(ACT_365F).valueFunction(VALUE_FUNCTION).derivativeFunction(DERIVATIVE_FUNCTION).sensitivityFunction(SENSITIVITY_FUNCTION).initialGuess(INITIAL_PARAMS).name(CURVE_NAME).nodes(nodes).parameterMetadata(PARAM_METADATA).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).build(); assertEquals(test.filtered(VAL_DATE, REF_DATA).Nodes, ImmutableList.of(node2, node3)); }
public virtual void test_filtered_exception_atEnd() { DummyFraCurveNode node1 = DummyFraCurveNode.of(Period.ofDays(5), GBP_LIBOR_1M, TICKER); DummyFraCurveNode node2 = DummyFraCurveNode.of(Period.ofDays(10), GBP_LIBOR_1M, TICKER); DummyFraCurveNode node3 = DummyFraCurveNode.of(Period.ofDays(11), GBP_LIBOR_1M, TICKER, EXCEPTION_2D); ImmutableList <DummyFraCurveNode> nodes = ImmutableList.of(node1, node2, node3); InterpolatedNodalCurveDefinition test = InterpolatedNodalCurveDefinition.builder().name(CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).nodes(nodes).interpolator(CurveInterpolators.LINEAR).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build(); assertThrowsIllegalArg(() => test.filtered(VAL_DATE, REF_DATA), "Curve node dates clash.*"); }
public virtual void test_filtered_dropOther_atStart() { DummyFraCurveNode node1 = DummyFraCurveNode.of(Period.ofDays(3), GBP_LIBOR_1M, TICKER, DROP_OTHER_2D); DummyFraCurveNode node2 = DummyFraCurveNode.of(Period.ofDays(4), GBP_LIBOR_1M, TICKER); DummyFraCurveNode node3 = DummyFraCurveNode.of(Period.ofDays(11), GBP_LIBOR_1M, TICKER); ImmutableList <DummyFraCurveNode> nodes = ImmutableList.of(node1, node2, node3); InterpolatedNodalCurveDefinition test = InterpolatedNodalCurveDefinition.builder().name(CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).nodes(nodes).interpolator(CurveInterpolators.LINEAR).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build(); assertEquals(test.filtered(VAL_DATE, REF_DATA).Nodes, ImmutableList.of(node1, node3)); }
//------------------------------------------------------------------------- public virtual void test_filtered() { DummyFraCurveNode node1 = DummyFraCurveNode.of(Period.ofDays(5), GBP_LIBOR_1M, GBP_LIBOR_1M_ID); DummyFraCurveNode node2 = DummyFraCurveNode.of(Period.ofDays(10), GBP_LIBOR_1M, GBP_LIBOR_1M_ID); DummyFraCurveNode node3 = DummyFraCurveNode.of(Period.ofDays(11), GBP_LIBOR_1M, GBP_LIBOR_1M_ID, DROP_THIS_2D); ImmutableList <DummyFraCurveNode> nodes = ImmutableList.of(node1, node2, node3); LocalDate valuationDate = date(2015, 6, 30); InterpolatedNodalCurveDefinition curveDefn = InterpolatedNodalCurveDefinition.builder().name(CURVE_NAME1).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).nodes(nodes).interpolator(CurveInterpolators.LINEAR).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build(); RatesCurveGroupDefinition test = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(curveDefn, GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).build(); RatesCurveGroupDefinition expected = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(curveDefn.filtered(valuationDate, REF_DATA), GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).build(); assertEquals(test.filtered(valuationDate, REF_DATA), expected); }