Exemplo n.º 1
0
        public void MultipleSells()
        {
            var a = new VAccount(10000, 4, 3);

            a.Buy("DIA", 20, 1.00);
            a.Sell("DIA", 10, 2.00);
            a.Equity.ShouldEqual(10004);
            a.Sell("DIA", 10, 3.00);
            a.Equity.ShouldEqual(10021);
        }
Exemplo n.º 2
0
        public void CannotSellMoreThanYouHave()
        {
            var a = new VAccount(10000, 4, 3);

            a.Buy("DIA", 4, 7.00);
            new Action(() => a.Sell("DIA", 5, 7.00)).ShouldThrow <Exception>(x => x.Message.ShouldContain("Can't sell"));
        }
Exemplo n.º 3
0
        public void LongPosition()
        {
            var a = new VAccount(10000, 4, 3);

            a.Buy("DIA", 10, 1.50);
            a.Equity.ShouldEqual(9997);
            a.Invested.ShouldEqual(15);
            a.BuyingPower.ShouldEqual(39973);

            a.Sell("DIA", 10, 2.50);
            a.Equity.ShouldEqual(10004);
            a.Invested.ShouldEqual(0);
            a.BuyingPower.ShouldEqual(40016);
        }