private static void Stock_PriceChanged(object sender, PriceChangedEventArgs e) { var increase = (e.NewPrice - e.LastPrice) / e.LastPrice; if (increase >= 0.1m) { WriteLine("Alert, 10% or more stock price increase!"); } else { WriteLine("Price increase less than 10%"); } WriteLine($"Increase = {Math.Round(increase * 100, 2)}%"); }
protected virtual void OnPriceChanged(PriceChangedEventArgs e) { PriceChanged?.Invoke(this, e); }