1、指定股票 查询接口例: http://bdcjhq.hexun.com/quote?s2=000001.sh,399001.sz,399300.sz,601186.sh
返回结果: <html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK"><script type='text/javascript'>document.domain='hexun.com';</script></head><body></body><script>try{parent.bdcallback({"399001.sz":{na:"深证成指",pc:"11446.372",op:"11459.016",vo:"2193906",tu:"379028",hi:"11624.467",lo:"11459.016",la:"11558.021",type:"1",time:"2011-01-26 11:30:22"},"399300.sz":{na:"沪深300 ",pc:"2938.654",op:"2939.773",vo:"21205501",tu:"2559517",hi:"2971.763",lo:"2939.356",la:"2960.847",type:"1",time:"2011-01-26 11:31:07"},"601186.sh":{na:"中国铁建",pc:"7.22",op:"7.22",vo:"174035",tu:"12804",hi:"7.42",lo:"7.22",la:"7.39",type:"2",time:"2011-01-26 11:30:15",sy:"18.45",lt:"24.50",sz:"911.74",hs:"0.71",is:"0"},"tofnow":{time:"2011-01-26 11:37:51"}})}catch(e){}</script></html> 从返回的结果看,股票数据应该就是JSON串,因此解析就比较方便了。 各个字段的意义如下: "601186.sh": //股票代码 { na:"中国铁建", //股票中文名称 pc:"7.22", //昨收盘 op:"7.22", //今开盘 vo:"174035", //成交量 tu:"12804", //成交额 hi:"7.42", //最高价 lo:"7.22", //最低价 la:"7.39", //现价 type:"2", //类型,1:指数,2:股票? time:"2011-01-26 11:30:15", //时间 sy:"18.45", //市盈率= 现价/最近四个季度摊薄每股收益之和 lt:"24.50", //流通股数(单位:亿股) sz:"911.74", //总市值(单位:亿) hs:"0.71", //换手率 is:"0" // ??暂时未知 } 2、指定市场 sURL = "http://quote.tool.hexun.com/hqzx/quote.aspx?type=" & hType & "&market=" & hMarket & "&sorttype=3&updown=up&page=1&count=3000" txtContent = GetWebData(sURL) For i = 0 To UBound(arrT1) arrT2 = Split(arrT1(i), ",") strCode = Mid(arrT2(0), InStrRev(arrT2(0), "[") + 1) strCode = Trim(Replace(strCode, "'", "")) arrData(i + 1, 0) = "'" & strCode '股票代码 arrData(i + 1, 1) = Trim(Replace(arrT2(1), "'", "")) '股票名称 arrData(i + 1, 2) = arrT2(2) '最新价 arrData(i + 1, 3) = arrT2(3) '涨跌幅 arrData(i + 1, 4) = arrT2(4) '昨收 arrData(i + 1, 5) = arrT2(5) '开盘 arrData(i + 1, 6) = arrT2(6) '最高 arrData(i + 1, 7) = arrT2(7) '最低 arrData(i + 1, 8) = arrT2(8) '成交量 arrData(i + 1, 9) = arrT2(9) '成交额 arrData(i + 1, 10) = arrT2(10) '换手率 arrData(i + 1, 11) = arrT2(11) '振幅 arrData(i + 1, 12) = arrT2(12) '量比 arrData(i + 1, 13) = Date '当前日期 arrData(i + 1, 14) = Time '当前时间 Next i _cType:0,1,2,3,4,5分别为全部/专业指数/A股/B股/基金/债券; _cMarket:0,1,2分别为全部/上海/深圳 |
|