public virtual void test_createSabrParameterMetadata() { SabrIborCapletFloorletVolatilityBootstrapDefinition @base = SabrIborCapletFloorletVolatilityBootstrapDefinition.ofFixedBeta(NAME, USD_LIBOR_3M, ACT_ACT_ISDA, 0.5, LINEAR, FLAT, FLAT, SabrVolatilityFormula.hagan()); ImmutableList <CurveMetadata> expected = ImmutableList.of(Curves.sabrParameterByExpiry(NAME.Name + "-Alpha", ACT_ACT_ISDA, SABR_ALPHA), Curves.sabrParameterByExpiry(NAME.Name + "-Beta", ACT_ACT_ISDA, SABR_BETA), Curves.sabrParameterByExpiry(NAME.Name + "-Rho", ACT_ACT_ISDA, SABR_RHO), Curves.sabrParameterByExpiry(NAME.Name + "-Nu", ACT_ACT_ISDA, SABR_NU)); ImmutableList <CurveMetadata> computed = @base.createSabrParameterMetadata(); assertEquals(computed, expected); }
public virtual void test_ofFixedBeta_shift() { SabrIborCapletFloorletVolatilityBootstrapDefinition test = SabrIborCapletFloorletVolatilityBootstrapDefinition.ofFixedBeta(NAME, USD_LIBOR_3M, ACT_ACT_ISDA, 0.5, 0.01, LINEAR, FLAT, FLAT, SabrVolatilityFormula.hagan()); assertEquals(test.DayCount, ACT_ACT_ISDA); assertEquals(test.Index, USD_LIBOR_3M); assertEquals(test.Interpolator, LINEAR); assertEquals(test.ExtrapolatorLeft, FLAT); assertEquals(test.ExtrapolatorRight, FLAT); assertEquals(test.Name, NAME); assertEquals(test.BetaCurve.get(), ConstantCurve.of(Curves.sabrParameterByExpiry(NAME.Name + "-Beta", ACT_ACT_ISDA, SABR_BETA), 0.5)); assertFalse(test.RhoCurve.Present); assertEquals(test.SabrVolatilityFormula, SabrVolatilityFormula.hagan()); assertEquals(test.ShiftCurve, ConstantCurve.of("Shift curve", 0.01)); }
public virtual void test_builder() { Curve betaCurve = ConstantCurve.of(Curves.sabrParameterByExpiry(NAME.Name + "-Beta", ACT_ACT_ISDA, SABR_BETA), 0.65); SabrIborCapletFloorletVolatilityBootstrapDefinition test = SabrIborCapletFloorletVolatilityBootstrapDefinition.builder().index(USD_LIBOR_3M).name(NAME).interpolator(LINEAR).extrapolatorLeft(FLAT).extrapolatorRight(CurveExtrapolators.LINEAR).dayCount(ACT_ACT_ISDA).sabrVolatilityFormula(SabrVolatilityFormula.hagan()).betaCurve(betaCurve).build(); assertEquals(test.DayCount, ACT_ACT_ISDA); assertEquals(test.Index, USD_LIBOR_3M); assertEquals(test.Interpolator, LINEAR); assertEquals(test.ExtrapolatorLeft, FLAT); assertEquals(test.ExtrapolatorRight, CurveExtrapolators.LINEAR); assertEquals(test.Name, NAME); assertEquals(test.BetaCurve.get(), betaCurve); assertFalse(test.RhoCurve.Present); assertEquals(test.SabrVolatilityFormula, SabrVolatilityFormula.hagan()); assertEquals(test.ShiftCurve, ConstantCurve.of("Zero shift", 0d)); }