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