public virtual void test_of() { FxOptionVolatilitiesDefinition test = FxOptionVolatilitiesDefinition.of(SPEC); assertEquals(test.Specification, SPEC); assertEquals(test.ParameterCount, SPEC.ParameterCount); assertEquals(test.volatilitiesInputs(), SPEC.volatilitiesInputs()); ZonedDateTime dateTime = LocalDate.of(2017, 9, 25).atStartOfDay().atZone(ZoneId.of("Europe/London")); DoubleArray parameters = DoubleArray.of(0.05, -0.05, 0.15, 0.25, 0.1, -0.1); assertEquals(test.volatilities(dateTime, parameters, REF_DATA), SPEC.volatilities(dateTime, parameters, REF_DATA)); }
public virtual void test_builder() { BlackFxOptionSmileVolatilitiesSpecification test = BlackFxOptionSmileVolatilitiesSpecification.builder().name(VOL_NAME).currencyPair(EUR_GBP).dayCount(ACT_360).nodes(NODES).timeInterpolator(PCHIP).timeExtrapolatorLeft(LINEAR).timeExtrapolatorRight(FLAT).strikeInterpolator(DOUBLE_QUADRATIC).strikeExtrapolatorLeft(FLAT).strikeExtrapolatorRight(LINEAR).build(); assertEquals(test.CurrencyPair, EUR_GBP); assertEquals(test.DayCount, ACT_360); assertEquals(test.Name, VOL_NAME); assertEquals(test.Nodes, NODES); assertEquals(test.ParameterCount, TENORS.size()); assertEquals(test.StrikeInterpolator, DOUBLE_QUADRATIC); assertEquals(test.StrikeExtrapolatorLeft, FLAT); assertEquals(test.StrikeExtrapolatorRight, LINEAR); assertEquals(test.TimeInterpolator, PCHIP); assertEquals(test.TimeExtrapolatorLeft, LINEAR); assertEquals(test.TimeExtrapolatorRight, FLAT); assertEquals(test.volatilitiesInputs(), QUOTE_IDS); }