protected override StockScreenerResult ConvertResult(Base.ConnectionInfo connInfo, System.IO.Stream stream, Base.SettingsBase settings)
        {
            StockScreenerDownloadSettings set     = (StockScreenerDownloadSettings)settings;
            List <StockScreenerData>      results = new List <StockScreenerData>();
            string result = MyHelper.StreamToString(stream, set.TextEncoding);

            List <string> lines = new List <string>(result.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));

            if (lines.Count > 0)
            {
                System.Globalization.CultureInfo convCulture = new System.Globalization.CultureInfo("en-US");

                List <QuoteProperty>         quoteProps    = new List <QuoteProperty>();
                List <StockScreenerProperty> screenerProps = new List <StockScreenerProperty>();
                foreach (StockCriteriaDefinition crit in set.Criterias)
                {
                    foreach (QuoteProperty qp in crit.ProvidedQuoteProperties)
                    {
                        if (!quoteProps.Contains(qp))
                        {
                            quoteProps.Add(qp);
                        }
                    }
                    foreach (StockScreenerProperty sp in crit.ProvidedScreenerProperties)
                    {
                        if (!screenerProps.Contains(sp))
                        {
                            screenerProps.Add(sp);
                        }
                    }
                }

                string[] propertySymbols = new string[-1 + 1];
                string[] propertyNames   = new string[-1 + 1];
                int      startIndex      = 0;

                if (!set.Comparing)
                {
                    startIndex      = 2;
                    propertySymbols = lines[0].Split('|');
                    propertyNames   = lines[1].Split('|');
                }
                else
                {
                    startIndex = 0;
                    List <string> lstSymbols = new List <string>();
                    lstSymbols.Add("");
                    lstSymbols.Add("");
                    lstSymbols.Add("b");
                    lstSymbols.Add("");
                    lstSymbols.Add("c");
                    lstSymbols.Add("8o");
                    lstSymbols.Add("9c");
                    lstSymbols.Add("9t");
                    foreach (StockCriteriaDefinition crt in set.Criterias)
                    {
                        if (crt.ProvidedQuoteProperties.Length > 5 | crt.ProvidedScreenerProperties.Length > 3)
                        {
                            lstSymbols.Add(crt.CriteriaTag);
                        }
                    }
                    propertySymbols = lstSymbols.ToArray();

                    List <string> lstNames = new List <string>();
                    lstNames.Add("Ticker");
                    lstNames.Add("Company Name");
                    lstNames.Add("Last Trade");
                    lstNames.Add("Trade Time");
                    lstNames.Add("Mkt Cap");
                    lstNames.Add("Return On Equity");
                    lstNames.Add("Return On Assets");
                    lstNames.Add("Forward PE");
                    foreach (StockCriteriaDefinition crt in set.Criterias)
                    {
                        if (crt.ProvidedQuoteProperties.Length > 5 | crt.ProvidedScreenerProperties.Length > 3)
                        {
                            switch (crt.CriteriaTag)
                            {
                            case "f":
                            case "g":
                                if (crt is PriceGainerLosersCriteria)
                                {
                                    PriceGainerLosersCriteria mngCrt = (PriceGainerLosersCriteria)crt;
                                    if (mngCrt.ValueRelativeTo == StockTradingAbsoluteTimePoint.TodaysOpen)
                                    {
                                        lstNames.Add("(open)");
                                    }
                                    else
                                    {
                                        lstNames.Add("(close)");
                                    }
                                }
                                break;

                            case "h":
                            case "i":
                                if (crt is PriceMomentumCriteria)
                                {
                                    PriceMomentumCriteria mngCrt = (PriceMomentumCriteria)crt;
                                    lstNames.Add("(" + mngCrt.RelativeTimeSpanInMinutes.ToString().Replace("_", "") + "m)");
                                }
                                break;

                            default:
                                lstNames.Add("");
                                break;
                            }
                        }
                    }
                    propertyNames = lstNames.ToArray();
                }

                for (int i = startIndex; i <= lines.Count - 1; i++)
                {
                    string[] values = lines[i].Split('|');


                    if (propertySymbols.Length >= 4 & values.Length == propertySymbols.Length & values.Length == propertyNames.Length)
                    {
                        string id   = values[0];
                        string name = values[1];
                        double lastTradePriceOnly = 0;
                        double.TryParse(values[2], System.Globalization.NumberStyles.Any, convCulture, out lastTradePriceOnly);
                        DateTime tradeTime = new DateTime();
                        DateTime.TryParse(values[3], convCulture, System.Globalization.DateTimeStyles.None, out tradeTime);
                        tradeTime = tradeTime.AddHours(tradeTime.Hour).AddMinutes(tradeTime.Minute);

                        StockScreenerData res = new StockScreenerData(id, name, lastTradePriceOnly, tradeTime, quoteProps.ToArray(), screenerProps.ToArray());

                        if (values.Length >= 5)
                        {
                            for (int p = 4; p <= values.Length - 1; p++)
                            {
                                if (values[p] != string.Empty & values[p] != "N/A")
                                {
                                    double dblValue = 0;

                                    if (double.TryParse(values[p], System.Globalization.NumberStyles.Any, convCulture, out dblValue) || FinanceHelper.GetMillionValue(values[p]) != 0)
                                    {
                                        switch (propertySymbols[p])
                                        {
                                        case "c":
                                            res[QuoteProperty.MarketCapitalization] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        //case "c":
                                        //res.AdditionalValues[(int)StockScreenerProperty.RevenueEstimate_ThisYear] = dblValue;
                                        //break;
                                        case "8o":
                                            res.AdditionalValues[(int)StockScreenerProperty.ReturnOnEquity] = dblValue;
                                            break;

                                        case "9c":
                                            res.AdditionalValues[(int)StockScreenerProperty.ReturnOnAssets] = dblValue;
                                            break;

                                        case "9t":
                                            res.AdditionalValues[(int)StockScreenerProperty.ForwardPriceToEarningsRatio] = dblValue;
                                            break;

                                        case "9o":
                                            res.AdditionalValues[(int)StockScreenerProperty.NumberOfEmployees] = dblValue;
                                            break;

                                        case "f":
                                            double absoluteChange        = dblValue;
                                            double absolutePreviousValue = res.LastTradePriceOnly - absoluteChange;
                                            double changeInPercent       = absoluteChange / absolutePreviousValue;

                                            res[QuoteProperty.ChangeInPercent] = changeInPercent * 100;
                                            res[QuoteProperty.Change]          = absoluteChange;

                                            if (propertyNames[p].EndsWith("(open)"))
                                            {
                                                res[QuoteProperty.Open] = absolutePreviousValue;
                                            }
                                            else
                                            {
                                                res[QuoteProperty.PreviousClose] = absolutePreviousValue;
                                            }

                                            break;

                                        case "g":
                                            changeInPercent       = dblValue;
                                            absolutePreviousValue = (res.LastTradePriceOnly / (100 + changeInPercent)) * 100;
                                            absoluteChange        = res.LastTradePriceOnly - absolutePreviousValue;

                                            res[QuoteProperty.ChangeInPercent] = changeInPercent;
                                            res[QuoteProperty.Change]          = absoluteChange;

                                            if (propertyNames[p].EndsWith("(open)"))
                                            {
                                                res[QuoteProperty.Open] = absolutePreviousValue;
                                            }
                                            else
                                            {
                                                res[QuoteProperty.PreviousClose] = absolutePreviousValue;
                                            }

                                            break;

                                        case "h":
                                            if (set.Criterias != null)
                                            {
                                                PriceMomentumCriteria context = null;

                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is PriceMomentumCriteria && ((PriceMomentumCriteria)crit).PercentValues == false)
                                                    {
                                                        context = (PriceMomentumCriteria)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    if (propertyNames[p].EndsWith("(" + context.RelativeTimeSpanInMinutes.ToString().Replace("_", "") + "m)"))
                                                    {
                                                        TemporaryPriceChangeInfo info = new TemporaryPriceChangeInfo();
                                                        info.ChangeRelativeTimePoint = context.TimeSpanRelativeTo;
                                                        info.ChangeTimeSpan          = context.RelativeTimeSpanInMinutes;
                                                        info.Change                = dblValue * Convert.ToInt32((context.GainOrLoss == StockPriceChangeDirection.Gain ? 1 : -1));
                                                        info.ChangeInPercent       = info.Change / (res.LastTradePriceOnly - info.Change);
                                                        res.TemporaryLimitedChange = info;
                                                    }
                                                }
                                            }

                                            break;

                                        case "i":
                                            if (set.Criterias != null)
                                            {
                                                PriceMomentumCriteria context = null;
                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is PriceMomentumCriteria && ((PriceMomentumCriteria)crit).PercentValues == true)
                                                    {
                                                        context = (PriceMomentumCriteria)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    if (propertyNames[p].EndsWith("(" + context.RelativeTimeSpanInMinutes.ToString().Replace("_", "") + "m)"))
                                                    {
                                                        TemporaryPriceChangeInfo info = new TemporaryPriceChangeInfo();
                                                        info.ChangeRelativeTimePoint = context.TimeSpanRelativeTo;
                                                        info.ChangeTimeSpan          = context.RelativeTimeSpanInMinutes;
                                                        info.ChangeInPercent         = dblValue * Convert.ToInt32((context.GainOrLoss == StockPriceChangeDirection.Gain ? 1 : -1));
                                                        info.Change = res.LastTradePriceOnly - ((res.LastTradePriceOnly / (100 + info.ChangeInPercent)) * 100);
                                                        res.TemporaryLimitedChange = info;
                                                    }
                                                }
                                            }

                                            break;

                                        case "j":
                                            if (set.Criterias != null)
                                            {
                                                ExtremePriceCriteria context = null;
                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is ExtremePriceCriteria && ((ExtremePriceCriteria)crit).PercentValues == false)
                                                    {
                                                        context = (ExtremePriceCriteria)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    absoluteChange        = dblValue * Convert.ToInt32((context.LessGreater == LessGreater.Greater ? 1 : -1));
                                                    absolutePreviousValue = res.LastTradePriceOnly - absoluteChange;
                                                    changeInPercent       = absoluteChange / absolutePreviousValue;
                                                    switch (context.ExtremeParameter)
                                                    {
                                                    case StockExtremeParameter.TodaysHigh:
                                                        res[QuoteProperty.DaysHigh] = absolutePreviousValue;
                                                        break;

                                                    case StockExtremeParameter.TodaysLow:
                                                        res[QuoteProperty.DaysLow] = absolutePreviousValue;
                                                        break;

                                                    case StockExtremeParameter.YearsHigh:
                                                        res[QuoteProperty.YearHigh] = absolutePreviousValue;
                                                        res[QuoteProperty.ChangeInPercentFromYearHigh] = changeInPercent;
                                                        res[QuoteProperty.ChangeFromYearHigh]          = absoluteChange;
                                                        break;

                                                    case StockExtremeParameter.YearsLow:
                                                        res[QuoteProperty.YearLow] = absolutePreviousValue;
                                                        res[QuoteProperty.PercentChangeFromYearLow] = changeInPercent;
                                                        res[QuoteProperty.ChangeFromYearLow]        = absoluteChange;
                                                        break;
                                                    }
                                                }
                                            }

                                            break;

                                        case "k":
                                            if (set.Criterias != null)
                                            {
                                                ExtremePriceCriteria context = null;
                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is ExtremePriceCriteria && ((ExtremePriceCriteria)crit).PercentValues == true)
                                                    {
                                                        context = (ExtremePriceCriteria)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    changeInPercent       = dblValue * Convert.ToInt32((context.LessGreater == LessGreater.Greater ? 1 : -1));
                                                    absolutePreviousValue = (res.LastTradePriceOnly / (100 + changeInPercent)) * 100;
                                                    absoluteChange        = res.LastTradePriceOnly - absolutePreviousValue;
                                                    switch (context.ExtremeParameter)
                                                    {
                                                    case StockExtremeParameter.TodaysHigh:
                                                        res[QuoteProperty.DaysHigh] = absolutePreviousValue;
                                                        break;

                                                    case StockExtremeParameter.TodaysLow:
                                                        res[QuoteProperty.DaysLow] = absolutePreviousValue;
                                                        break;

                                                    case StockExtremeParameter.YearsHigh:
                                                        res[QuoteProperty.YearHigh] = absolutePreviousValue;
                                                        res[QuoteProperty.ChangeInPercentFromYearHigh] = changeInPercent;
                                                        res[QuoteProperty.ChangeFromYearHigh]          = absoluteChange;
                                                        break;

                                                    case StockExtremeParameter.YearsLow:
                                                        res[QuoteProperty.YearLow] = absolutePreviousValue;
                                                        res[QuoteProperty.PercentChangeFromYearLow] = changeInPercent;
                                                        res[QuoteProperty.ChangeFromYearLow]        = absoluteChange;
                                                        break;
                                                    }
                                                }
                                            }

                                            break;

                                        case "l":
                                            if (set.Criterias != null)
                                            {
                                                GapVsPreviousClose context = null;
                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is GapVsPreviousClose && ((GapVsPreviousClose)crit).PercentValues == false)
                                                    {
                                                        context = (GapVsPreviousClose)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    res.AdditionalValues[(int)StockScreenerProperty.Gap] = dblValue;
                                                }
                                            }

                                            break;

                                        case "m":
                                            if (set.Criterias != null)
                                            {
                                                GapVsPreviousClose context = null;
                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is GapVsPreviousClose && ((GapVsPreviousClose)crit).PercentValues == true)
                                                    {
                                                        context = (GapVsPreviousClose)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    res.AdditionalValues[(int)StockScreenerProperty.GapInPercent] = dblValue;
                                                }
                                            }

                                            break;

                                        case "o":
                                            if (set.Criterias != null)
                                            {
                                                PriceToMovingAverageRatioCriteria context = null;
                                                foreach (StockCriteriaDefinition crit in set.Criterias)
                                                {
                                                    if (crit != null && crit is PriceToMovingAverageRatioCriteria)
                                                    {
                                                        context = (PriceToMovingAverageRatioCriteria)crit;
                                                        break;     // TODO: might not be correct. Was : Exit For
                                                    }
                                                }
                                                if (context != null)
                                                {
                                                    changeInPercent = dblValue;
                                                    double maValue = (dblValue / (100 + changeInPercent)) * 100;
                                                    absoluteChange = res.LastTradePriceOnly - maValue;

                                                    if (context.MovingAverage == MovingAverageType.FiftyDays)
                                                    {
                                                        res[QuoteProperty.FiftydayMovingAverage]                  = maValue;
                                                        res[QuoteProperty.ChangeFromFiftydayMovingAverage]        = absoluteChange;
                                                        res[QuoteProperty.PercentChangeFromFiftydayMovingAverage] = changeInPercent;
                                                    }
                                                    else
                                                    {
                                                        res[QuoteProperty.TwoHundreddayMovingAverage]                  = maValue;
                                                        res[QuoteProperty.ChangeFromTwoHundreddayMovingAverage]        = absoluteChange;
                                                        res[QuoteProperty.PercentChangeFromTwoHundreddayMovingAverage] = changeInPercent;
                                                    }
                                                }
                                            }

                                            break;

                                        case "7":
                                            res.AdditionalValues[(int)StockScreenerProperty.Beta] = dblValue;
                                            break;

                                        case "v":
                                            res[QuoteProperty.PriceSales] = dblValue;
                                            break;

                                        case "e":
                                            res.AdditionalValues[(int)StockScreenerProperty.PriceEarningsRatio] = dblValue;
                                            break;

                                        case "u":
                                            res[QuoteProperty.PEGRatio] = dblValue;
                                            break;

                                        case "9p":
                                            res.AdditionalValues[(int)StockScreenerProperty.EntityValue] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "9q":
                                            res.AdditionalValues[(int)StockScreenerProperty.EntityValueToRevenueRatio] = dblValue;
                                            break;

                                        case "9r":
                                            res.AdditionalValues[(int)StockScreenerProperty.EntityValueToOperatingCashFlowRatio] = dblValue;
                                            break;

                                        case "9s":
                                            res.AdditionalValues[(int)StockScreenerProperty.EntityValueToFreeCashFlowRatio] = dblValue;
                                            break;

                                        case "x":
                                            res[QuoteProperty.EPSEstimateNextQuarter] = dblValue;
                                            break;

                                        case "y":
                                            res[QuoteProperty.EPSEstimateCurrentYear] = dblValue;
                                            break;

                                        case "z":
                                            res[QuoteProperty.EPSEstimateNextYear] = dblValue;
                                            break;

                                        case "8e":
                                            res.AdditionalValues[(int)StockScreenerProperty.EPS_NYCE] = dblValue;
                                            break;

                                        case "9v":
                                            res.AdditionalValues[(int)StockScreenerProperty.SalesGrowthEstimate_ThisQuarter] = dblValue;
                                            break;

                                        case "8h":
                                            res.AdditionalValues[(int)StockScreenerProperty.EarningsGrowthEstimate_ThisYear] = dblValue;
                                            break;

                                        case "9b":
                                            res.AdditionalValues[(int)StockScreenerProperty.EarningsGrowthEstimate_NextYear] = dblValue;
                                            break;

                                        case "9u":
                                            res.AdditionalValues[(int)StockScreenerProperty.EarningsGrowthEstimate_Next5Years] = dblValue;
                                            break;

                                        case "1":
                                            res.AdditionalValues[(int)StockScreenerProperty.SharesOutstanding] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "2":
                                            res[QuoteProperty.SharesFloat] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "3":
                                            res[QuoteProperty.ShortRatio] = dblValue;
                                            break;

                                        case "8g":
                                            res.AdditionalValues[(int)StockScreenerProperty.SharesShortPriorMonth] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8m":
                                            res.AdditionalValues[(int)StockScreenerProperty.SharesShort] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "9d":
                                            res.AdditionalValues[(int)StockScreenerProperty.HeldByInsiders] = dblValue;
                                            break;

                                        case "9n":
                                            res.AdditionalValues[(int)StockScreenerProperty.HeldByInstitutions] = dblValue;
                                            break;

                                        case "4":
                                            res[QuoteProperty.TrailingAnnualDividendYield] = dblValue;
                                            break;

                                        case "5":
                                            res[QuoteProperty.TrailingAnnualDividendYieldInPercent] = dblValue;
                                            break;

                                        case "8a":
                                            res.AdditionalValues[(int)StockScreenerProperty.OperatingMargin] = dblValue;
                                            break;

                                        case "8r":
                                            res.AdditionalValues[(int)StockScreenerProperty.ProfitMargin_ttm] = dblValue;
                                            break;

                                        case "9f":
                                            res.AdditionalValues[(int)StockScreenerProperty.EBITDAMargin_ttm] = dblValue;
                                            break;

                                        case "9k":
                                            res.AdditionalValues[(int)StockScreenerProperty.GrossMargin_ttm] = dblValue;
                                            break;

                                        case "8f":
                                            res[QuoteProperty.PriceBook] = dblValue;
                                            break;

                                        //case "8f":
                                        //res.AdditionalValues[(int)StockScreenerProperty.CashPerShare] = dblValue;
                                        //break;
                                        case "8l":
                                            res.AdditionalValues[(int)StockScreenerProperty.TotalCash] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "6":
                                            res[QuoteProperty.BookValuePerShare] = dblValue;
                                            break;

                                        case "9e":
                                            res.AdditionalValues[(int)StockScreenerProperty.TotalDebt] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "9g":
                                            res.AdditionalValues[(int)StockScreenerProperty.TotalDebtToEquityRatio] = dblValue;
                                            break;

                                        case "9h":
                                            res.AdditionalValues[(int)StockScreenerProperty.CurrentRatio] = dblValue;
                                            break;

                                        case "9i":
                                            res.AdditionalValues[(int)StockScreenerProperty.LongTermDebtToEquityRatio] = dblValue;
                                            break;

                                        case "9l":
                                            res.AdditionalValues[(int)StockScreenerProperty.QuickRatio] = dblValue;
                                            break;

                                        case "w":
                                            res[QuoteProperty.DilutedEPS] = dblValue;
                                            break;

                                        case "8i":
                                            res.AdditionalValues[(int)StockScreenerProperty.EPS_mrq] = dblValue;
                                            break;

                                        case "0":
                                            res.AdditionalValues[(int)StockScreenerProperty.Sales_ttm] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "t":
                                            res[QuoteProperty.EBITDA] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8n":
                                            res.AdditionalValues[(int)StockScreenerProperty.GrossProfit] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8p":
                                            res.AdditionalValues[(int)StockScreenerProperty.NetIncome] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "9j":
                                            res.AdditionalValues[(int)StockScreenerProperty.OperatingIncome] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8v":
                                            res.AdditionalValues[(int)StockScreenerProperty.EarningsGrowth_Past5Years] = dblValue;
                                            break;

                                        case "9a":
                                            res.AdditionalValues[(int)StockScreenerProperty.RevenueEstimate_ThisQuarter] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8q":
                                            res.AdditionalValues[(int)StockScreenerProperty.RevenueEstimate_NextQuarter] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8s":
                                            res.AdditionalValues[(int)StockScreenerProperty.SalesGrowthEstimate_NextQuarter] = dblValue;
                                            break;

                                        case "8t":
                                            res.AdditionalValues[(int)StockScreenerProperty.SalesGrowthEstimate_ThisYear] = dblValue;
                                            break;

                                        case "8k":
                                            res.AdditionalValues[(int)StockScreenerProperty.SalesGrowthEstimate_NextYear] = dblValue;
                                            break;

                                        case "8y":
                                            res.AdditionalValues[(int)StockScreenerProperty.FreeCashFlow] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));
                                            break;

                                        case "8z":
                                            res.AdditionalValues[(int)StockScreenerProperty.OperatingCashFlow] = Convert.ToInt64(FinanceHelper.GetMillionValue(values[p]) * (Math.Pow(10, 6)));

                                            break;
                                        }
                                    }
                                }
                            }
                        }

                        results.Add(res);
                    }
                }
            }
            return(new StockScreenerResult(results.ToArray()));
        }
Пример #2
0
        protected override CompanyStatisticsAggregate ConvertResult(string contentStr, string ticker = "")
        {
            CompanyStatisticsData result     = null;
            XParseDocument        doc        = MyHelper.ParseXmlDocument(contentStr);
            XParseElement         resultNode = XPath.GetElement("//table[@id=\"yfncsumtab\"]/tr[2]", doc);

            if (resultNode != null)
            {
                XParseElement tempNode = null;
                XParseElement vmNode   = XPath.GetElement("/td[1]/table[2]/tr/td/table", resultNode);
                double[]      vmValues = new double[9];
                if (vmNode != null)
                {
                    tempNode = XPath.GetElement("/tr[1]/td[2]/span", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[0] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[2]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[1] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[2] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[4]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[3] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[5]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[4] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[6]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[5] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[7]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[6] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[8]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[7] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[9]/td[2]", vmNode);
                    if (tempNode != null)
                    {
                        vmValues[8] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }
                }

                CompanyValuationMeasures vm = new CompanyValuationMeasures(vmValues);


                XParseElement fyNode     = XPath.GetElement("/td[1]/table[4]/tr/td/table", resultNode);
                XParseElement profitNode = XPath.GetElement("/td[1]/table[5]/tr/td/table", resultNode);
                XParseElement meNode     = XPath.GetElement("/td[1]/table[6]/tr/td/table", resultNode);
                XParseElement isNode     = XPath.GetElement("/td[1]/table[7]/tr/td/table", resultNode);
                XParseElement bsNode     = XPath.GetElement("/td[1]/table[8]/tr/td/table", resultNode);
                XParseElement cfsNode    = XPath.GetElement("/td[1]/table[9]/tr/td/table", resultNode);

                DateTime fiscalYEnds = new DateTime();
                DateTime mostRecQutr = new DateTime();
                double[] fhValues    = new double[20];

                if (fyNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", fyNode);
                    if (tempNode != null)
                    {
                        fiscalYEnds = FinanceHelper.ParseToDateTime(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", fyNode);
                    if (tempNode != null)
                    {
                        mostRecQutr = FinanceHelper.ParseToDateTime(tempNode.Value);
                    }
                }

                if (profitNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", profitNode);
                    if (tempNode != null)
                    {
                        fhValues[0] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", profitNode);
                    if (tempNode != null)
                    {
                        fhValues[1] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }
                }

                if (meNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", meNode);
                    if (tempNode != null)
                    {
                        fhValues[2] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", meNode);
                    if (tempNode != null)
                    {
                        fhValues[3] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }
                }

                if (isNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[4] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[5] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[4]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[6] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[5]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[7] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[6]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[8] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[7]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[9] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[8]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[10] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[9]/td[2]", isNode);
                    if (tempNode != null)
                    {
                        fhValues[11] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }
                }

                if (bsNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", bsNode);
                    if (tempNode != null)
                    {
                        fhValues[12] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", bsNode);
                    if (tempNode != null)
                    {
                        fhValues[13] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[4]/td[2]", bsNode);
                    if (tempNode != null)
                    {
                        fhValues[14] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[5]/td[2]", bsNode);
                    if (tempNode != null)
                    {
                        fhValues[15] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[6]/td[2]", bsNode);
                    if (tempNode != null)
                    {
                        fhValues[16] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[7]/td[2]", bsNode);
                    if (tempNode != null)
                    {
                        fhValues[17] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }
                }

                if (cfsNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", cfsNode);
                    if (tempNode != null)
                    {
                        fhValues[18] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", cfsNode);
                    if (tempNode != null)
                    {
                        fhValues[19] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }
                }

                CompanyFinancialHighlights fh = new CompanyFinancialHighlights(fiscalYEnds, mostRecQutr, fhValues);


                XParseElement sphNode = XPath.GetElement("/td[3]/table[2]/tr/td/table", resultNode);
                XParseElement stNode  = XPath.GetElement("/td[3]/table[3]/tr/td/table", resultNode);
                XParseElement dsNode  = XPath.GetElement("/td[3]/table[4]/tr/td/table", resultNode);

                double[]          ctiValues = new double[23];
                DateTime          exDivDate = new DateTime();
                DateTime          divDate   = new DateTime();
                DateTime          splitDate = new DateTime();
                SharesSplitFactor sf        = null;

                if (sphNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[0] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[1] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[4]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[2] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[5]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[3] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[6]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[4] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[7]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[5] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[8]/td[2]", sphNode);
                    if (tempNode != null)
                    {
                        ctiValues[6] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }
                }


                if (stNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[7] = FinanceHelper.ParseToDouble(tempNode.Value) / 1000;
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[8] = FinanceHelper.ParseToDouble(tempNode.Value) / 1000;
                    }

                    tempNode = XPath.GetElement("/tr[4]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[9] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[5]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[10] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[6]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[11] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[7]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[12] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[8]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[13] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[9]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[14] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[10]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[15] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[11]/td[2]", stNode);
                    if (tempNode != null)
                    {
                        ctiValues[16] = FinanceHelper.GetMillionValue(tempNode.Value);
                    }
                }

                if (dsNode != null)
                {
                    tempNode = XPath.GetElement("/tr[2]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        ctiValues[17] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[3]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        ctiValues[18] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[4]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        ctiValues[19] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[5]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        ctiValues[20] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[6]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        ctiValues[21] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[7]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        ctiValues[22] = FinanceHelper.ParseToDouble(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[8]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        divDate = FinanceHelper.ParseToDateTime(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[9]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        exDivDate = FinanceHelper.ParseToDateTime(tempNode.Value);
                    }

                    tempNode = XPath.GetElement("/tr[10]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        string[] txt = tempNode.Value.Split(':');
                        int      from, to;
                        if (int.TryParse(txt[0], out to) && int.TryParse(txt[1], out from))
                        {
                            sf = new SharesSplitFactor(to, from);
                        }
                    }

                    tempNode = XPath.GetElement("/tr[11]/td[2]", dsNode);
                    if (tempNode != null)
                    {
                        splitDate = FinanceHelper.ParseToDateTime(tempNode.Value);
                    }
                }
                CompanyTradingInfo cti = new CompanyTradingInfo(ctiValues, divDate, exDivDate, splitDate, sf);

                result = new CompanyStatisticsData(ticker, vm, fh, cti);
            }
            return(new CompanyStatisticsAggregate(result));
        }