Пример #1
0
        public void TransactionBookShouldCalulateCorrectOrderCostsForRemainingSharesAfterSplit()
        {
            var guid = Guid.NewGuid();
            var book = new TransactionBook();

            book.AddEntry(TransactionEntryMock.CreateBuying(guid, 6500, 0.14m, 1.25m));
            book.AddEntry(TransactionEntryMock.CreateBuying(guid, 14000, 0.06m, 15.40m));
            book.AddEntry(TransactionEntryMock.CreateSplit(guid, Guid.NewGuid(), 137m, 13.209124m, DateTime.Now));

            book.GetOrAddOpenPosition(guid).PositionSize.Should().Be(137 * 13.209124m + 1.25m + 15.40m);
        }
Пример #2
0
        public void TransactionBookShouldCalulateRemainingShares1000Buy500Buy500Split()
        {
            var guid = Guid.NewGuid();
            var book = new TransactionBook();

            book.AddEntry(TransactionEntryMock.CreateBuying(guid, 1000));
            book.AddEntry(TransactionEntryMock.CreateBuying(guid, 500));
            book.AddEntry(TransactionEntryMock.CreateSplit(guid, 500));

            book.GetOrAddOpenPosition(guid).Shares.Should().Be(500);
        }