コード例 #1
0
        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);
        }
コード例 #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
        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);
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        //-------------------------------------------------------------------------
        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);
        }
コード例 #7
0
        public virtual void test_serialization()
        {
            ResolvedFxSingleBarrierOption test = ResolvedFxSingleBarrierOption.of(VANILLA_OPTION, BARRIER, REBATE);

            assertSerialization(test);
        }