如何不用股票软件查看当前股市行情
lone wolf
2024-04-30 14:39:12
最佳回答
1打开附件的记事本:2将以下代码复制粘贴到文件中(注意:股票代码sh600050,sh600018,sh600008可以自行更改为其他股票代码):stocknames = "sh600050,sh600018,sh600008"result = getdata(stocknames)t = "股票名称 昨收盘 涨跌价(涨跌幅)" & vbtab & "最新价" & vbnewline & " ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄" & vbnewlinefor i = 0 to ubound(result) - 1 tmp = split(result(i), ",") x = 3 if tmp(x) = 0 then x = 2 if tmp(x) >= tmp(2) then jj = "+" else jj = "-" g = tmp(0) & chr(32) & formatnumber(tmp(2)) & chr(32) & jj & formatnumber(abs(tmp(x) - tmp(2)), , -1) & "(" & jj & formatpercent(abs(tmp(x) / tmp(2) - 1), , -1) & ")" & " " & vbtab & formatnumber(tmp(x)) if i < ubound(result) then t = t & g & vbnewlinenextcreateobject("wscript.shell").popup t, 5, "", 4096function getdata(stockcode) url = "http://hq.sinajs.cn/stock.php?rn=@random@&l**t=" & stockcode url = gethttp(url) tmp = split(url, ";") for i = 0 to ubound(tmp) tmp(i) = mid(tmp(i), instr(1, tmp(i), """", vbtextcompare) + 1) if len(tmp(i)) > 3 then tmp(i) = left(tmp(i), len(tmp(i)) - 3) next getdata = tmpend functionfunction gethttp(url) on error resume next set objxml = createobject("microsoft.xmlhttp") with objxml .open "get", url, false, "", "" .send gethttp = .responsebody end with gethttp = bytestobstr(gethttp, "gb2312") set objxml = nothing on error goto 0end functionfunction bytestobstr(strbody, codebase) set objstream = createobject("adodb.stream") with objstream .type = 1 .mode = 3 .open .write strbody .position = 0 .type = 2 .charset = codebase bytestobstr = .readtext end with objstream.close set objstream = nothingend function3保存此文件,并命名为hq.vbs:4找到刚才保存的hq.vbs文件:4此文章未经许可获取自百度经验5双击运行,即可看到股票行情:end 20210311