//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ImmutablePreBuild private static void preBuild(Builder builder) private static void preBuild(Builder builder) { if (builder.name_Renamed == null && builder.surface_Renamed != null) { builder.name_Renamed = FxOptionVolatilitiesName.of(builder.surface_Renamed.Name.Name); } }
public virtual void test_of_object() { FxOptionVolatilitiesId test = FxOptionVolatilitiesId.of(FxOptionVolatilitiesName.of("Foo")); assertEquals(test.Name, FxOptionVolatilitiesName.of("Foo")); assertEquals(test.MarketDataType, typeof(FxOptionVolatilities)); assertEquals(test.MarketDataName, FxOptionVolatilitiesName.of("Foo")); }
public virtual void test_of() { FxOptionVolatilitiesName test = FxOptionVolatilitiesName.of("Foo"); assertEquals(test.Name, "Foo"); assertEquals(test.MarketDataType, typeof(FxOptionVolatilities)); assertEquals(test.ToString(), "Foo"); assertEquals(test.CompareTo(FxOptionVolatilitiesName.of("Goo")) < 0, true); }
//------------------------------------------------------------------------- public virtual void coverage() { BlackFxOptionSmileVolatilities test1 = BlackFxOptionSmileVolatilities.of(NAME, CURRENCY_PAIR, VAL_DATE_TIME, SMILE_TERM); coverImmutableBean(test1); BlackFxOptionSmileVolatilities test2 = BlackFxOptionSmileVolatilities.of(FxOptionVolatilitiesName.of("Boo"), CURRENCY_PAIR.inverse(), ZonedDateTime.of(2015, 12, 21, 11, 15, 0, 0, ZoneId.of("Z")), SMILE_TERM); coverBeanEquals(test1, test2); }
//------------------------------------------------------------------------- public virtual void test_builder() { BlackFxOptionFlatVolatilities test = BlackFxOptionFlatVolatilities.builder().currencyPair(CURRENCY_PAIR).curve(CURVE).valuationDateTime(VAL_DATE_TIME).build(); assertEquals(test.ValuationDateTime, VAL_DATE_TIME); assertEquals(test.CurrencyPair, CURRENCY_PAIR); assertEquals(test.Name, FxOptionVolatilitiesName.of(CURVE.Name.Name)); assertEquals(test.Curve, CURVE); assertEquals(VOLS, test); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an identifier used to find FX option volatilities. /// </summary> /// <param name="name"> the name </param> /// <returns> an identifier for the volatilities </returns> public static FxOptionVolatilitiesId of(string name) { return(new FxOptionVolatilitiesId(FxOptionVolatilitiesName.of(name))); }
private readonly DayCount dayCount; // cached, not a property //------------------------------------------------------------------------- /// <summary> /// Obtains an instance from the implied volatility surface and the date-time for which it is valid. /// <para> /// {@code FxOptionVolatilitiesName} is built from the name in {@code Surface}. /// </para> /// <para> /// The surface is specified by an instance of <seealso cref="Surface"/>, such as <seealso cref="InterpolatedNodalSurface"/>. /// The surface must contain the correct metadata: /// <ul> /// <li>The x-value type must be <seealso cref="ValueType#YEAR_FRACTION"/> /// <li>The y-value type must be <seealso cref="ValueType#STRIKE"/> /// <li>The z-value type must be <seealso cref="ValueType#BLACK_VOLATILITY"/> /// <li>The day count must be set in the additional information using <seealso cref="SurfaceInfoType#DAY_COUNT"/> /// </ul> /// Suitable surface metadata can be created using /// <seealso cref="Surfaces#blackVolatilityByExpiryStrike(String, DayCount)"/>. /// /// </para> /// </summary> /// <param name="currencyPair"> the currency pair </param> /// <param name="valuationDateTime"> the valuation date-time </param> /// <param name="surface"> the volatility surface </param> /// <returns> the volatilities </returns> public static BlackFxOptionSurfaceVolatilities of(CurrencyPair currencyPair, ZonedDateTime valuationDateTime, Surface surface) { FxOptionVolatilitiesName name = FxOptionVolatilitiesName.of(surface.Name.Name); return(of(name, currencyPair, valuationDateTime, surface)); }