public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3373707:         // name
                    this.name_Renamed = (FxOptionVolatilitiesName)newValue;
                    break;

                case 1005147787:         // currencyPair
                    this.currencyPair_Renamed = (CurrencyPair)newValue;
                    break;

                case -949589828:         // valuationDateTime
                    this.valuationDateTime_Renamed = (ZonedDateTime)newValue;
                    break;

                case 109556488:         // smile
                    this.smile_Renamed = (SmileDeltaTermStructure)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Beispiel #2
0
//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);
            }
        }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(BlackFxOptionSmileVolatilities beanToCopy)
 {
     this.name_Renamed              = beanToCopy.Name;
     this.currencyPair_Renamed      = beanToCopy.CurrencyPair;
     this.valuationDateTime_Renamed = beanToCopy.ValuationDateTime;
     this.smile_Renamed             = beanToCopy.Smile;
 }
        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"));
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        //-------------------------------------------------------------------------
        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);
        }
 private BlackFxOptionSmileVolatilities(FxOptionVolatilitiesName name, CurrencyPair currencyPair, ZonedDateTime valuationDateTime, SmileDeltaTermStructure smile)
 {
     JodaBeanUtils.notNull(name, "name");
     JodaBeanUtils.notNull(currencyPair, "currencyPair");
     JodaBeanUtils.notNull(valuationDateTime, "valuationDateTime");
     JodaBeanUtils.notNull(smile, "smile");
     this.name              = name;
     this.currencyPair      = currencyPair;
     this.valuationDateTime = valuationDateTime;
     this.smile             = smile;
 }
 private FxOptionSensitivity(FxOptionVolatilitiesName volatilitiesName, CurrencyPair currencyPair, double expiry, double strike, double forward, Currency currency, double sensitivity)
 {
     JodaBeanUtils.notNull(volatilitiesName, "volatilitiesName");
     JodaBeanUtils.notNull(currencyPair, "currencyPair");
     JodaBeanUtils.notNull(expiry, "expiry");
     JodaBeanUtils.notNull(currency, "currency");
     this.volatilitiesName = volatilitiesName;
     this.currencyPair     = currencyPair;
     this.expiry           = expiry;
     this.strike           = strike;
     this.forward          = forward;
     this.currency         = currency;
     this.sensitivity      = sensitivity;
 }
Beispiel #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @ImmutableConstructor private BlackFxOptionSurfaceVolatilities(FxOptionVolatilitiesName name, com.opengamma.strata.basics.currency.CurrencyPair currencyPair, java.time.ZonedDateTime valuationDateTime, com.opengamma.strata.market.surface.Surface surface)
        private BlackFxOptionSurfaceVolatilities(FxOptionVolatilitiesName name, CurrencyPair currencyPair, ZonedDateTime valuationDateTime, Surface surface)
        {
            ArgChecker.notNull(name, "name");
            ArgChecker.notNull(currencyPair, "currencyPair");
            ArgChecker.notNull(valuationDateTime, "valuationDateTime");
            ArgChecker.notNull(surface, "surface");
            surface.Metadata.XValueType.checkEquals(ValueType.YEAR_FRACTION, "Incorrect x-value type for Black volatilities");
            surface.Metadata.YValueType.checkEquals(ValueType.STRIKE, "Incorrect y-value type for Black volatilities");
            surface.Metadata.ZValueType.checkEquals(ValueType.BLACK_VOLATILITY, "Incorrect z-value type for Black volatilities");
            DayCount dayCount = surface.Metadata.findInfo(SurfaceInfoType.DAY_COUNT).orElseThrow(() => new System.ArgumentException("Incorrect surface metadata, missing DayCount"));

            this.name              = name;
            this.currencyPair      = currencyPair;
            this.valuationDateTime = valuationDateTime;
            this.surface           = surface;
            this.dayCount          = dayCount;
        }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 2100884654:         // volatilitiesName
                    this.volatilitiesName = (FxOptionVolatilitiesName)newValue;
                    break;

                case 1005147787:         // currencyPair
                    this.currencyPair = (CurrencyPair)newValue;
                    break;

                case -1289159373:         // expiry
                    this.expiry = (double?)newValue.Value;
                    break;

                case -891985998:         // strike
                    this.strike = (double?)newValue.Value;
                    break;

                case -677145915:         // forward
                    this.forward = (double?)newValue.Value;
                    break;

                case 575402001:         // currency
                    this.currency = (Currency)newValue;
                    break;

                case 564403871:         // sensitivity
                    this.sensitivity = (double?)newValue.Value;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance, specifying sensitivity currency.
 /// </summary>
 /// <param name="volatilitiesName">  the name of the volatilities </param>
 /// <param name="currencyPair">  the currency pair </param>
 /// <param name="expiry">  the time to expiry of the option as a year fraction </param>
 /// <param name="strike">  the strike rate </param>
 /// <param name="forward">  the forward rate </param>
 /// <param name="sensitivityCurrency">  the currency of the sensitivity </param>
 /// <param name="sensitivity">  the value of the sensitivity </param>
 /// <returns> the point sensitivity object </returns>
 public static FxOptionSensitivity of(FxOptionVolatilitiesName volatilitiesName, CurrencyPair currencyPair, double expiry, double strike, double forward, Currency sensitivityCurrency, double sensitivity)
 {
     return(new FxOptionSensitivity(volatilitiesName, currencyPair, expiry, strike, forward, sensitivityCurrency, sensitivity));
 }
Beispiel #13
0
        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));
        }
Beispiel #14
0
 //-------------------------------------------------------------------------
 /// <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)));
 }
Beispiel #15
0
 /// <summary>
 /// Obtains an instance from the implied volatility surface and the date-time for which it is valid.
 /// <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="name">  the name </param>
 /// <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(FxOptionVolatilitiesName name, CurrencyPair currencyPair, ZonedDateTime valuationDateTime, Surface surface)
 {
     return(new BlackFxOptionSurfaceVolatilities(name, currencyPair, valuationDateTime, surface));
 }
Beispiel #16
0
 private FxOptionVolatilitiesId(FxOptionVolatilitiesName name)
 {
     JodaBeanUtils.notNull(name, "name");
     this.name = name;
 }
 //-----------------------------------------------------------------------
 /// <summary>
 /// Sets the name of the volatilities. </summary>
 /// <param name="name">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder name(FxOptionVolatilitiesName name)
 {
     JodaBeanUtils.notNull(name, "name");
     this.name_Renamed = name;
     return(this);
 }
Beispiel #18
0
 /// <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(FxOptionVolatilitiesName name)
 {
     return(new FxOptionVolatilitiesId(name));
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance based on a smile.
 /// </summary>
 /// <param name="name">  the name of the volatilities </param>
 /// <param name="currencyPair">  the currency pair </param>
 /// <param name="valuationTime">  the valuation date-time </param>
 /// <param name="smile">  the term structure of smile </param>
 /// <returns> the provider </returns>
 public static BlackFxOptionSmileVolatilities of(FxOptionVolatilitiesName name, CurrencyPair currencyPair, ZonedDateTime valuationTime, SmileDeltaTermStructure smile)
 {
     return(new BlackFxOptionSmileVolatilities(name, currencyPair, valuationTime, smile));
 }