首页好灵数据 资料我的资料 自选我的自选股 邀请我的邀请奖励 API 我的API 财务财务中心
帮助关于

接口说明/ API

接口说明: 返回指数代码大全.

接口地址: http://i.h0.cn/base.php      返回格式: json

请求方式: HTTP协议,支持GET/POST方法。     调试工具: 测试工具


请求参数/ Request parameter
1、系统级参数(所有接口都需要的参数):
参数名称 类型 示例值 必须 描述
m_id Int 10001 好灵数据网 会员MID
sign String 698d51a19d8a121ce581499d7b701668 数字签名 sign = md5( $token . md5($bjtime))
[PHP CODE: $token = 您的token; $bjtime = date("YmdHi")]
[说明: $bjtime = date("YmdHi") 即:$bjtime = "年月日时分";即:201801010930;]
2、应用级参数(每个接口有自己的参数):
参数名称 类型 默认值 示例值 必须 描述
actNmae String zhishuCode 接口名称(固定: actName=zhishuCode)
page Int 1 1 或 2 或 3 每次接口返回50条记录,多于50条,传page分页

返回参数/ Return parameter

JSON格式返回结果。

1、系统级参数(所有接口都会返回的参数):
名称 类型 示例值 描述
msg String 接口执行情况描述。
code int 100 好灵数据网 接口执行状态,正数代表执行成功,负数代表执行失败。
 100, 接口成功,数据查询成功.
-101,系统签名sign验证失败
2、应用级参数(每个接口有自己独有的返回数值.):
名称 类型 示例值 描述
data array[] 股票分类列表
- s_zscode String 股票编码
- s_zsname String 指数名称

请求示例/ Request example
复制
                      
                    // m_id 你自己的会员ID,请在用户中心=>个人资料中 查看  点击进入
                    $m_id	= 10000;                    
                    date_default_timezone_set('PRC');	// 设置系统时间为北京时间 
                    $ndate	= md5(date("YmdHi"));
                    // 请换成自己的token,请在用户中心=>个人资料中 查看  点击进入
                    $token	= "f5bb0c8de146c67b44babbf4e6584cc0";
                    // 产生访问签名                     
                    $sign 	=  md5($token . $ndate);	
                    // 带上应用及参数获取接口数据 
                    $r = file_get_contents("http://i.h0.cn/base.php?actName=zhishuCode&m_id=$m_id&sign=$sign");
                    $r = json_decode($r,true);
                    print_r($r);
                    
                  
复制
                    
                    // m_id 你自己的会员ID,请在用户中心=>个人资料中 查看  点击进入
                    var m_id	= '';

                    var ndate	= md5加密的时间 //如:md5(201905051200)[年月日时分];
                    // 请换成自己的token,请在用户中心=>个人资料中 查看  点击进入
                    var token	= "";
                    // 产生访问签名 
                    var sign 	=  md5(token . ndate);
                    // 带上应用及参数获取接口数据 
                    var xhr = new XMLHttpRequest();
                    xhr.open('POST', 'http://i.h0.cn/base.php', true);
                    xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
                    xhr.send('actName=zhishuCode&m_id='+mid+'&sign='+sign);
                    xhr.onreadystatechange = function () {//请求后的回调接口,可将请求成功后要执行的程序写在其中
                        if (xhr.readyState == 4 && xhr.status == 200) {//验证请求是否发送成功
                            var json = xhr.responseText;//获取到服务端返回的数据
                            console.log(json);
                        }
                    };
                    
                  
复制
                    
                    // m_id 你自己的会员ID,请在用户中心=>个人资料中 查看  点击进入
                    m_id	= '';

                    ndate	= md5加密的时间 //如:md5(201905051200)[年月日时分];
                    // 请换成自己的token,请在用户中心=>个人资料中 查看  点击进入
                    token	= "";
                    // 产生访问签名 
                    sign 	=  md5(token . ndate);
                    // 带上应用及参数获取接口数据 
                    curl -X POST
                    -H "Content-Type: application/x-www-form-urlencoded"
                    -d 'actName=zhishuCode&m_id=[m_id]&sign=[sign]'
                    http://i.h0.cn/base.php
                    
                  
复制
                    
                    # -*- coding: utf-8 -*-
                    import time,hashlib,requests,json

                    # 解析输出的数据
                    def output(json_str):
                        return json.dumps(json.loads(json_str),indent=4,ensure_ascii=False)

                    m_id = '' #你的ID   点击进入
                    token = ''  #你的token 点击进入

                    # 时间要用北京时间(系统时间)
                    ndate = time.strftime("%Y%m%d%H%M",time.localtime())
                    m = hashlib.md5()
                    b = ndate.encode(encoding='utf-8')
                    m.update(b)
                    ndate = m.hexdigest()

                    m = hashlib.md5()
                    c = str(token+ndate).encode(encoding='utf-8')
                    m.update(c)
                    sign = m.hexdigest()

                    param1={'actName':'zhishuCode','m_id':m_id,'sign':sign}
                    url='http://i.h0.cn/base.php'
                    req = requests.post(url,data=param1)
                    result = req.text
                    print(output(result))
                    
                  
复制
                                         
					// 等待添加... 

                    
                  
复制
                    
					// 等待添加... 
                    
                  
net
Android
GO
NodeJS
IOS

返回示例/ Return example
JSON:
{"code":100,"msg":"\u6570\u636e\u83b7\u53d6\u6210\u529f.","page":"1","pageTotal":9,"dataNums":50,"data":[{"s_zscode":"sh000001","s_zsname":"\u4e0a\u8bc1\u7efc\u6307"},{"s_zscode":"sh000002","s_zsname":"\u4e0a\u8bc1A\u6307"},{"s_zscode":"sh000003","s_zsname":"\u4e0a\u8bc1B\u6307"},{"s_zscode":"sh000004","s_zsname":"\u4e0a\u8bc1\u5de5\u4e1a\u7c7b\u6307\u6570"},{"s_zscode":"sh000005","s_zsname":"\u4e0a\u8bc1\u5546\u4e1a\u7c7b\u6307\u6570"},{"s_zscode":"sh000006","s_zsname":"\u4e0a\u8bc1\u623f\u5730\u4ea7\u6307\u6570"},{"s_zscode":"sh000007","s_zsname":"\u4e0a\u8bc1\u516c\u7528\u4e8b\u4e1a\u80a1\u6307\u6570"},{"s_zscode":"sh000008","s_zsname":"\u4e0a\u8bc1\u7efc\u5408\u80a1\u6307\u6570"},{"s_zscode":"sh000009","s_zsname":"\u4e0a\u8bc1380"},{"s_zscode":"sh000010","s_zsname":"\u4e0a\u8bc1180"},{"s_zscode":"sh000015","s_zsname":"\u4e0a\u8bc1\u7ea2\u5229"},{"s_zscode":"sh000016","s_zsname":"\u4e0a\u8bc150"},{"s_zscode":"sh000017","s_zsname":"\u65b0\u7efc\u6307"},{"s_zscode":"sh000018","s_zsname":"180\u91d1\u878d"},{"s_zscode":"sh000019","s_zsname":"\u6cbb\u7406\u6307\u6570"},{"s_zscode":"sh000020","s_zsname":"\u4e2d\u578b\u7efc\u6307"},{"s_zscode":"sh000021","s_zsname":"180\u6cbb\u7406"},{"s_zscode":"sh000025","s_zsname":"180\u57fa\u5efa"},{"s_zscode":"sh000026","s_zsname":"180\u8d44\u6e90"},{"s_zscode":"sh000027","s_zsname":"180\u8fd0\u8f93"},{"s_zscode":"sh000028","s_zsname":"180\u6210\u957f"},{"s_zscode":"sh000029","s_zsname":"180\u4ef7\u503c"},{"s_zscode":"sh000030","s_zsname":"180R\u6210\u957f"},{"s_zscode":"sh000031","s_zsname":"180R\u4ef7\u503c"},{"s_zscode":"sh000032","s_zsname":"\u4e0a\u8bc1\u80fd\u6e90"},{"s_zscode":"sh000033","s_zsname":"\u4e0a\u8bc1\u6750\u6599"},{"s_zscode":"sh000034","s_zsname":"\u4e0a\u8bc1\u5de5\u4e1a"},{"s_zscode":"sh000035","s_zsname":"\u4e0a\u8bc1\u53ef\u9009"},{"s_zscode":"sh000036","s_zsname":"\u4e0a\u8bc1\u6d88\u8d39"},{"s_zscode":"sh000037","s_zsname":"\u4e0a\u8bc1\u533b\u836f"},{"s_zscode":"sh000038","s_zsname":"\u4e0a\u8bc1\u91d1\u878d"},{"s_zscode":"sh000039","s_zsname":"\u4e0a\u8bc1\u4fe1\u606f"},{"s_zscode":"sh000040","s_zsname":"\u4e0a\u8bc1\u7535\u4fe1"},{"s_zscode":"sh000041","s_zsname":"\u4e0a\u8bc1\u516c\u7528"},{"s_zscode":"sh000042","s_zsname":"\u4e0a\u8bc1\u592e\u4f01"},{"s_zscode":"sh000043","s_zsname":"\u8d85\u5927\u76d8"},{"s_zscode":"sh000044","s_zsname":"\u4e0a\u8bc1\u4e2d\u76d8"},{"s_zscode":"sh000045","s_zsname":"\u4e0a\u8bc1\u5c0f\u76d8"},{"s_zscode":"sh000046","s_zsname":"\u4e0a\u8bc1\u4e2d\u5c0f"},{"s_zscode":"sh000047","s_zsname":"\u4e0a\u8bc1\u5168\u6307"},{"s_zscode":"sh000048","s_zsname":"\u8d23\u4efb\u6307\u6570"},{"s_zscode":"sh000049","s_zsname":"\u4e0a\u8bc1\u6c11\u4f01"},{"s_zscode":"sh000050","s_zsname":"50\u7b49\u6743"},{"s_zscode":"sh000051","s_zsname":"180\u7b49\u6743"},{"s_zscode":"sh000052","s_zsname":"50\u57fa\u672c"},{"s_zscode":"sh000053","s_zsname":"180\u57fa\u672c"},{"s_zscode":"sh000054","s_zsname":"\u4e0a\u8bc1\u6d77\u5916"},{"s_zscode":"sh000055","s_zsname":"\u4e0a\u8bc1\u5730\u4f01"},{"s_zscode":"sh000056","s_zsname":"\u4e0a\u8bc1\u56fd\u4f01"},{"s_zscode":"sh000057","s_zsname":"\u5168\u6307\u6210\u957f"}]}
JSON转数组后:
Array
(
    [code] => 100
    [msg] => 数据获取成功.
    [page] => 1
    [pageTotal] => 9
    [dataNums] => 50
    [data] => Array
        (
            [0] => Array
                (
                    [s_zscode] => sh000001
                    [s_zsname] => 上证综指
                )

            [1] => Array
                (
                    [s_zscode] => sh000002
                    [s_zsname] => 上证A指
                )

            [2] => Array
                (
                    [s_zscode] => sh000003
                    [s_zsname] => 上证B指
                )

            [3] => Array
                (
                    [s_zscode] => sh000004
                    [s_zsname] => 上证工业类指数
                )

            [4] => Array
                (
                    [s_zscode] => sh000005
                    [s_zsname] => 上证商业类指数
                )

            [5] => Array
                (
                    [s_zscode] => sh000006
                    [s_zsname] => 上证房地产指数
                )

            [6] => Array
                (
                    [s_zscode] => sh000007
                    [s_zsname] => 上证公用事业股指数
                )

            [7] => Array
                (
                    [s_zscode] => sh000008
                    [s_zsname] => 上证综合股指数
                )

            [8] => Array
                (
                    [s_zscode] => sh000009
                    [s_zsname] => 上证380
                )

            [9] => Array
                (
                    [s_zscode] => sh000010
                    [s_zsname] => 上证180
                )

            [10] => Array
                (
                    [s_zscode] => sh000015
                    [s_zsname] => 上证红利
                )

            [11] => Array
                (
                    [s_zscode] => sh000016
                    [s_zsname] => 上证50
                )

            [12] => Array
                (
                    [s_zscode] => sh000017
                    [s_zsname] => 新综指
                )

            [13] => Array
                (
                    [s_zscode] => sh000018
                    [s_zsname] => 180金融
                )

            [14] => Array
                (
                    [s_zscode] => sh000019
                    [s_zsname] => 治理指数
                )

            [15] => Array
                (
                    [s_zscode] => sh000020
                    [s_zsname] => 中型综指
                )

            [16] => Array
                (
                    [s_zscode] => sh000021
                    [s_zsname] => 180治理
                )

            [17] => Array
                (
                    [s_zscode] => sh000025
                    [s_zsname] => 180基建
                )

            [18] => Array
                (
                    [s_zscode] => sh000026
                    [s_zsname] => 180资源
                )

            [19] => Array
                (
                    [s_zscode] => sh000027
                    [s_zsname] => 180运输
                )

            [20] => Array
                (
                    [s_zscode] => sh000028
                    [s_zsname] => 180成长
                )

            [21] => Array
                (
                    [s_zscode] => sh000029
                    [s_zsname] => 180价值
                )

            [22] => Array
                (
                    [s_zscode] => sh000030
                    [s_zsname] => 180R成长
                )

            [23] => Array
                (
                    [s_zscode] => sh000031
                    [s_zsname] => 180R价值
                )

            [24] => Array
                (
                    [s_zscode] => sh000032
                    [s_zsname] => 上证能源
                )

            [25] => Array
                (
                    [s_zscode] => sh000033
                    [s_zsname] => 上证材料
                )

            [26] => Array
                (
                    [s_zscode] => sh000034
                    [s_zsname] => 上证工业
                )

            [27] => Array
                (
                    [s_zscode] => sh000035
                    [s_zsname] => 上证可选
                )

            [28] => Array
                (
                    [s_zscode] => sh000036
                    [s_zsname] => 上证消费
                )

            [29] => Array
                (
                    [s_zscode] => sh000037
                    [s_zsname] => 上证医药
                )

            [30] => Array
                (
                    [s_zscode] => sh000038
                    [s_zsname] => 上证金融
                )

            [31] => Array
                (
                    [s_zscode] => sh000039
                    [s_zsname] => 上证信息
                )

            [32] => Array
                (
                    [s_zscode] => sh000040
                    [s_zsname] => 上证电信
                )

            [33] => Array
                (
                    [s_zscode] => sh000041
                    [s_zsname] => 上证公用
                )

            [34] => Array
                (
                    [s_zscode] => sh000042
                    [s_zsname] => 上证央企
                )

            [35] => Array
                (
                    [s_zscode] => sh000043
                    [s_zsname] => 超大盘
                )

            [36] => Array
                (
                    [s_zscode] => sh000044
                    [s_zsname] => 上证中盘
                )

            [37] => Array
                (
                    [s_zscode] => sh000045
                    [s_zsname] => 上证小盘
                )

            [38] => Array
                (
                    [s_zscode] => sh000046
                    [s_zsname] => 上证中小
                )

            [39] => Array
                (
                    [s_zscode] => sh000047
                    [s_zsname] => 上证全指
                )

            [40] => Array
                (
                    [s_zscode] => sh000048
                    [s_zsname] => 责任指数
                )

            [41] => Array
                (
                    [s_zscode] => sh000049
                    [s_zsname] => 上证民企
                )

            [42] => Array
                (
                    [s_zscode] => sh000050
                    [s_zsname] => 50等权
                )

            [43] => Array
                (
                    [s_zscode] => sh000051
                    [s_zsname] => 180等权
                )

            [44] => Array
                (
                    [s_zscode] => sh000052
                    [s_zsname] => 50基本
                )

            [45] => Array
                (
                    [s_zscode] => sh000053
                    [s_zsname] => 180基本
                )

            [46] => Array
                (
                    [s_zscode] => sh000054
                    [s_zsname] => 上证海外
                )

            [47] => Array
                (
                    [s_zscode] => sh000055
                    [s_zsname] => 上证地企
                )

            [48] => Array
                (
                    [s_zscode] => sh000056
                    [s_zsname] => 上证国企
                )

            [49] => Array
                (
                    [s_zscode] => sh000057
                    [s_zsname] => 全指成长
                )
        )
)
Copyright © 好灵数据网 好灵数据网 网站地图 备案号:沪ICP备15043930号-1