private static Candle ComputeCandle(Equity equity, DateTime startTime, DateTime endTime) { var candles = equity.Where(c => c.DateTime >= startTime && c.DateTime < endTime); if (candles.Any()) { var dateTime = candles.First().DateTime; var open = candles.First().Open; var high = candles.Max(stick => stick.High); var low = candles.Min(stick => stick.Low); var close = candles.Last().Close; var volume = candles.Sum(stick => stick.Volume); return(new Candle(dateTime, open, high, low, close, volume)); } return(null); }