Exemple #1
0
        public virtual void test_summarize()
        {
            BillPosition         @base    = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().id(POSITION_INFO1.Id.orElse(null)).portfolioItemType(PortfolioItemType.POSITION).productType(ProductType.BILL).currencies(USD).description("Bill2019-05-23 x 10").build();

            assertEquals(@base.summarize(), expected);
        }
Exemple #2
0
        public virtual void test_resolve()
        {
            BillPosition      @base    = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build();
            ResolvedBillTrade computed = @base.resolve(REF_DATA);
            ResolvedBillTrade expected = ResolvedBillTrade.builder().info(POSITION_INFO1).product(PRODUCT1.resolve(REF_DATA)).quantity(QUANTITY1).build();

            assertEquals(computed, expected);
        }
Exemple #3
0
        public virtual void test_withInfo()
        {
            BillPosition @base     = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build();
            BillPosition computed1 = @base.withInfo(POSITION_INFO2);
            BillPosition expected1 = BillPosition.builder().info(POSITION_INFO2).product(PRODUCT1).longQuantity(QUANTITY1).build();

            assertEquals(computed1, expected1);
        }
Exemple #4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            BillPosition test1 = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build();

            coverImmutableBean(test1);
            BillPosition test2 = BillPosition.builder().info(POSITION_INFO2).product(PRODUCT2).shortQuantity(QUANTITY1).build();

            coverBeanEquals(test1, test2);
        }
        public virtual void test_createPosition()
        {
            BillSecurity test              = BillSecurity.builder().dayCount(DAY_COUNT).info(INFO).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build();
            Bill         product           = Bill.builder().dayCount(DAY_COUNT).securityId(SECURITY_ID).dayCount(DAY_COUNT).legalEntityId(LEGAL_ENTITY).notional(NOTIONAL).settlementDateOffset(SETTLE).yieldConvention(YIELD_CONVENTION).build();
            PositionInfo positionInfo      = PositionInfo.empty();
            BillPosition expectedPosition1 = BillPosition.builder().info(positionInfo).product(product).longQuantity(100).build();

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

            assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2);
        }
Exemple #6
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         BillPosition other = (BillPosition)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(product, other.product) && JodaBeanUtils.equal(longQuantity, other.longQuantity) && JodaBeanUtils.equal(shortQuantity, other.shortQuantity));
     }
     return(false);
 }
Exemple #7
0
        public virtual void test_withQuantity()
        {
            BillPosition @base     = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build();
            double       quantity  = 1234d;
            BillPosition computed1 = @base.withQuantity(quantity);
            BillPosition expected1 = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(quantity).build();

            assertEquals(computed1, expected1);
            BillPosition computed2 = @base.withQuantity(-quantity);
            BillPosition expected2 = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).shortQuantity(quantity).build();

            assertEquals(computed2, expected2);
        }
Exemple #8
0
        public virtual void test_builder_of()
        {
            BillPosition test = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).shortQuantity(QUANTITY2).build();

            assertEquals(test.Currency, USD);
            assertEquals(test.Id, POSITION_INFO1.Id);
            assertEquals(test.Info, POSITION_INFO1);
            assertEquals(test.LongQuantity, QUANTITY1);
            assertEquals(test.ShortQuantity, QUANTITY2);
            assertEquals(test.Product, PRODUCT1);
            assertEquals(test.Quantity, QUANTITY1 - QUANTITY2);
            assertEquals(test.SecurityId, PRODUCT1.SecurityId);
            BillPosition test1 = BillPosition.ofLongShort(POSITION_INFO1, PRODUCT1, QUANTITY1, QUANTITY2);

            assertEquals(test, test1);
        }
Exemple #9
0
 public BillPosition withQuantity(double quantity)
 {
     return(BillPosition.ofNet(info, product, quantity));
 }
Exemple #10
0
 public BillPosition createPosition(PositionInfo positionInfo, double longQuantity, double shortQuantity, ReferenceData refData)
 {
     return(BillPosition.ofLongShort(positionInfo, createProduct(refData), longQuantity, shortQuantity));
 }
Exemple #11
0
 public BillPosition createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData)
 {
     return(BillPosition.ofNet(positionInfo, createProduct(refData), quantity));
 }
Exemple #12
0
        public virtual void test_serialization()
        {
            BillPosition test = BillPosition.builder().info(POSITION_INFO1).product(PRODUCT1).longQuantity(QUANTITY1).build();

            assertSerialization(test);
        }