예제 #1
0
        public void AccountValueOne()
        {
            Quote quote1 = new Quote()
            {
                Date   = new DateTime(2000, 1, 1),
                Price  = 10m,
                Symbol = "test1",
            };

            QuoteFeedMock quoteFeedMock = new QuoteFeedMock();

            quoteFeedMock.AddQuote(quote1);

            Position position1 = new Position()
            {
                Class    = TransactionEnums.TransactionClass.stock,
                Quantity = 5,
                Symbol   = "test1",
            };

            Account account = new Account();

            account.Positions.Add(position1.Symbol, position1);

            decimal expectedValue = 50m;
            decimal actualValue   = Metrics.AccountValue(account, quoteFeedMock);

            Assert.AreEqual(expectedValue, actualValue);
        }
예제 #2
0
        public void PositionValuePositive()
        {
            QuoteFeedMock quoteFeedMock = new QuoteFeedMock();

            Quote quote = new Quote()
            {
                Date   = new DateTime(2000, 1, 1),
                Price  = 50.00m,
                Symbol = "test",
            };

            quoteFeedMock.AddQuote(quote);

            Position position = new Position()
            {
                Symbol   = "test",
                Quantity = 10,
                Class    = TransactionEnums.TransactionClass.stock,
            };

            decimal expectedPositionValue = 500m;
            decimal actualPositionValue   = Metrics.PositionValue(position, quoteFeedMock);

            Assert.AreEqual(expectedPositionValue, actualPositionValue);
        }
예제 #3
0
        public void AccountValueZero()
        {
            QuoteFeedMock quoteFeedMock = new QuoteFeedMock();
            Account       account       = new Account();

            decimal expectedValue = 0m;
            decimal actualValue   = Metrics.AccountValue(account, quoteFeedMock);

            Assert.AreEqual(expectedValue, actualValue);
        }
예제 #4
0
        public void PositionValueZero()
        {
            QuoteFeedMock quoteFeedMock = new QuoteFeedMock();

            Position position = new Position()
            {
                Symbol   = "test",
                Quantity = 0,
                Class    = TransactionEnums.TransactionClass.stock,
            };

            Metrics.PositionValue(position, quoteFeedMock);
        }