Ejemplo n.º 1
0
        public static void RetrieveQuotes()
        {
            // make a request for data
            StockSymbol            Symbol;
            StockQuotesDataService DataService = new StockQuotesDataService();
            string symbol;

            do
            {
                Symbol = StockSymbols.Instance.GetNextStock();
                symbol = Symbol.Symbol;
                StockQuote stock = new StockQuote(Symbol.Id);
                stock.Quote.QuoteData.Product.Symbol = symbol;
                string url = GetURL(2, symbol);
                Console.WriteLine(url);
                Stream stream = GetResponse(url);
                //            responseXML = eTradeModel.GetQuote(symbol, "ALL");
                //            WriteXML(responseXML);
                StreamReader sr   = new StreamReader(stream);
                string       line = sr.ReadLine(); // skip the header
                while (sr.Peek() >= 0)
                {
                    line = sr.ReadLine();
                    stock.Parse(line);
                    stock.Save(DataService);
                }

                //stock = StockQuote.ReadStockQuote(Symbol.Id, responseXML);
            } while (StockSymbols.Instance.Index > 0);
            //            _messages.AddMessage("Asked for " + symbol + ", Received " + stock.Quote.QuoteData.Product.Symbol);
        }