public IList <data.PriceInfo> GetPriceByDay(data.customobject obj) { //http://data.gtimg.cn/flashdata/hushen/daily/14/sh000001.js string url = "http://data.gtimg.cn/flashdata/hushen/daily/{0}/{1}.js"; //daily_data_04="\n\ //140102 2112.13 2109.39 2113.11 2101.02 68485486\n\ var code = GetCode(obj); var priceList = new List <data.PriceInfo>(); IList <string> urls = new List <string>(); for (int i = DateTime.Now.Year - 3; i <= DateTime.Now.Year; i++) { string target = string.Format(url, (i.ToString()).Substring(2), code); var tempList = GetStockPriceFromServer(obj.code, target); if (tempList.Count <= 0) { continue; } priceList.AddRange(tempList); } return(priceList); }
public IList <data.PriceInfo> GetPriceByMonth(data.customobject obj) { //////////////http://data.gtimg.cn/flashdata/hushen/monthly/sh000001.js string url = "http://data.gtimg.cn/flashdata/hushen/monthly/{0}.js"; var code = GetCode(obj); return(GetStockPriceFromServer(obj.code, string.Format(url, code))); }
/// <summary> /// 或者针对腾讯网站的编码 /// </summary> /// <param name="obj"></param> /// <returns></returns> private string GetCode(data.customobject obj) { string prifix = string.Empty; if (obj.code.Substring(0, 1) == "0") { prifix = "sh"; } else if (obj.code.Substring(0, 1) == "1") { prifix = "sz"; } return(prifix + obj.code.Substring(1)); }