public virtual void test_resolve_noRebate() { FxSingleBarrierOption @base = FxSingleBarrierOption.of(VANILLA_OPTION, BARRIER); ResolvedFxSingleBarrierOption expected = ResolvedFxSingleBarrierOption.of(VANILLA_OPTION.resolve(REF_DATA), BARRIER); assertEquals(@base.resolve(REF_DATA), expected); }
//------------------------------------------------------------------------- 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); }
public virtual void test_of_noRebate() { ResolvedFxSingleBarrierOption test = ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER); assertEquals(test.Barrier, BARRIER); assertFalse(test.Rebate.Present); assertEquals(test.UnderlyingOption, VANILLA_OPTION); }
private ResolvedFxSingleBarrierOptionTrade(TradeInfo info, ResolvedFxSingleBarrierOption product, Payment premium) { JodaBeanUtils.notNull(info, "info"); JodaBeanUtils.notNull(product, "product"); JodaBeanUtils.notNull(premium, "premium"); this.info = info; this.product = product; this.premium = premium; }
public virtual void test_of_fail() { CurrencyAmount negative = CurrencyAmount.of(USD, -5.0e4); assertThrowsIllegalArg(() => ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, negative)); CurrencyAmount other = CurrencyAmount.of(GBP, 5.0e4); assertThrowsIllegalArg(() => ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, other)); }
public virtual void test_of() { ResolvedFxSingleBarrierOption test = ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, REBATE); assertEquals(test.Barrier, BARRIER); assertEquals(test.Rebate.get(), REBATE); assertEquals(test.UnderlyingOption, VANILLA_OPTION); assertEquals(test.CurrencyPair, VANILLA_OPTION.CurrencyPair); }
//----------------------------------------------------------------------- public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { ResolvedFxSingleBarrierOption other = (ResolvedFxSingleBarrierOption)obj; return(JodaBeanUtils.equal(underlyingOption, other.underlyingOption) && JodaBeanUtils.equal(barrier, other.barrier) && JodaBeanUtils.equal(rebate, other.rebate)); } return(false); }
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 = (ResolvedFxSingleBarrierOption)newValue; break; case -318452137: // premium this.premium_Renamed = (Payment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Sets the resolved barrier 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(ResolvedFxSingleBarrierOption product) { JodaBeanUtils.notNull(product, "product"); this.product_Renamed = product; return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ResolvedFxSingleBarrierOptionTrade beanToCopy) { this.info_Renamed = beanToCopy.Info; this.product_Renamed = beanToCopy.Product; this.premium_Renamed = beanToCopy.Premium; }
//------------------------------------------------------------------------- public virtual void coverage() { ResolvedFxSingleBarrierOptionTrade test1 = ResolvedFxSingleBarrierOptionTrade.builder().info(TRADE_INFO).product(PRODUCT).premium(PREMIUM).build(); ResolvedFxSingleBarrierOptionTrade test2 = ResolvedFxSingleBarrierOptionTrade.builder().product(ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER)).premium(Payment.of(CurrencyAmount.of(EUR, NOTIONAL * 0.01), date(2014, 11, 13))).build(); coverImmutableBean(test1); coverBeanEquals(test1, test2); }
public virtual void test_serialization() { ResolvedFxSingleBarrierOption test = ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, REBATE); assertSerialization(test); }