Exemple #1
0
        //-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            FixedCouponBondPosition trade    = sut();
            PortfolioItemSummary    expected = PortfolioItemSummary.builder().id(POSITION_INFO.Id.orElse(null)).portfolioItemType(PortfolioItemType.POSITION).productType(ProductType.BOND).currencies(Currency.EUR).description("Bond x 10").build();

            assertEquals(trade.summarize(), expected);
        }
Exemple #2
0
        //-------------------------------------------------------------------------
        public virtual void test_withQuantity()
        {
            FixedCouponBondPosition @base = sut();
            double quantity = 75343d;
            FixedCouponBondPosition computed = @base.withQuantity(quantity);
            FixedCouponBondPosition expected = FixedCouponBondPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(quantity).build();

            assertEquals(computed, expected);
        }
        public virtual void test_createPosition()
        {
            FixedCouponBondSecurity test              = sut();
            PositionInfo            positionInfo      = PositionInfo.empty();
            FixedCouponBondPosition expectedPosition1 = FixedCouponBondPosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).build();

            assertEquals(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1);
            FixedCouponBondPosition expectedPosition2 = FixedCouponBondPosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).shortQuantity(50).build();

            assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2);
        }
Exemple #4
0
        //-------------------------------------------------------------------------
        public virtual void test_builder_resolved()
        {
            FixedCouponBondPosition test = sut();

            assertEquals(test.Product, PRODUCT);
            assertEquals(test.Info, POSITION_INFO);
            assertEquals(test.LongQuantity, QUANTITY, 0d);
            assertEquals(test.ShortQuantity, 0d, 0d);
            assertEquals(test.Quantity, QUANTITY, 0d);
            assertEquals(test.withInfo(POSITION_INFO).Info, POSITION_INFO);
            assertEquals(test.withQuantity(129).Quantity, 129d, 0d);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FixedCouponBondPosition other = (FixedCouponBondPosition)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(longQuantity, other.longQuantity) && JodaBeanUtils.equal(shortQuantity, other.shortQuantity));
     }
     return(false);
 }
 public FixedCouponBondPosition withQuantity(double quantity)
 {
     return(FixedCouponBondPosition.ofNet(info, product, quantity));
 }
Exemple #7
0
 internal static FixedCouponBondPosition sut2()
 {
     return(FixedCouponBondPosition.builder().info(POSITION_INFO2).product(PRODUCT2).longQuantity(100).shortQuantity(50).build());
 }
Exemple #8
0
 //-------------------------------------------------------------------------
 internal static FixedCouponBondPosition sut()
 {
     return(FixedCouponBondPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(QUANTITY).build());
 }