コード例 #1
0
        //-------------------------------------------------------------------------
        public virtual void test_builder_full()
        {
            BondFuture test = BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(BOND_PRODUCT).conversionFactors(CONVERSION_FACTOR).firstNoticeDate(FIRST_NOTICE_DATE).firstDeliveryDate(FIRST_DELIVERY_DATE).lastNoticeDate(LAST_NOTICE_DATE).lastDeliveryDate(LAST_DELIVERY_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build();

            assertEquals(test.DeliveryBasket, ImmutableList.copyOf(BOND_PRODUCT));
            assertEquals(test.ConversionFactors, ImmutableList.copyOf(CONVERSION_FACTOR));
            assertEquals(test.Currency, USD);
            assertEquals(test.Notional, NOTIONAL);
            assertEquals(test.FirstNoticeDate, FIRST_NOTICE_DATE);
            assertEquals(test.LastNoticeDate, LAST_NOTICE_DATE);
            assertEquals(test.FirstDeliveryDate, FIRST_DELIVERY_DATE);
            assertEquals(test.LastDeliveryDate, LAST_DELIVERY_DATE);
            assertEquals(test.LastTradeDate, LAST_TRADING_DATE);
            assertEquals(test.Rounding, ROUNDING);
        }
コード例 #2
0
        public virtual void test_builder_fail()
        {
            // wrong size
            assertThrowsIllegalArg(() => BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(BOND_PRODUCT[0]).conversionFactors(CONVERSION_FACTOR).firstNoticeDate(FIRST_NOTICE_DATE).lastNoticeDate(LAST_NOTICE_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
            // first notice date missing
            assertThrowsIllegalArg(() => BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(BOND_PRODUCT).conversionFactors(CONVERSION_FACTOR).lastNoticeDate(LAST_NOTICE_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
            // last notice date missing
            assertThrowsIllegalArg(() => BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(BOND_PRODUCT).conversionFactors(CONVERSION_FACTOR).firstNoticeDate(FIRST_NOTICE_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
            // basket list empty
            assertThrowsIllegalArg(() => BondFuture.builder().securityId(SECURITY_ID).conversionFactors(CONVERSION_FACTOR).firstNoticeDate(FIRST_NOTICE_DATE).lastNoticeDate(LAST_NOTICE_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
            // notional mismatch
            FixedCouponBond bond0 = BOND_PRODUCT[0];
            FixedCouponBond bond1 = bond0.toBuilder().notional(100).build();
            FixedCouponBond bond2 = bond0.toBuilder().currency(Currency.CAD).build();

            assertThrowsIllegalArg(() => BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(bond0, bond1).conversionFactors(CONVERSION_FACTOR[0], CONVERSION_FACTOR[1]).firstNoticeDate(FIRST_NOTICE_DATE).lastNoticeDate(LAST_NOTICE_DATE).firstDeliveryDate(FIRST_DELIVERY_DATE).lastDeliveryDate(LAST_DELIVERY_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
            // currency mismatch
            assertThrowsIllegalArg(() => BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(bond0, bond2).conversionFactors(CONVERSION_FACTOR[0], CONVERSION_FACTOR[1]).firstNoticeDate(FIRST_NOTICE_DATE).lastNoticeDate(LAST_NOTICE_DATE).firstDeliveryDate(FIRST_DELIVERY_DATE).lastDeliveryDate(LAST_DELIVERY_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
        }
コード例 #3
0
 internal static BondFuture sut2()
 {
     return(BondFuture.builder().securityId(SECURITY_ID2).conversionFactors(0.9187).deliveryBasket(BOND_PRODUCT[3]).firstNoticeDate(FIRST_NOTICE_DATE.plusDays(7)).lastNoticeDate(LAST_NOTICE_DATE.plusDays(7)).lastTradeDate(LAST_TRADING_DATE.plusDays(7)).build());
 }
コード例 #4
0
 //-------------------------------------------------------------------------
 internal static BondFuture sut()
 {
     return(BondFuture.builder().securityId(SECURITY_ID).deliveryBasket(BOND_PRODUCT).conversionFactors(ImmutableList.copyOf(CONVERSION_FACTOR)).firstNoticeDate(FIRST_NOTICE_DATE).firstDeliveryDate(FIRST_DELIVERY_DATE).lastNoticeDate(LAST_NOTICE_DATE).lastDeliveryDate(LAST_DELIVERY_DATE).lastTradeDate(LAST_TRADING_DATE).rounding(ROUNDING).build());
 }