获取股票实时交易数据的方法

标签: 股票 实时 交易 | 发表时间:2015-12-01 23:47 | 作者:wuhuizhong
出处:http://www.iteye.com

调用sina专门的js服务器来获得数据,速度飞快:

http://hq.sinajs.cn/list=sh600151,sz000830,s_sh000001,s_sz399001,s_sz399106,s_sz399107,s_sz399108

var hq_str_sh600151="航天机电,7.08,7.09,6.95,7.08,6.90,6.95,6.96,4368014,30484831,2900,6.95,5700,6.94,11687,6.93,19700,6.92,28200,6.91,700,6.96,6000,6.97,26600,6.98,21701,6.99,104259,7.00,2012-06-12,15:03:05";

var hq_str_sz000830="鲁西化工,4.90,4.93,4.85,4.90,4.83,4.84,4.85,5637089,27390414.02,147400,4.84,123000,4.83,90200,4.82,103300,4.81,280200,4.80,37510,4.85,34949,4.86,27899,4.87,31500,4.88,75400,4.89,2012-06-12,15:05:52";

var hq_str_s_sh000001="上证指数,2289.791,-16.065,-0.70,599419,5529858";

var hq_str_s_sz399001="深证成指,9790.197,-59.573,-0.60,71142542,5714888";

var hq_str_s_sz399106="深证综指,942.182,-3.439,-0.36,49774192,5544763";

var hq_str_s_sz399107="深证A指,985.824,-3.544,-0.36,49558295,5535505";

var hq_str_s_sz399108="深证B指,621.687,-5.293,-0.84,215896,9258";

注:

上证指数(指数名称),2289.791(当前点数),-16.065(涨跌额),-0.70(涨跌幅度),599419(总手),5529858(成交金额)";

"航天机电,名称

7.08,今开

7.09,昨收

6.95,当前

7.08,今日最高

6.90,今日最低

6.95,竞买价,即买一报价

6.96,竞卖价,即卖一报价

4368014,成交的股票数量,应除以100

30484831,成交金额,单位为元

2900,6.95,买一申请股数(29手),买一报价

5700,6.94,买二申请,买二报价

11687,6.93,买三申请,买三报价

19700,6.92,买四申请,买四报价

28200,6.91,买五申请,买五报价

700,6.96,卖一申请,卖一报价

6000,6.97,卖二申请,卖二报价

26600,6.98,卖三申请,卖三报价

21701,6.99,卖四申请,卖四报价

104259,7.00,卖五申请,卖五报价

2012-06-12,日期

15:03:05 时间

一共31个值。

http://hq.sinajs.cn/list=s_sz399001,s_sz399002,s_sz399003,s_sz399010,s_sz399106,s_sz399107,s_sz399108

var hq_str_s_sz399001="深证成指,9790.197,-59.573,-0.60,71142542,5714888";

var hq_str_s_sz399002="成份A指,10776.287,-64.126,-0.59,6351301,791833";

var hq_str_s_sz399003="成份B指,4425.993,-39.460,-0.88,59239,4837";

var hq_str_s_sz399010="深证700,3403.759,-8.677,-0.25,17953551,1896751";

var hq_str_s_sz399106="深证综指,942.182,-3.439,-0.36,49774192,5544763";

var hq_str_s_sz399107="深证A指,985.824,-3.544,-0.36,49558295,5535505";

var hq_str_s_sz399108="深证B指,621.687,-5.293,-0.84,215896,9258";

http://hq.sinajs.cn/list=s_sh000001,s_sh000002,s_sh000003,s_sh000004,s_sh000005,s_sh000006,s_sh000007,s_sh000008

var hq_str_s_sh000001="上证指数,2289.791,-16.065,-0.70,599419,5529858";

var hq_str_s_sh000002="A股指数,2398.401,-16.998,-0.70,597460,5512715";

var hq_str_s_sh000003="B股指数,232.017,1.908,0.83,1958,17143";

var hq_str_s_sh000004="工业指数,1952.040,-17.161,-0.87,306777,3263599";

var hq_str_s_sh000005="商业指数,2650.303,-18.454,-0.69,19013,166771";

var hq_str_s_sh000006="地产指数,3500.208,60.763,1.77,46296,287382";

var hq_str_s_sh000007="公用指数,3769.470,-40.401,-1.06,63828,372671";

var hq_str_s_sh000008="综合指数,1931.844,-10.102,-0.52,163504,1439434";

http://hq.sinajs.cn/list=sh600151,sh600152,sh600153,sz000830,

返回

var hq_str_sh600151="航天机电,7.08,7.09,6.95,7.08,6.90,6.95,6.96,4368014,30484831,2900,6.95,5700,6.94,11687,6.93,19700,6.92,28200,6.91,700,6.96,6000,6.97,26600,6.98,21701,6.99,104259,7.00,2012-06-12,15:03:05";

var hq_str_sh600152="维科精华,6.89,7.10,6.94,6.97,6.48,6.83,6.84,17509035,116787535,4900,6.83,19900,6.82,3500,6.81,38800,6.80,100,6.79,26700,6.84,4000,6.85,1400,6.86,14500,6.89,13600,6.90,2012-06-12,15:03:05";

var hq_str_sh600153="建发股份,7.47,7.52,7.62,7.68,7.46,7.61,7.62,15063933,113836559,537575,7.61,77600,7.60,102600,7.59,93900,7.58,133299,7.57,41400,7.62,39800,7.63,129349,7.64,193540,7.65,130400,7.66,2012-06-12,15:03:05";

var hq_str_sz000830="鲁西化工,4.90,4.93,4.85,4.90,4.83,4.84,4.85,5637089,27390414.02,147400,4.84,123000,4.83,90200,4.82,103300,4.81,280200,4.80,37510,4.85,34949,4.86,27899,4.87,31500,4.88,75400,4.89,2012-06-12,15:05:52";

指数的格式

"s_sh"+"000001"

 

股票代码    股票名称

000001  上证指数

000002  A股指数

000003  B股指数

000004  工业指数

000005  商业指数

000006  地产指数

000007  公用指数

000010  上证180

000011  沪市基金

000012  国债指数

000013  企债指数

000015  红利指数

000016  上证50

000017  新 综 指

000019  治理指数

000042  上证央企

000043  超 大 盘

000049  上证民企

000054  上证海外

000055  上证地企

000056  上证国企

000057  全指成长

000058  全指价值

000059  全R成长

000060  全R价值

000061  沪企债30

000062  上证沪企

000063  上证周期

000064  非周期

000066  上证商品

000067  上证新兴

000300  沪深300

000926  中证央企(上)

000927  央企100(上)

000964  中证新兴

000999  两岸三地

 

 

"s_sz"+"399001"

 

399001  深证成指

399002  成份A指

399003  成份B指

399004  深证100R

399006  创业板指

399101  中小板综

399102  创业板综

399106  深证综指

399107  深证A指

399108  深证B指

399110  农林指数

399120  采掘指数

399130  制造指数

399131  食品指数

399132  纺织指数

399133  木材指数

399134  造纸指数

399135  石化指数

399136  电子指数

399137  金属指数

399138  机械指数

399139  医药指数

399140  水电指数

399150  建筑指数

399160  运输指数

399170  IT指数

399180  批零指数

399190  金融指数

399200  地产指数

399210  服务指数

399220  传播指数

399300  沪深300

399305  深市基金

399323  深证红利

399352  深报综指

399369  CBN-兴业

399481  企债指数

399606  创业板R

399926  中证央企(深)

399927  央企100(深)

http://hq.stock.sohu.com/hqindex/finaceindex/financeindexhq1.js

fortune_hq({"cna":[["上证指数","2289.79","-16.06","-0.70%","http://q.stock.sohu.com/zs/000001/index.shtml"],["深证成指","9790.20","-59.57","-0.60%","http://q.stock.sohu.com/zs/399001/index.shtml"],["中小板综","5253.22","-13.70","-0.26%","http://q.stock.sohu.com/zs/399101/index.shtml"]],"cnb":[["B股指数","232.02","1.91","0.83%","http://q.stock.sohu.com/zs/000003/index.shtml"],["成份B指","4425.99","-39.46","-0.88%","http://q.stock.sohu.com/zs/399003/index.shtml"]],"cnf":[["沪市基金","3824.81","-21.85","-0.57%","http://q.stock.sohu.com/zs/000011/index.shtml"],["深市基金","4601.38","-25.05","-0.54%","http://q.stock.sohu.com/zs/399305/index.shtml"]],"hk":[["恒生指数","18872.56","-81.07","-0.43%","http://q.stock.sohu.com/hk/HSI/index.shtml"],["国企指数","9519.53","-55.27","-0.58%","http://q.stock.sohu.com/hk/HSCEI/index.shtml"],["红筹指数","3789.30","-3.77","-0.10%","http://q.stock.sohu.com/hk/HSCCI/index.shtml"]],"us":[["道琼斯工业指数","12411.23","-142.97","-1.14%","http://q.stock.sohu.com/us/index.shtml?DJI"],["纳斯达克综合指数","2809.73","-48.69","-1.70%","http://q.stock.sohu.com/us/index.shtml?IXIC"],["标准普尔500指数","1312.39","3.46","0.26%","http://q.stock.sohu.com/us/index.shtml?GSPC"]]})

 

http://hq.stock.sohu.com/hqindex/finaceindex/financeindexhq2.js

PEAK_ODIA(['financeindexhq',[['zs_000001','上证指数','2289.79','-16.06','-0.70%','http://q.stock.sohu.com/zs/000001/index.shtml'],['zs_399001','深证成指','9790.20','-59.57','-0.60%','http://q.stock.sohu.com/zs/399001/index.shtml'],['zs_399101','中小板综','5253.22','-13.70','-0.26%','http://q.stock.sohu.com/zs/399101/index.shtml'],['zs_000003','B股指数','232.02','+1.91','0.83%','http://q.stock.sohu.com/zs/000003/index.shtml'],['zs_399003','成份B指','4425.99','-39.46','-0.88%','http://q.stock.sohu.com/zs/399003/index.shtml'],['zs_000011','沪市基金','3824.81','-21.85','-0.57%','http://q.stock.sohu.com/zs/000011/index.shtml'],['zs_399305','深市基金','4601.38','-25.05','-0.54%','http://q.stock.sohu.com/zs/399305/index.shtml'],['HSI','恒生指数','18872.56','-81.07','-0.43%','http://q.stock.sohu.com/hk/HSI/index.shtml'],['HSCCI','红筹指数','3789.30','-3.77','-0.10%','http://q.stock.sohu.com/hk/HSCCI/index.shtml'],['HSCEI','国企指数','9519.53','-55.27','-0.58%','http://q.stock.sohu.com/hk/HSCEI/index.shtml']])

 

http://hq.stock.sohu.com/hqindex/finaceindex/financeindexhq.js

PEAK_ODIA(['financeindexhq',[['zs_000001','上证指数','2289.79','-16.06','-0.70%','http://q.stock.sohu.com/zs/000001/index.shtml'],['zs_399001','深证成指','9790.20','-59.57','-0.60%','http://q.stock.sohu.com/zs/399001/index.shtml'],['zs_399101','中小板综','5253.22','-13.70','-0.26%','http://q.stock.sohu.com/zs/399101/index.shtml'],['zs_000003','沪市B股','232.02','+1.91','0.83%','http://q.stock.sohu.com/zs/000003/index.shtml'],['zs_399003','成份B指','4425.99','-39.46','-0.88%','http://q.stock.sohu.com/zs/399003/index.shtml'],['zs_000011','沪市基金','3824.81','-21.85','-0.57%','http://q.stock.sohu.com/zs/000011/index.shtml'],['zs_399305','深市基金','4601.38','-25.05','-0.54%','http://q.stock.sohu.com/zs/399305/index.shtml'],['HSI','恒生指数','18872.56','-81.07','-0.43%','http://q.stock.sohu.com/hk/HSI/index.shtml'],['HSCEI','国企指数','9519.53','-55.27','-0.58%','http://q.stock.sohu.com/hk/HSCEI/index.shtml'],['HSCCI','红筹指数','3789.30','-3.77','-0.10%','http://q.stock.sohu.com/hk/HSCCI/index.shtml']],[[['cn_600401','海润光伏','7.99','10.06%'],['cn_600978','宜华木业','5.27','7.55%'],['cn_600777','新潮实业','5.35','6.36%'],['cn_600596','新安股份','6.62','6.09%'],['cn_600657','信达地产','5.01','5.92%']],[['cn_601339','N百隆','12.33','-9.34%'],['cn_601908','京运通','8.60','-7.13%'],['cn_600495','晋西车轴','12.30','-6.32%'],['cn_600158','XD中体产','6.99','-6.30%'],['cn_600470','六国化工','10.42','-6.21%']],[['cn_002683','N宏大   ','16.00','10.65%'],['cn_000736','重庆实业','10.85','10.04%'],['cn_002499','科林环保','21.43','10.01%'],['cn_300147','香雪制药','8.37','9.99%'],['cn_300266','兴源过滤','19.07','9.98%']],[['cn_002238','天威视讯','14.74','-9.40%'],['cn_002685','N华重机 ','9.08','-9.11%'],['cn_002682','N龙洲   ','9.76','-7.92%'],['cn_300136','信维通信','15.36','-7.69%'],['cn_002616','长青集团','17.45','-6.03%']]],[['25','S板','8','10.16','+0.12','0.65%','111101','9321','cn_600733','S*ST前锋','18.26','+0.87','5.00%'],['22','房地产','143','7.69','+0.05','0.65%','14823974','1117434','cn_000736','重庆实业','10.85','+0.99','10.04%'],['59','医药板块','188','16.54','+0.16','0.63%','6170241','874796','cn_300147','香雪制药','8.37','+0.76','9.99%'],['39','ST板块','139','7.18','+0.02','0.56%','3426392','203147','cn_600074','ST中达','3.07','+0.15','5.14%'],['291','重庆板块','27','10.57','+0.03','0.40%','1374186','139496','cn_000736','重庆实业','10.85','+0.99','10.04%']]])

---------------------------------------------

http://hq.sinajs.cn/list=s_sh000001 上证指数

 

http://hq.sinajs.cn/list=s_sz399001 深证成指

 

http://hq.sinajs.cn/list=int_hangseng 恒生指数

 

http://hq.sinajs.cn/list=s_sz399300 沪生300

 

http://hq.sinajs.cn/list=int_dji 道琼斯

 

http://hq.sinajs.cn/list=int_nasdaq 纳斯达克

 

http://hq.sinajs.cn/list=int_sp500 标普500

 

http://hq.sinajs.cn/list=int_ftse 英金融时报指数

 

---------------------------------------------------------

期货

http://hq.sinajs.cn/rn=1318986550609&list=hf_CL,hf_GC,hf_SI,hf_CAD,hf_ZSD,hf_S,hf_C,hf_W

var hq_str_hf_CL="83.3500,0.7860,83.3400,83.3500,83.4300,81.0700,22:47:46,82.7000,81.2700,17929,0,0,2012-06-12";

var hq_str_hf_GC="1608.4000,0.7265,1608.3000,1608.4000,1611.6000,1587.0000,22:47:46,1596.8000,1597.1000,17965,0,0,2012-06-12";

var hq_str_hf_SI="28.7500,0.4893,28.7400,28.7500,28.9500,28.3100,22:47:44,28.6100,28.5000,7509,0,0,2012-06-12";

var hq_str_hf_CAD="7392.5000,-0.2133,7390.5000,7392.2998,7444.2998,7328.2998,22:47:46,7408.2998,7368.0000,12568,1,1,2012-06-12";

var hq_str_hf_ZSD="1886.0000,-0.2116,1886.0000,1888.3000,1893.3000,1874.3000,22:47:34,1890.0000,1885.0000,3502,1,2,2012-06-12";

var hq_str_hf_S="1428.5000,0.2632,1428.0000,1428.5000,1449.2500,1416.2500,22:47:46,1424.7500,1426.7500,5144,0,0,2012-06-12";

var hq_str_hf_C="584.5000,-1.2669,584.5000,584.7500,598.5000,575.5000,22:47:45,592.0000,593.5000,3509,0,0,2012-06-12";

var hq_str_hf_W="622.7500,-1.2292,622.7500,623.0000,639.5000,618.2500,22:47:45,630.5000,628.5000,2433,0,0,2012-06-12";

外汇

http://hq.sinajs.cn/rn=1318986628214&list=USDCNY,USDHKD,EURCNY,GBPCNY,USDJPY,EURUSD,GBPUSD,

var hq_str_USDCNY="16:58:22,6.3705,6.3673,6.3692,32,6.3694,6.3782,6.3685,6.3705,美元人民币";

var hq_str_USDHKD="22:48:57,7.7594,7.7596,7.7599,2,7.7601,7.7601,7.7531,7.7594,美元港元";

var hq_str_EURCNY="22:44:55,7.9453,7.9478,7.8917,25,7.9491,7.9725,7.8917,7.9453,欧元人民币";

var hq_str_GBPCNY="22:44:55,9.9032,9.9057,9.7923,25,9.8649,9.9103,9.7923,9.9032,英镑人民币";

var hq_str_USDJPY="22:48:56,79.50,79.50,79.38,0,79.38,79.69,79.15,79.50,美元日元";

var hq_str_EURUSD="22:48:57,1.2468,1.2468,1.2467,0,1.2469,1.2529,1.2441,1.2468,欧元美元";

var hq_str_GBPUSD="22:48:57,1.5537,1.5542,1.5471,5,1.5469,1.5557,1.5454,1.5537,英镑美元";

--------------

日K线

http://image.sinajs.cn/newchart/daily/n/sh601006.gif

周K线

http://image.sinajs.cn/newchart/weekly/n/sh601006.gif

月K线

http://image.sinajs.cn/newchart/monthly/n/sh601006.gif

分时图

http://image.sinajs.cn/newchart/min/n/sh000001.gif

这是一个人(http://blog.csdn.net/jiangxinyu/article/details/6150476)写的java获得数据的代码:

  String url = "http://hq.sinajs.cn/list=sh600151,sz000830,s_sh000001,s_sz399001,s_sz399106";

        try {

            URL u = new URL(url);

            byte[] b = new byte[256];

            InputStream in = null;

            ByteArrayOutputStream bo = new ByteArrayOutputStream();

            while (true) {

                try {

                    in = u.openStream();

                    int i;

                    while ((i = in.read(b)) != -1) {

                        bo.write(b, 0, i);

                    }

                    String result = bo.toString();

                    String[] stocks = result.split(";");

                    for (String stock : stocks) {

                        String[] datas = stock.split(",");

                        //根据对照自己对应数据

                    }

                    bo.reset();

                } catch (Exception e) {

                    System.out.println(e.getMessage());

                } finally {

                    if (in != null) {

                        in.close();

                    }

                }

            }

        } catch (Exception ex) {



已有 0 人发表留言,猛击->> 这里<<-参与讨论


ITeye推荐



相关 [股票 实时 交易] 推荐:

获取股票实时交易数据的方法

- - 互联网 - ITeye博客
调用sina专门的js服务器来获得数据,速度飞快:. var hq_str_s_sh000001="上证指数,2289.791,-16.065,-0.70,599419,5529858";. var hq_str_s_sz399001="深证成指,9790.197,-59.573,-0.60,71142542,5714888";.

sina获取实时股票数据

- - 互联网 - ITeye博客
* 从请求的URL中获取返回的数据流. // setConnectTimeout:设置连接主机超时(单位:毫秒). // setReadTimeout:设置从主机读取数据超时(单位:毫秒). // 设置是否向httpUrlConnection输出,因为这个是post请求,参数要放在 http正文内,因此需要设为true,.

纳斯达克叫停中华网股票交易 已申请破产保护

- Yi - TechWeb 今日焦点 RSS阅读
经过小组听证后决定,中华网投资集团(CDC)股票交易被叫停但许可“店头市场交易”(TechWeb配图).   【搜狐IT消息】10月27日消息,CDC在纳斯达克的股票交易被叫停,CDC的股票代号为“CHINA”,即中华网投资集团. 在经过小组听证之后,CDC或许可以在“店头市场交易”(Over-the-counter Market Transaction)交易.

编程:获取股票实时行情数据大全

- - 鲁塔弗的博客
股票软件都提供自定义公式的功能,但因为常规股票软件都是点播数据,自定义公式对分时行情完全无效,要想更细腻的分析,只能找股票实时行情接口. 一般来说,有如下3种版本. 去门户财经频道采集数据,百度,sina,搜狐,网易,和讯都有. 首推sina,页面结构良好,同时提供js接口和动态gif绘制. sina提供js data url 有很多,到sina网站上仔细研究即可.

挖掘与分析网络中的个人“情绪”数据,股票雷达为用户判断股票走向提供实时支持

- - 36氪
早在2010年10月,国际知名学术网站arXiv.org刊登的一篇研究报告称,Twitter中的“镇定度”水平能够提前2至6天预测道琼斯工业平均指数的走向,并且准确度可达到87.6%. 到去年9月,伦敦投资公司Derwent Captial Markets启动一只总额为2500万英镑的基金,通过评价人们当前的心理状态,例如愉快、悲伤、焦虑和疲倦,来进行投资.

股票API

- 狗尾草 - 博客园-首页原创精华区
股票数据的获取目前有如下两种方法可以获取:. http/javascript接口取数据. 1.http/javascript接口取数据. 以大秦铁路(股票代码:601006)为例,如果要获取它的最新行情,只需访问新浪的股票数据. 这个url会返回一串文本,例如:. var hq_str_sh601006="大秦铁路, 27.55, 27.25, 26.91, 27.55, 26.20, 26.91, 26.92, .

股票市场

- - 人月神话的BLOG
国内市场本质还是一个投机市场而没有价值投资,市场监管机制本身的不完善和信息的不对称性,注定了散户本身的弱势地位. 任何上涨时候的疯狂伴随的都是暴跌时候的毁灭,正是由于这个原因更应该要做到尊重市场和趋势,对市场时刻保持敬畏之心. 对于自己的判断要勇于认错,当持有的股票出现下跌时候,我们习惯性的是找寻支撑该股票上涨的理由或做着不合理的价值分析,即我们不断为自己错误的判断找理由而不是尊重趋势尽快的认错,最终而出现深度的套牢或者亏损,措施下次的机会.

这是那只股票?

- Rooney - 水木社区 Joke/笑话连篇 保留区
发信人: landx (流云远), 信区: Joke. 发信站: 水木社区 (Mon Oct 24 14:18:59 2011), 站内. 半年前,为了鞭策自己减肥,我坚持每天记录自己的体重,填入Excel表格,生成一个走. 势图……今天,同事经过我的座位,只见他走过去了又若有所思地倒了回来,趴我耳边.

好公司与好股票

- 猪不鸣 - 扬韬
如果说技术分析只是小散户的心灵安慰剂,那基本分析会不会是赚钱利器呢. 很遗憾,按照经典的有效市场理论,任何人都不可能通过基本分析获得超额收益. 自然会有人反驳说,巴菲特似乎就是通过基本分析来研判公司价值,并坚持长线投资而获得了远远超出一般人的利润. 这是大家理解的差异,不算狡辩的解释是:他获得的超出常人的那部分收益,源于他付出的超出常人的努力.

选股票的体会

- - 张化桥的 Blog
12月17日在股票分析师午餐会上发言:. (1) 一定不要被自己的行业所限制. 如果你对其它行业的某个股票有特别的兴趣,或者有特别强烈的感觉,管它什么行业. (2)绝大多数股票,如果未来有15%或者20%的上升空间,不要浪费时间写报告. 这证明你没有强烈的感觉,也许你完全错了. 也许这个股票可以上升3倍,只是你完全没有看到而已.