Esempio n. 1
0
        public static QuickQuote Fetch(string sym)
        {
            QuickQuote qq = new QuickQuote();

            if (sym == "")
            {
                return(qq);
            }
            WebClient wc  = new WebClient();
            string    res = wc.DownloadString(baseurl + sym);

            res = res.Replace("\"", "");
            string [] r = res.Split(',');
            qq.Symbol  = r[(int)q.sym];
            qq.Company = r[(int)q.company];
            try
            {
                qq.time  = DateTime.Parse(r[(int)q.time]);
                qq.date  = DateTime.Parse(r[(int)q.date]);
                qq.price = Convert.ToDecimal(r[(int)q.last]);
                qq.vol   = Convert.ToInt32(r[(int)q.vol]);
                qq.open  = Convert.ToDecimal(r[(int)q.open]);
                qq.low   = Convert.ToDecimal(r[(int)q.low]);
                qq.high  = Convert.ToDecimal(r[(int)q.high]);
            }
            catch (Exception) {}
            return(qq);
        }
Esempio n. 2
0
        public static QuickQuote Fetch(string sym)
        {
            QuickQuote qq = new QuickQuote();
            if (sym == "") return qq;
            WebClient wc = new WebClient();
            string res  = wc.DownloadString(baseurl + sym);
            res = res.Replace("\"", "");
            string [] r = res.Split(',');
            qq.Symbol = r[(int)q.sym];
            qq.Company = r[(int)q.company];
            try 
            {
                qq.time = DateTime.Parse(r[(int)q.time]);
                qq.date = DateTime.Parse(r[(int)q.date]);
                qq.price = Convert.ToDecimal(r[(int)q.last]);
                qq.vol = Convert.ToInt32(r[(int)q.vol]);
                qq.open = Convert.ToDecimal(r[(int)q.open]);
                qq.low = Convert.ToDecimal(r[(int)q.low]);
                qq.high = Convert.ToDecimal(r[(int)q.high]);
            }
            catch (Exception) {}
            return qq;

        }