Example #1
0
        public virtual void test_withPrice()
        {
            FixedCouponBondTrade @base = sut();
            double price = 135d;
            FixedCouponBondTrade computed = @base.withPrice(price);
            FixedCouponBondTrade expected = FixedCouponBondTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(price).build();

            assertEquals(computed, expected);
        }
Example #2
0
        //-------------------------------------------------------------------------
        public virtual void test_withQuantity()
        {
            FixedCouponBondTrade @base    = sut();
            double quantity               = 75343d;
            FixedCouponBondTrade computed = @base.withQuantity(quantity);
            FixedCouponBondTrade expected = FixedCouponBondTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(quantity).price(PRICE).build();

            assertEquals(computed, expected);
        }
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            FixedCouponBondSecurity test = sut();

            assertEquals(test.createProduct(ReferenceData.empty()), PRODUCT);
            TradeInfo            tradeInfo     = TradeInfo.of(date(2016, 6, 30));
            FixedCouponBondTrade expectedTrade = FixedCouponBondTrade.builder().info(tradeInfo).product(PRODUCT).quantity(100).price(123.50).build();

            assertEquals(test.createTrade(tradeInfo, 100, 123.50, ReferenceData.empty()), expectedTrade);
        }
Example #4
0
        public virtual void test_resolve_noTradeOrSettlementDate()
        {
            FixedCouponBondTrade test = FixedCouponBondTrade.builder().info(TradeInfo.empty()).product(PRODUCT).quantity(QUANTITY).price(PRICE).build();

            assertThrows(() => test.resolve(REF_DATA), typeof(System.InvalidOperationException));
        }
Example #5
0
 internal static FixedCouponBondTrade sut2()
 {
     return(FixedCouponBondTrade.builder().info(TRADE_INFO2).product(PRODUCT2).quantity(100L).price(PRICE2).build());
 }
Example #6
0
 //-------------------------------------------------------------------------
 internal static FixedCouponBondTrade sut()
 {
     return(FixedCouponBondTrade.builder().info(TRADE_INFO).product(PRODUCT).quantity(QUANTITY).price(PRICE).build());
 }