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

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

            assertEquals(computed, expected);
        }
示例#3
0
        //-------------------------------------------------------------------------
        public virtual void test_builder_resolved()
        {
            CapitalIndexedBondPosition 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);
        }
示例#4
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         CapitalIndexedBondPosition other = (CapitalIndexedBondPosition)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(longQuantity, other.longQuantity) && JodaBeanUtils.equal(shortQuantity, other.shortQuantity));
     }
     return(false);
 }
示例#5
0
 internal static CapitalIndexedBondPosition sut2()
 {
     return(CapitalIndexedBondPosition.builder().info(POSITION_INFO2).product(PRODUCT2).longQuantity(100).shortQuantity(50).build());
 }
示例#6
0
 //-------------------------------------------------------------------------
 internal static CapitalIndexedBondPosition sut()
 {
     return(CapitalIndexedBondPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(QUANTITY).build());
 }
示例#7
0
 public CapitalIndexedBondPosition withQuantity(double quantity)
 {
     return(CapitalIndexedBondPosition.ofNet(info, product, quantity));
 }