Esempio n. 1
0
        public virtual void test_ofNet_withInfo_negative()
        {
            SecurityPosition test = SecurityPosition.ofNet(POSITION_INFO, SECURITY_ID, -100d);

            assertEquals(test.Info, POSITION_INFO);
            assertEquals(test.SecurityId, SECURITY_ID);
            assertEquals(test.LongQuantity, 0d);
            assertEquals(test.ShortQuantity, 100d);
            assertEquals(test.Quantity, -100d);
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------
        public virtual void test_ofNet_noInfo()
        {
            SecurityPosition test = SecurityPosition.ofNet(SECURITY_ID, QUANTITY);

            assertEquals(test.Info, PositionInfo.empty());
            assertEquals(test.SecurityId, SECURITY_ID);
            assertEquals(test.LongQuantity, QUANTITY);
            assertEquals(test.ShortQuantity, 0d);
            assertEquals(test.Quantity, QUANTITY);
            assertEquals(test.withInfo(POSITION_INFO).Info, POSITION_INFO);
            assertEquals(test.withQuantity(129).Quantity, 129d, 0d);
            assertEquals(test.withQuantity(-129).Quantity, -129d, 0d);
        }
 public SecurityPosition withQuantity(double quantity)
 {
     return(SecurityPosition.ofNet(info, securityId, quantity));
 }