Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 5
0
 internal static CapitalIndexedBondPosition sut2()
 {
     return(CapitalIndexedBondPosition.builder().info(POSITION_INFO2).product(PRODUCT2).longQuantity(100).shortQuantity(50).build());
 }
Ejemplo n.º 6
0
 //-------------------------------------------------------------------------
 internal static CapitalIndexedBondPosition sut()
 {
     return(CapitalIndexedBondPosition.builder().info(POSITION_INFO).product(PRODUCT).longQuantity(QUANTITY).build());
 }
Ejemplo n.º 7
0
 public CapitalIndexedBondPosition withQuantity(double quantity)
 {
     return(CapitalIndexedBondPosition.ofNet(info, product, quantity));
 }