一、腾讯接口
1.1 每日行情及基本面
参考:https://blog.csdn.net/ustbhacker/article/details/8365756
接口:
1. http://qt.gtimg.cn/q=sz000858 (可以批量获取:,sh600004)
2. 沪市将sz换成sh
返回结果:
v_sz000858="51~五 粮 液~000858~27.78~27.60~27.70~417909~190109~227800~27.78~492~27.77~332~27.76~202~27.75~334~27.74~291~27.79~305~27.80~570~27.81~269~27.82~448~27.83~127~15:00:13/27.78/4365/S/12124331/24602|14:56:55/27.80/14/S/38932/24395|14:56:52/27.81/116/B/322585/24392|14:56:49/27.80/131/S/364220/24385|14:56:46/27.81/5/B/13905/24381|14:56:43/27.80/31/B/86199/24375~20121221150355~0.18~0.65~28.11~27.55~27.80/413544/1151265041~417909~116339~1.10~10.14~~28.11~27.55~2.03~1054.39~1054.52~3.64~30.36~24.84~";
以 ~ 分割字符串中内容,下标从0开始,依次为
0: 未知
1: 名字
2: 代码
3: 当前价格
4: 昨收
5: 今开
6: 成交量(手)
7: 外盘
8: 内盘
9: 买一
10: 买一量(手)
11-18: 买二 买五
19: 卖一
20: 卖一量
21-28: 卖二 卖五
29: 最近逐笔成交
30: 时间
31: 涨跌
32: 涨跌%
33: 最高
34: 最低
35: 价格/成交量(手)/成交额
36: 成交量(手)
37: 成交额(万)
38: 换手率
39: 市盈率
40:
41: 最高
42: 最低
43: 振幅
44: 流通市值
45: 总市值
46: 市净率
47: 涨停价
48: 跌停价
2.2 实时资金流向
接口如下:
http://qt.gtimg.cn/q=ff_sz000858
返回数据:
v_ff_sz000858="sz000858~41773.67~48096.67~-6322.99~-5.53~10200.89~14351.02~-4150.13~-3.63~114422.25~53015.90~59770.57~五 粮 液~20121221";
以 ~ 分割字符串中内容,下标从0开始,依次为:
0: 代码
1: 主力流入
2: 主力流出
3: 主力净流入
4: 主力净流入/资金流入流出总和
5: 散户流入
6: 散户流出
7: 散户净流入
8: 散户净流入/资金流入流出总和
9: 资金流入流出总和1+2+5+6
10: 未知
11: 未知
12: 名字
13: 日期
2.3 盘口数据
接口地址:
http://qt.gtimg.cn/q=s_pksz000858
返回结果:
v_s_pksz000858="0.196~0.258~0.221~0.325";
以 ~ 分割字符串中内容,下标从0开始,依次为:
0: 买盘大单
1: 买盘小单
2: 卖盘大单
3: 卖盘小单
2.4 简要信息
接口URL:
http://qt.gtimg.cn/q=s_sz000858
返回结果:
v_s_sz000858="51~五 粮 液~000858~27.78~0.18~0.65~417909~116339~~1054.52";
以 ~ 分割字符串中内容,下标从0开始,依次为:
0: 未知
1: 名字
2: 代码
3: 当前价格
4: 涨跌
5: 涨跌%
6: 成交量(手)
7: 成交额(万)
8:
9: 总市值
二、新浪接口
2.1 实时股票行情
http://hq.sinajs.cn/list=sh601006 (可以一次性请求多个如: https://hq.sinajs.cn/list=sh601003,sh601001)
返回结果:
var 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, 2008-01-11, 15:05:32”;
这个字符串由许多数据拼接在一起,不同含义的数据用逗号隔开了,按照程序员的思路,顺序号从0开始。
0:”大秦铁路”,股票名字;
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:”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:”2008-01-11″,日期;
31:”15:05:32″,时间;
指数实时行情
请求URL:
https://hq.sinajs.cn/list=gb_$dji,gb_ixic,gb_$inx,hf_GC,hf_CL,DINIW,s_sh000001,rt_hkHSI,b_NKY
参数说明:
gb_$dji : 道琼斯指数
gb_ixic : 纳斯达克
gb_$inx : 标普指数
hf_GC :纽约黄金
hq_str_hf_CL : 纽约原油
hq_str_DINIW : 美元指数
hq_str_s_sh000001 :上证指数
hq_str_rt_hkHSI :恒生指数
hq_str_b_NKY :日经225指数
结果返回:
var hq_str_gb_$dji="道琼斯,24737.1992,0.75,2019-01-26 05:50:25,183.9600,24687.2109,24860.1504,24676.7500,26951.8105,21712.5293,376894369,311157037,0,0.00,0.0,0.00,0.00,0.00,0.00,0,0.00,0.0000,0.00,0.00,,Jan 25 04:50PM EST,24553.2402,0.00";
var hq_str_gb_ixic="纳斯达克,7164.8645,1.29,2019-01-26 09:33:28,91.4029,7128.1848,7174.5556,7111.0919,8133.2998,6190.1699,2236080967,1941799680,0,0.00,--,0.00,0.00,0.00,0.00,0,0.00,0.0000,0.00,0.00,,Jan 25 05:16PM EST,7073.4616,0.00";
var hq_str_gb_$inx="标普指数,2664.7600,0.85,2019-01-26 05:50:25,22.4300,2657.4399,2672.3799,2657.3301,2940.9099,2346.5801,2499715080,2368668062,0,0.00,0.0,0.00,0.00,0.00,0.00,0,0.00,0.0000,0.00,0.00,,Jan 25 04:50PM EST,2642.3301,0.00";
var hq_str_hf_GC="1302.5,1.7737,1302.3,1302.5,1303.4,1278.9,06:00:01,1279.8,1280.1,17144,0,0,2019-01-26,纽约黄金";
var hq_str_hf_CL="53.55,0.7905,53.52,53.60,53.94,52.91,06:00:01,53.13,53.17,44346,0,0,2019-01-26,纽约原油";
var hq_str_DINIW="06:13:19,95.8093,95.8093,96.5523,8438,96.5403,96.5753,95.7315,95.8093,美元指数,2019-01-26";
var hq_str_s_sh000001="上证指数,2601.7234,10.0299,0.39,1593940,13541517";
var hq_str_rt_hkHSI="HSI,恒生指数,27282.881,27120.979,27569.189,27217.750,27569.189,448.210,1.650,0.000,0.000,106401976.236,0,0.000,0.000,33484.078,24540.631,2019/01/25,16:08:50,,,,,,";
var hq_str_b_NKY="日经225指数,20794.2305,219.60,1.07,1:15 AM,14:15:00,2019-01-25,13:59:00,20791.3203,20574.6300,20794.2305,20791.3203,0";
三、搜狐财经
3.1 历史数据
优缺点:
优点:JSON数据结果容易处理;获取速度快。
缺点:每次只能获取100个节点的数据;API经常变动。
接口:
http://q.stock.sohu.com/hisHq?code=[股票市场和代码]8&start=[开始日期]&end=[结束日期]&stat=1&order=D&period=d&callback=historySearchHandler&rt=jsonp
示例URL:
http://q.stock.sohu.com/hisHq?code=cn_000001&start=20180409&end=20180409&stat=1&order=D&period=d&callback=historySearchHandler&rt=jsonp
结果:
historySearchHandler([{
"status": 0,
"hq": [
["2018-04-09", "10.80", "11.02", "0.15", "1.38%", "10.73", "11.10", "1074796", "118008.44", "0.64%"]
],
"code": "cn_000001",
"stat": ["累计:", "2018-04-09至2018-04-09", "0.15", "1.38%", 10.73, 11.1, 1074796, 118008.44, "0.64%"]
}])
hp解释:
0:日期
1:开盘价
2:收盘价
3:上涨金额
4:涨幅
5:最低价
6:最高价
7:换手量
8:换手额
9:换手率
四、网易财经
4.1 历史数据
参考: http://www.360doc.com/content/17/0330/12/3046928_641381117.shtml https://blog.csdn.net/garyyding/article/details/44962959
接口如下:
http://quotes.money.163.com/service/chddata.html?code=0000001&start=19901219&end=20130208&fields=TCLOSE;HIGH;LOW;TOPEN;LCLOSE;CHG;PCHG;VOTURNOVER;VATURNOVER
说明:
code: 深市六位代码前加“1”,沪市股票代码前加“0”
start: 开始日期,如果想得到每只股票的所有历史交易数据,可以以公司上市日期来表达,8位数字,分别为yyyymmdd
end: 结束日期,表示的也是yyyymmdd八位数字
fields字段包括了开盘价、最高价、最低价、收盘价等。。。具体如下:
附录:
- https://blog.csdn.net/luanpeng825485697/article/details/78442062
- https://blog.csdn.net/NarutoInspire/article/details/72716724
- https://blog.csdn.net/zai_yuzhong/article/details/51735769