Esempio n. 1
0
        public void MultipleCovers()
        {
            var a = new VAccount(10000, 4, 3);

            a.Short("DIA", 20, 5.00);
            a.Cover("DIA", 10, 2.00);
            a.Equity.ShouldEqual(10024);
            a.Cover("DIA", 10, 3.00);
            a.Equity.ShouldEqual(10041);
        }
Esempio n. 2
0
        public void CannotCoverMoreThanYouShorted()
        {
            var a = new VAccount(10000, 4, 3);

            a.Short("DIA", 4, 7.00);
            new Action(() => a.Cover("DIA", 5, 7.00)).ShouldThrow <Exception>(x => x.Message.ShouldContain("Can't cover"));
        }
Esempio n. 3
0
        public void MultipleShorts()
        {
            var a = new VAccount(10000, 4, 3);

            a.Short("DIA", 10, 2.00);
            a.Short("DIA", 10, 3.00);
            a.Cover("DIA", 20, 1.50);
            a.Equity.ShouldEqual(10011);
        }
Esempio n. 4
0
        public void ShortPosition()
        {
            var a = new VAccount(10000, 4, 3);

            a.Short("DIA", 30, 5.00);
            a.Equity.ShouldEqual(9997);
            a.Invested.ShouldEqual(150);
            a.BuyingPower.ShouldEqual(39838);

            a.Cover("DIA", 30, 4.00);
            a.Equity.ShouldEqual(10024);
            a.Invested.ShouldEqual(0);
            a.BuyingPower.ShouldEqual(40096);
        }