public Stock FindStock(string companyName) { return(Portfolio.ContainsKey(companyName) ? Portfolio[companyName] : null); }
public Stock FindBiggestCompany() { return(Portfolio.OrderByDescending(a => a.Value.MarketCapitalization).FirstOrDefault().Value); }
public void BuyStock(Stock stock) { if (stock.MarketCapitalization > 10000 && MoneyToInvest >= stock.PricePerShare && !Portfolio.ContainsKey(stock.CompanyName)) { Portfolio.Add(stock.CompanyName, stock); MoneyToInvest -= stock.PricePerShare; } }