public static string Get(string quote) { using (var stockClient = new StockQuoteSoapClient()) { return(stockClient.GetQuote(quote)); } }
public Stock GetQuote(string codename) { StockQuoteSoapClient stckclient = new StockQuoteSoapClient(); var quote = stckclient.GetQuote(codename); return XmlToStock(quote); }
public decimal GetQuote(string symbol) { var s = new StockQuoteSoapClient(); var doc = new XmlDocument(); doc.LoadXml(s.GetQuote(symbol)); var ele = doc.SelectSingleNode("StockQuotes/Stock/Last"); return Convert.ToDecimal(ele.InnerText); }
private static double GetStockQuoteGoogle() { StockQuoteSoapClient client = new StockQuoteSoapClient(); var data = client.GetQuote("GOOG"); // convert string to stream byte[] byteArray = Encoding.ASCII.GetBytes(data); MemoryStream stream = new MemoryStream( byteArray ); XmlReader reader = XmlReader.Create(stream); XDocument doc = XDocument.Load(reader); var stockQuotes = from sq in doc.Root.Elements("Stock").Elements("Open") select sq; double val; double.TryParse(stockQuotes.First().Value, out val); return val; }