互联网+时代,说建站,谈运营与网络营销
东台做网站公司最近项目上有遇到需要查看股票信息的需要,之前都是使用新浪股票的接口,直接根据js调用就能获取到实时股票信息
但是因为新浪禁用http方式调用了,东台做网站公司调用会返回错误信息,导致越来越多依赖它的股票插件不能使用.现在需要使用https://hq.sinajs.cn/list=sz002851,并指定 referer=https://finance.sina.com.cn 才可以获取信息.
以下是测试接口截图:
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″,“买2”
13:”26.90″,“买2”
14:”14700″,“买1”
15:”26.89″,“买1”
16:”14300″,“买4”
17:”26.88″,“买4”
18:”15100″,“买5”
19:”26.87″,“买5”
20:”3100″,“卖一”申报3100股,即31手;
21:”26.92″,“卖一”报价
(22, 23), (24, 25), (26,27), (28, 29)分别为“卖2”至“卖4的情况”
30:”2008-01-11″,日期;
31:”15:05:32″,时间;
但是因为需要指定 referer=https://finance.sina.com.cn 这种方式比较麻烦,所以我换了腾讯的接口.也是直接调用js就可以
返回值:
array(83)
0: "51"
1: "麦格米特"
2: "002851"
3: "29.01"
4: "28.63"
5: "28.70"
6: "37705"
7: "17248"
8: "20457"
9: "29.00"
10: "25"
11: "28.99"
12: "97"
13: "28.98"
14: "50"
15: "28.97"
16: "72"
17: "28.96"
18: "4"
19: "29.01"
20: "22"
21: "29.02"
22: "22"
23: "29.04"
24: "9"
25: "29.05"
26: "10"
27: "29.06"
28: "6"
29: ""
30: "20230214161427"
31: "0.38"
32: "1.33"
33: "29.20"
34: "28.52"
35: "29.01/37705/109076540"
36: "37705"
37: "10908"
38: "0.92"
39: "38.77"
40: ""
41: "29.20"
42: "28.52"
43: "2.38"
44: "119.07"
45: "144.34"
46: "4.34"
47: "31.49"
48: "25.77"
49: "1.24"
50: "179"
51: "28.93"
52: "35.57"
53: "37.12"
54: ""
55: ""
56: "1.35"
57: "10907.6540"
58: "0.0000"
59: "0"
60: " "
61: "gp-a"
62: "11.75"
63: "0.17"
64: "0.55"
65: "11.18"
66: "5.65"
67: "33.80"
68: "16.19"
69: "2.62"
70: "12.79"
71: "3.53"
72: "410456095"
73: "497569343"
74: "56.47"
75: "48.15"
76: "410456095"
77: ""
78: ""
79: "2.76"
80: "-0.07"
81: ""
82: "cny"
length: 83
返回值含义:
0: 未知
1: 名字
2: 代码
3: 当前费用
4: 昨收
5: 今开
6: 成交量(手)
7: 外盘
8: 内盘
9: 买一
10: 买一量(手)
11-18: 买2 买5
19: 卖一
20: 卖一量
21-28: 卖2 卖5
29: 最近逐笔成交
30: 时间
31: 涨跌
32: 涨跌%
33: 最高
34: 最低
35: 费用/成交量(手)/成交额
36: 成交量(手)
37: 成交额(万)
38: 换手率
39: 市盈率
40: 最高
41: 最低
42: 振幅
43: 流通市值
44: 总市值
45: 市净率
46: 涨停价
47: 跌停价.