新浪行情 vb代码
Sub 新浪行情() Cells.Clear Dim n As Integer, Js As Object Dim i As Integer, j As Integer, m As Integer, a As Object, arrdata(1 To 10000, 1 To 24) Set Js = CreateObject("scriptcontrol") Js.Language = "jscript" With CreateObject("Msxml2.XMLHTTP") .Open "GET", "http://money.finance.sina.com.cn/d/api/openapi_proxy.php/?__s=[[%22hq%22,%22hs_a%22,%22%22,0,1,40]]", False .send Js.addcode "var dy= " & .responsetext n = Application.WorksheetFunction.RoundUp((Js.eval("dy[0].count") / 80), 0) For i = 1 To n .Open "GET", "http://money.finance.sina.com.cn/d/api/openapi_proxy.php/?__s=[[%22hq%22,%22hs_a%22,%22%22,0,"& i &",80]]", False'这里已经修改,引用了变量i .send Js.addcode "dy= " & .responsetext For Each a In Js.eval("dy[0].items") m = m + 1 For j = 0 To 23 arrdata(m, j + 1) = CallByName(a, j, VbGet) Next j Next a Next i End With [a2].Resize(m, 24) = arrdata End Sub
/** |
* ["symbol","code","name","trade","pricechange","changepercent","buy","sell","settlement","open","high","low","volume","amount","ticktime","per","per_d","nta","pb","mktcap","nmc","turnoverratio","favor","guba"] |
* @Title: parseResult |
* @Description: |
* @return
|
*/
http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page=1&num=100&sort=symbol&asc=1&node=hs_a&symbol=&_s_r_a=init
https://www.zhihu.com/question/22145919