protected void RaiseTickerAdded(TickerVolatilityInfo info) { if (TickerAdded != null) { TickerAdded(this, new TickerVolatilityInfoEventArgs() { Info = info }); } }
public bool Calculate() { if (Exchange == null) { LogManager.Default.Error("Exchange not specified"); return(false); } if (!Exchange.Connect()) { LogManager.Default.Error("Exchange not connected"); return(false); } foreach (string baseCurr in BaseCurrencies) { List <Ticker> tickers = Exchange.Tickers.Where(t => t.BaseCurrency == baseCurr && (MarketCurrencies == null || MarketCurrencies.Contains(t.MarketCurrency))).ToList(); foreach (Ticker ticker in tickers) { ResizeableArray <CandleStickData> data = Utils.DownloadCandleStickData(ticker, CandleStickPeriodMin); if (data == null) { LogManager.Default.Error("Cannot download candlesticks for " + ticker.Name); continue; } LogManager.Default.Success("Downloaded candlesticks for " + ticker.Name); ticker.CandleStickData.AddRange(data); //foreach(var t in data) // ticker.CandleStickData.Add(t); //data.ForEach(i => ticker.CandleStickData.Add(i)); TickerVolatilityInfo info = new TickerVolatilityInfo() { Ticker = ticker }; info.Calculate(); info.CalculateMath(); info.CalculateDev(); info.CalcHistogramm(HistogrammBarCount); Result.Add(info); Items.Add(info); RaiseTickerAdded(info); } } return(true); }