public static Dictionary <DateTime, double> BuildHistory(IEnumerable <MarketObservation> observations, GapInterpolationMethod interpolationMethod, Func <MarketObservation, int> getPriceFunction) { switch (interpolationMethod) { case GapInterpolationMethod.Linear: return(LinearInterpolation(observations.ToArray(), getPriceFunction)); default: throw new ArgumentOutOfRangeException(nameof(interpolationMethod), interpolationMethod, null); } }
public static Dictionary <DateTime, double> BuildHistory(IEnumerable <MarketObservation> observations, GapInterpolationMethod interpolationMethod, Func <MarketObservation, int> getPriceFunction, int maxDays) { return(BuildHistory(observations, interpolationMethod, getPriceFunction).Take(maxDays).ToDictionary(p => p.Key, p => p.Value)); }