//-------------------------------------------------------------------------
        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()
        {
            ResolvedFxSingleBarrierOption test1 = ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, REBATE);
            ResolvedFxSingleBarrierOption test2 = ResolvedFxSingleBarrierOption.of(ResolvedFxVanillaOption.builder().longShort(SHORT).expiry(EXPIRY_DATE_TIME).underlying(FX).build(), SimpleConstantContinuousBarrier.of(BarrierType.UP, KnockType.KNOCK_IN, 1.5));

            coverImmutableBean(test1);
            coverBeanEquals(test1, test2);
        }
Пример #3
0
 private ResolvedFxVanillaOptionTrade(TradeInfo info, ResolvedFxVanillaOption product, Payment premium)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     JodaBeanUtils.notNull(premium, "premium");
     this.info    = info;
     this.product = product;
     this.premium = premium;
 }
 private ResolvedFxSingleBarrierOption(ResolvedFxVanillaOption underlyingOption, Barrier barrier, CurrencyAmount rebate)
 {
     JodaBeanUtils.notNull(underlyingOption, "underlyingOption");
     JodaBeanUtils.notNull(barrier, "barrier");
     this.underlyingOption = underlyingOption;
     this.barrier          = barrier;
     this.rebate           = rebate;
     validate();
 }
Пример #5
0
        public virtual void test_builder_inverseFx()
        {
            ResolvedFxVanillaOption test = sut2();

            assertEquals(test.Expiry, EXPIRY_DATE_TIME.plusSeconds(1));
            assertEquals(test.ExpiryDate, EXPIRY_DATE_TIME.toLocalDate());
            assertEquals(test.LongShort, SHORT);
            assertEquals(test.CounterCurrency, GBP);
            assertEquals(test.PutCall, PUT);
            assertEquals(test.Strike, STRIKE_RE);
            assertEquals(test.Underlying, FX_RE);
        }
Пример #6
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            ResolvedFxVanillaOption test = sut();

            assertEquals(test.Expiry, EXPIRY_DATE_TIME);
            assertEquals(test.ExpiryDate, EXPIRY_DATE_TIME.toLocalDate());
            assertEquals(test.LongShort, LONG);
            assertEquals(test.CounterCurrency, USD);
            assertEquals(test.PutCall, CALL);
            assertEquals(test.Strike, STRIKE);
            assertEquals(test.Underlying, FX);
            assertEquals(test.CurrencyPair, FX.CurrencyPair);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedFxVanillaOption other = (ResolvedFxVanillaOption)obj;
         return(JodaBeanUtils.equal(longShort, other.longShort) && JodaBeanUtils.equal(expiry, other.expiry) && JodaBeanUtils.equal(underlying, other.underlying));
     }
     return(false);
 }
Пример #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 = (ResolvedFxVanillaOption)newValue;
                    break;

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

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 87556658:         // underlyingOption
                    this.underlyingOption = (ResolvedFxVanillaOption)newValue;
                    break;

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

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

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Пример #10
0
 public virtual void test_builder_earlyPaymentDate()
 {
     assertThrowsIllegalArg(() => ResolvedFxVanillaOption.builder().longShort(LONG).expiry(LocalDate.of(2015, 2, 21).atStartOfDay(ZoneOffset.UTC)).underlying(FX).build());
 }
Пример #11
0
 internal static ResolvedFxVanillaOption sut2()
 {
     ;
     return(ResolvedFxVanillaOption.builder().longShort(SHORT).expiry(EXPIRY_DATE_TIME.plusSeconds(1)).underlying(FX_RE).build());
 }
Пример #12
0
 //-------------------------------------------------------------------------
 internal static ResolvedFxVanillaOption sut()
 {
     return(ResolvedFxVanillaOption.builder().longShort(LONG).expiry(EXPIRY_DATE_TIME).underlying(FX).build());
 }
Пример #13
0
 /// <summary>
 /// Sets the resolved vanilla FX option product.
 /// <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(ResolvedFxVanillaOption product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
Пример #14
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedFxVanillaOptionTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
     this.premium_Renamed = beanToCopy.Premium;
 }
 //-------------------------------------------------------------------------
 /// <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 ResolvedFxSingleBarrierOption of(ResolvedFxVanillaOption underlyingOption, Barrier barrier, CurrencyAmount rebate)
 {
     return(new ResolvedFxSingleBarrierOption(underlyingOption, barrier, rebate));
 }
 /// <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 ResolvedFxSingleBarrierOption of(ResolvedFxVanillaOption underlyingOption, Barrier barrier)
 {
     return(new ResolvedFxSingleBarrierOption(underlyingOption, barrier, null));
 }