//-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            FxVanillaOption         @base    = sut();
            ResolvedFxVanillaOption expected = ResolvedFxVanillaOption.builder().longShort(LONG).expiry(EXPIRY_DATE.atTime(EXPIRY_TIME).atZone(EXPIRY_ZONE)).underlying(FX.resolve(REF_DATA)).build();

            assertEquals(@base.resolve(REF_DATA), expected);
        }
示例#2
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FxSingleBarrierOption test1 = FxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, REBATE);
            FxSingleBarrierOption test2 = FxSingleBarrierOption.of(FxVanillaOption.builder().longShort(SHORT).expiryDate(EXPIRY_DATE).expiryTime(EXPIRY_TIME).expiryZone(EXPIRY_ZONE).underlying(FX).build(), SimpleConstantContinuousBarrier.of(BarrierType.UP, KnockType.KNOCK_IN, 1.5));

            coverImmutableBean(test1);
            coverBeanEquals(test1, test2);
        }
示例#3
0
 private FxSingleBarrierOption(FxVanillaOption underlyingOption, Barrier barrier, CurrencyAmount rebate)
 {
     JodaBeanUtils.notNull(underlyingOption, "underlyingOption");
     JodaBeanUtils.notNull(barrier, "barrier");
     this.underlyingOption = underlyingOption;
     this.barrier          = barrier;
     this.rebate           = rebate;
     validate();
 }
示例#4
0
 private FxVanillaOptionTrade(TradeInfo info, FxVanillaOption product, AdjustablePayment premium)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     JodaBeanUtils.notNull(premium, "premium");
     this.info    = info;
     this.product = product;
     this.premium = premium;
 }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FxVanillaOption other = (FxVanillaOption)obj;
         return(JodaBeanUtils.equal(longShort, other.longShort) && JodaBeanUtils.equal(expiryDate, other.expiryDate) && JodaBeanUtils.equal(expiryTime, other.expiryTime) && JodaBeanUtils.equal(expiryZone, other.expiryZone) && JodaBeanUtils.equal(underlying, other.underlying));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            FxVanillaOption test = sut();

            assertEquals(test.ExpiryDate, EXPIRY_DATE);
            assertEquals(test.Expiry, ZonedDateTime.of(EXPIRY_DATE, EXPIRY_TIME, EXPIRY_ZONE));
            assertEquals(test.ExpiryZone, EXPIRY_ZONE);
            assertEquals(test.ExpiryTime, EXPIRY_TIME);
            assertEquals(test.LongShort, LONG);
            assertEquals(test.Underlying, FX);
            assertEquals(test.CurrencyPair, FX.CurrencyPair);
            assertEquals(test.CrossCurrency, true);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(EUR, USD));
            assertEquals(test.allCurrencies(), ImmutableSet.of(EUR, USD));
        }
示例#7
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 87556658:         // underlyingOption
                    this.underlyingOption_Renamed = (FxVanillaOption)newValue;
                    break;

                case -333143113:         // barrier
                    this.barrier_Renamed = (Barrier)newValue;
                    break;

                case -934952029:         // rebate
                    this.rebate_Renamed = (CurrencyAmount)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
示例#8
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3237038:         // info
                    this.info_Renamed = (TradeInfo)newValue;
                    break;

                case -309474065:         // product
                    this.product_Renamed = (FxVanillaOption)newValue;
                    break;

                case -318452137:         // premium
                    this.premium_Renamed = (AdjustablePayment)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 //-------------------------------------------------------------------------
 internal static FxVanillaOption sut()
 {
     return(FxVanillaOption.builder().longShort(LONG).expiryDate(EXPIRY_DATE).expiryTime(EXPIRY_TIME).expiryZone(EXPIRY_ZONE).underlying(FX).build());
 }
 public virtual void test_builder_earlyPaymentDate()
 {
     assertThrowsIllegalArg(() => FxVanillaOption.builder().longShort(LONG).expiryDate(LocalDate.of(2015, 2, 21)).expiryTime(EXPIRY_TIME).expiryZone(EXPIRY_ZONE).underlying(FX).build());
 }
示例#11
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains FX single barrier option with rebate.
 /// </summary>
 /// <param name="underlyingOption">  the underlying FX vanilla option </param>
 /// <param name="barrier">  the barrier </param>
 /// <param name="rebate">  the rebate </param>
 /// <returns> the instance </returns>
 public static FxSingleBarrierOption of(FxVanillaOption underlyingOption, Barrier barrier, CurrencyAmount rebate)
 {
     return(new FxSingleBarrierOption(underlyingOption, barrier, rebate));
 }
        internal static FxVanillaOption sut2()
        {
            FxSingle fxProduct = FxSingle.of(CurrencyAmount.of(EUR, -NOTIONAL), CurrencyAmount.of(GBP, NOTIONAL * 0.9), PAYMENT_DATE);

            return(FxVanillaOption.builder().longShort(LongShort.SHORT).expiryDate(LocalDate.of(2015, 2, 15)).expiryTime(LocalTime.of(12, 45)).expiryZone(ZoneId.of("GMT")).underlying(fxProduct).build());
        }
示例#13
0
 //-----------------------------------------------------------------------
 /// <summary>
 /// Sets the underlying FX vanilla option. </summary>
 /// <param name="underlyingOption">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder underlyingOption(FxVanillaOption underlyingOption)
 {
     JodaBeanUtils.notNull(underlyingOption, "underlyingOption");
     this.underlyingOption_Renamed = underlyingOption;
     return(this);
 }
示例#14
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(FxVanillaOptionTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
     this.premium_Renamed = beanToCopy.Premium;
 }
示例#15
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(FxSingleBarrierOption beanToCopy)
 {
     this.underlyingOption_Renamed = beanToCopy.UnderlyingOption;
     this.barrier_Renamed          = beanToCopy.Barrier;
     this.rebate_Renamed           = beanToCopy.rebate;
 }
示例#16
0
 /// <summary>
 /// Sets the FX option product that was agreed when the trade occurred.
 /// <para>
 /// The product captures the contracted financial details of the trade.
 /// </para>
 /// </summary>
 /// <param name="product">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder product(FxVanillaOption product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
示例#17
0
 /// <summary>
 /// Obtains FX single barrier option without rebate.
 /// </summary>
 /// <param name="underlyingOption">  the underlying FX vanilla option </param>
 /// <param name="barrier">  the barrier </param>
 /// <returns> the instance </returns>
 public static FxSingleBarrierOption of(FxVanillaOption underlyingOption, Barrier barrier)
 {
     return(new FxSingleBarrierOption(underlyingOption, barrier, null));
 }