Ejemplo n.º 1
0
            // For each company, the outter dictionary key, makes a single item query for the special case quote property
            // The inner dictionary is expected to be the quote property name, value pair
            // If request is unsuccessful, returns null
            private static Dictionary<string, Dictionary<string, string>> SpecialCaseQuoteQuery( string baseQuery, List<string> tickers, Quotes.QuoteProperties qp )
            {
                baseQuery += qp.ToString( );
                baseQuery +=  endURL;

                var qResult = string.Empty;
                try{ qResult = client.DownloadString( baseQuery ); }
                catch{ return null; }

                string [] stringSeparator = new string [] { "\r\n" };
                var resultLines = qResult.Split( stringSeparator, StringSplitOptions.RemoveEmptyEntries );
                var result = new Dictionary<string, Dictionary<string, string>>( );
                for(int i = 0; i < tickers.Count; i++)                {
                    var valuePair = new Dictionary<string, string>( );
                    valuePair.Add( qp.GetDesription( ), resultLines [ i ] );
                    result.Add( tickers [ i ], valuePair );
                }

                return result;
            }