ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:105.82KB ,
资源ID:5080599      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5080599.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(股票证券实时股票数据接口大全 精品.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

股票证券实时股票数据接口大全 精品.docx

1、股票证券实时股票数据接口大全 精品表單的頂端披星戴月C+博客 首页 新随笔 联系 聚合 管理 posts - 34, ments - 5, trackbacks - 0 实时股票数据接口大全转 实时股票数据接口大全 股票数据的获取目前有如下两种方法可以获取:1. http/javascript接口取数据2. web-service接口1.http/javascript接口取数据1.1Sina股票数据接口 以大秦铁路(股票代码:601006)为例,如果要获取它的最新行情,只需访问新浪的股票数据接口:http:/hq.sinajs./list=sh601006这个url会返回一串文本,例如:var

2、 hq_str_sh601006=大秦铁路, 27.55, 27.25, 26.91, 27.55, 26.20, 26.91, 26.92, 22114263, 589824680, 4695, 26.91, 57590, 26.90, 14700, 26.89, 14300,26.88, 15100, 26.87, 3100, 26.92, 8900, 26.93, 14230, 26.94, 25150, 26.95, 15220, 26.96, 20XX-01-11, 15:05:32;这个字符串由许多数据拼接在一起,不同含义的数据用逗号隔开了,按照程序员的思路,顺序号从0开始。0:”

3、大秦铁路”,股票名字;1:”27.55,今日开盘价;2:”27.25,昨日收盘价;3:”26.91,当前价格;4:”27.55,今日最高价;5:”26.20,今日最低价;6:”26.91,竞买价,即“买一”报价;7:”26.92,竞卖价,即“卖一”报价;8:”22114263,成交的股票数,由于股票交易以一百股为基本单位,所以在使用时,通常把该值除以一百;9:”589824680,成交金额,单位为“元”,为了一目了然,通常以“万元”为成交金额的单位,所以通常把该值除以一万;10:”4695,“买一”申请4695股,即47手;11:”26.91,“买一”报价;12:”57590,“买二”13:”

4、26.90,“买二”14:”14700,“买三”15:”26.89,“买三”16:”14300,“买四”17:”26.88,“买四”18:”15100,“买五”19:”26.87,“买五”20:”3100,“卖一”申报3100股,即31手;21:”26.92,“卖一”报价(22, 23), (24, 25), (26,27), (28, 29)分别为“卖二”至“卖四的情况”30:”20XX-01-11,日期;31:”15:05:32,时间;一个简单的JavaScript应用例子: var elements=hq_str_sh601006.split( , ); document.write(

5、current price : +elements3); 这段代码输出大秦铁路(股票代码:601006)的当前股价current price:14.20如果你要同时查询多个股票,那么在URL最后加上一个逗号,再加上股票代码就可以了;比如你要一次查询大秦铁路(601006)和大同煤业(601001)的行情,就这样使用URL:http:/hq.sinajs./list=sh601003,sh601001查询大盘指数,比如查询上证综合指数(000001):http:/hq.sinajs./list=s_sh000001服务器返回的数据为:var hq_str_s_sh000001=上证指数,3094

6、.668,-128.073,-3.97,436653,5458126;数据含义分别为:指数名称,当前点数,当前价格,涨跌率,成交量(手),成交额(万元);查询深圳成指数:http:/hq.sinajs./list=s_sz399001对于股票的K线图,日线图等的获取可以通过请求http:/image.sinajs././*.gif此URL获取,其中*代表股票代码,详见如下:查看日K线图:http:/image.sinajs./newchart/daily/n/sh601006.gif分时线的查询:http:/image.sinajs./newchart/min/n/sh000001.gif日K

7、线查询:http:/image.sinajs./newchart/daily/n/sh000001.gif周K线查询:http:/image.sinajs./newchart/weekly/n/sh000001.gif月K线查询:http:/image.sinajs./newchart/monthly/n/sh000001.gif1.2 Baidu&Google的财经数据 在baidu, google中搜索某只股票代码时,将会在头条显示此股票的相关信息,例如在google搜索601006时,第一条搜索结果如下图:通过点击左边的图片我们发现会将此图片链接到sina财经频道上,也就是说google

8、股票数据的获取也是从sina获取。后经抓包分析,发现google也是采用1.1中介绍的接口。Baidu的股票数据来自baidu的财经频道http:/stock.baidu./1.3 其他方式 除了sina,baidu等网站提供股票信息外,其他网站也有类似的接口。我们分析了一款论坛上采用的股票插件,其中有关于实时股票数据获取的介绍,详见如下代码,其中可以看到有些数据来自sina。以下是ASP示例:%= file: stock_getdata.asp version: 1.0.0 copyright (c) czie. all rights reserved. web: http:/.czie.=

9、 function gethttp(rurl) dim xml on error resume next set xml=server.createobject(Microsoft.XMLHTTP) xml.open get,rurl,false xml.send if not xml.readystate=4 or not xml.status=200 or err then gethttp=:exit function gethttp=xml.responsetext set xml=nothing end function function getstockdata(code) 0=股票

10、名称,1=开盘价格,2=昨收盘价格,3=当前价格,4=最高价,5=最低价,30,31=更新时间 dim checkcode,stockdata,stockdatasplit if len(code)5 then stockdata=0,0,0,0,0,0,0,0,0,0,0,0:exit function checkcode=mid(code,len(code)-5,1) if int(checkcode)=5 then stockdata=gethttp(http:/hq.sinajs./list=sh&code&) if not len(stockdata)=0 then stockdat

11、a=split(stockdata,chr(34)(1) end if if len(stockdata)=0 then stockdata=0,0,0,0,0,0,0,0,0,0,0,0 else stockdatasplit=split(stockdata,) stockdata=&exstock.checkstr(stockdatasplit(0)&,&stockdatasplit(1)&,&stockdatasplit(2)&,&stockdatasplit(3)&,&stockdatasplit(4)&,&stockdatasplit(5)&,&formatdatetime(&sto

12、ckdatasplit(30)& &stockdatasplit(31)&,0)& end if 0=股票名称,1=开盘价格,2=昨收盘价格,3=当前价格,4=最高价,5=最低价,6=更新时间 getstockdata=stockdata end function function getstockimg(code) dim rndnum,addnum,checkcode,imgsource if len(code)5 then exit function addnum=4 randomize:rndnum=cint(rnd*addnum) select case rndnum case 0

13、getstockimg=http:/.10jqka./curve/kline/?code=&code& imgsource=http:/.10jqka. case 1 getstockimg=http:/stock.jrj./htmdata/KLINE/&code&.png imgsource=http:/stock.jrj. case 2 checkcode=mid(code,len(code)-5,1) if int(checkcode)=5 then getstockimg=http:/image.sinajs./newchart/daily/n/sh&code&.gif end if

14、imgsource=http:/finance.sina. case 3 getstockimg=http:/hq.gazxfe./stockchart/realline.chart?&code&1003&SZ 500 330 imgsource=http:/hq.gazxfe. case 4 getstockimg=http:/chartse.stockstar./chartserver?code=&code& imgsource=http:/.stockstar./ end select getstockimg=split(&getstockimg&|&imgsource&,|) end

15、function function getastockimg() dim rndnum,addnum,checkcode dim getastockimgb,imgsource addnum=6 randomize:rndnum=cint(rnd*addnum) select case rndnum case 0 getastockimg=http:/202.109.106.1/gifchartse/gif/000001.gif getastockimgb=http:/202.109.106.1/gifchartse/gif/399001.gif imgsource=http:/.stocks

16、tar./ case 1 getastockimg=http:/money.163./special/100.gif?C39 getastockimgb=http:/money.163./special/101.gif?HrS imgsource=http:/.163. case 2 getastockimg=http:/.10jqka./curve/realtime/index2.php?code=1a0001&w=180&h=140 getastockimgb=http:/.10jqka./curve/realtime/index2.php?code=399001&w=180&h=140

17、imgsource=http:/.10jqka. case 3 getastockimg=http:/chart.list./stockchart/realline.chart?1a0001&1002&SZ 180 140 getastockimgb=http:/chart.list./stockchart/realline.chart?399001&1002&SZ 180 140 imgsource=http:/chart.list./ case 4 getastockimg=http:/image.sinajs./newchart/small/ish000001.gif?118917655

18、8328 getastockimgb=http:/image.sinajs./newchart/small/isz399001.gif?1189176558328 imgsource=http:/.sinajs. case 5 getastockimg=http:/218.1.72.66/cgi/pic/sh/realtime/JA000001164143.png getastockimgb=http:/218.1.72.66/cgi/pic/sz/realtime/JA399001164143.png imgsource=http:/.stock./ case 6 getastockimg=

19、http:/222.73.29.85/img/000001.png getastockimgb=http:/222.73.29.85/img/399001.png imgsource=http:/.eastmoney./ end select getastockimg=split(&getastockimg&|&getastockimgb&|&imgsource&,|) end function%2. web-service接口2.1 CHINAstock的web-service: http:/.webxml./WebServices/ChinaStockWebService.asmx中国股票

20、行情数据 WEB 服务(支持深圳和上海股市的全部基金、债券和股票),数据即时更新。输出GIF分时走势图、日/周/月 K 线图、及时行情数据(股票名称、行情时间、最新价、昨收盘、今开盘、涨跌额、最低、最高、涨跌幅、成交量、成交额、竞买价、竞卖价、委比、买一 - 买五、卖一 - 卖五)。此WEB服务提供了如下几个接口:2.1.1 getStockImageByCodeGET 股票GIF分时走势图INput:theStockCode = 股票代号,如:sh000001POST /WebServices/ChinaStockWebService.asmx HTTP/1.1Host: .webxml.Content-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: http:/WebXml./getStockImageByCodesoap:Envelope xmlns:xsi=http:/.w3.org/2001/XMLSchema-instance xmlns:xsd=http:/.w3.org/2001/XMLSchema xmlns:soap=http:/schemas.xmlsoap.org/soap

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1