private static AnalyticsPrice CalculateAnalyticsPrice(IOrderedQueryable <HourlyShareRate> ratesOrderedByTimestamp) { if (!ratesOrderedByTimestamp.Any()) { return(null); } return(new AnalyticsPrice { High = ratesOrderedByTimestamp.Max(r => r.Rate), Low = ratesOrderedByTimestamp.Min(r => r.Rate), Open = ratesOrderedByTimestamp.First().Rate, Close = ratesOrderedByTimestamp.Last().Rate, }); }