|
楼主 |
发表于 2015-3-29 21:45
|
显示全部楼层
补9:
数据采集网址是http://quote.eastmoney.com/center/list.html#33,实现代码所对应的涨跌幅数值
行情中心首页 > 沪深股市 > 沪深A股
- 'GET http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/index.aspx?type=s&sortType=C&sortRule=-1&pageSize=20&page=1&jsName=quote_123&style=33&token=44c9d251add88e27b65ed86506f6e5da&_g=0.4773907992057502
- Sub test()
- Dim strJs, P, arr
- Cells.ClearContents
- With CreateObject("Microsoft.XMLHTTP")
- .Open "GET", "http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/index.aspx?type=s&sortType=C&sortRule=-1&pageSize=1&page=1&jsName=a&style=33&token=44c9d251add88e27b65ed86506f6e5da&_g=" & Rnd, False
- .send
- P = Split(Split(.responsetext, "pages:")(1), "}")(0)
- .Open "GET", "http://hqdigi2.eastmoney.com/EM_Quote2010NumericApplication/index.aspx?type=s&sortType=C&sortRule=-1&pageSize=" & P & "&page=1&jsName=a&style=33&token=44c9d251add88e27b65ed86506f6e5da&_g=" & Rnd, False
- .send
- strJs = .responsetext & ";var b=a.rank;var s=''; for(x in b){ y=b[x].split(',');s+=y.slice(1,3)+'\t'+ y.slice(11,12)+'\r'} "
- End With
- With CreateObject("MSScriptControl.ScriptControl")
- .Language = "javascript"
- strJs = .eval(strJs)
- Debug.Print strJs
- End With
- Debug.Print strJs
- arr = Split(strJs, vbCr)
- With ActiveSheet
- .[a2].Resize(UBound(arr)) = WorksheetFunction.Transpose(arr)
- .[a:a].TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, ConsecutiveDelimiter:=False, Tab:=True, Comma:=True, FieldInfo:=Array(Array(1, 2), Array(2, 2), Array(3, 1))
- End With
- End Sub
复制代码 |
|