コード例 #1
0
 public static string Get(string quote)
 {
     using (var stockClient = new StockQuoteSoapClient())
     {
         return(stockClient.GetQuote(quote));
     }
 }
コード例 #2
0
        public Stock GetQuote(string codename)
        {
            StockQuoteSoapClient stckclient = new StockQuoteSoapClient();
            var quote = stckclient.GetQuote(codename);
            return XmlToStock(quote);


        }
コード例 #3
0
 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);
 }
コード例 #4
0
ファイル: WebForm1.aspx.cs プロジェクト: Letractively/henoch
        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;
        }