Ejemplo n.º 1
0
        /// <summary>
        /// 获取实时股票数据(仅限深A)
        /// </summary>
        /// <param name="_stockCode">股票代码</param>
        /// <returns></returns>
        static string[] getSotckData(string _stockCode)
        {
            //ReadWarmingOrder()
            HttpClientTool post = HttpClientTool.GetInstance();
            var            list = new Dictionary <string, string>();
            var            data = "";

            if (_stockCode.StartsWith("0") || _stockCode.StartsWith("3"))
            {
                data = post.doPost("http://hq.sinajs.cn/list=sz" + _stockCode, list);
            }
            else if (_stockCode.StartsWith("6"))
            {
                data = post.doPost("http://hq.sinajs.cn/list=sh" + _stockCode, list);
            }
            else
            {
                return(null);
            }
            data = data.Substring(data.IndexOf(","));

            data = data.Replace("\"", "");
            data = data.Replace(";", "");
            var datalist = data.Split(',');

            return(datalist);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取实时股票数据(仅限深A)
 /// </summary>
 /// <param name="_stockCode">股票代码</param>
 /// <returns></returns>
 static string[] getSotckData(string _stockCode)
 {
     //ReadWarmingOrder()
     HttpClientTool post = HttpClientTool.GetInstance();
     var list = new Dictionary<string, string>();
     var data = post.doPost("http://hq.sinajs.cn/list=sz" + _stockCode, list);
     data = data.Substring(data.IndexOf("\""));
     data = data.Replace("\"", "");
     data = data.Replace(";", "");
     var datalist = data.Split(',');
     return datalist;
 }