static IEnumerable <Models.Rate> GetRsi(List <Rate> rates, int func, int index) { if (rates.Count == index) { yield break; } var date = DateTime.Now; var rsi = new Rsi(func); for (int i = index; i < func + index; i++) { rsi.AddValue(rates[index].Value); date = rates[index].Time; } yield return(new Models.Rate { Date = date, Value = rsi.Last }); foreach (var r in GetRate(rates, func, index + 1)) { yield return(r); } }
static Models.Rate GetRsi(List <Rate> rates, int func) { var date = DateTime.Now; var rsi = new Rsi(func); foreach (var rate in rates) { rsi.AddValue(rate.Value); date = rate.Time; } return(new Models.Rate { Date = date, Value = rsi.Last }); }