internal void Apply(StockSold sold) { this.Sells.Add(sold); this.LastSale = sold.When; this.Transactions.Add(Transaction.CreditTx( this.Ticker, $"Sold {sold.NumberOfShares} shares @ ${sold.Price}/share", sold.Price * sold.NumberOfShares, sold.When, false )); this.Transactions.Add(Transaction.PLTx( this.Ticker, $"Sold {sold.NumberOfShares} shares @ ${sold.Price}/share", (sold.Price * sold.NumberOfShares - this.AverageCost * sold.NumberOfShares), sold.When, false )); this.Owned -= sold.NumberOfShares; if (this.Owned == 0) { this.AverageCost = 0; } this.Cost = AverageCost * Owned; }
internal void ApplyInternal(StockSold sold) { BuyOrSell.Add(sold); StateUpdateLoop(); }
private void ApplyInternal(StockSold sold) { this.State.Apply(sold); }