public List <PointData> GetAdjustedSymbolTradekData(int symbolId) { IDataLoader dataLoader = Bootstrapper.container.GetInstance <IDataLoader>(); //get stock trade data List <PointData> listPointData = dataLoader.GetSymbolTradeData(symbolId); //get stock dividend data List <Dividend> dividends = dataLoader.GetDividend(symbolId); //get stock capital increase data //compute adjusted data foreach (Dividend d in dividends) { double dividendFactor = 0; //find final price at dividend date and calculate dividend factor List <PointData> pointDataAfterDividendDate = listPointData.Where(p => p.Date > d.Date).ToList <PointData>(); pointDataAfterDividendDate.Sort((a, b) => a.Date.CompareTo(b.Date)); dividendFactor = d.Value / pointDataAfterDividendDate.FirstOrDefault().Final; foreach (PointData pointData in listPointData) { if (d.Date < pointData.Date) { pointData.Final *= (1 + dividendFactor); } } } return(listPointData); }