接口用途
指数、行业、概念等树形结构。仅 isleaf=1 的叶子节点 code 可作为「板块成分」类接口的 sector_code。
请求地址
POST https://liangmai.pro/api/gateway统一网关调用,query 参数携带 token(访问令牌)与 api=sector_catalog(接口名),其余为业务参数。
返回字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
name | string | 节点名称 |
Code | string | 节点代码 |
type1 | number | 一级分类:0 A股 1 创业板 2 科创板 3 基金 …(完整枚举见返回数据说明) |
type2 | number | 二级分类:申万行业、概念、地域、指数成分等细分 |
Level | number | 层级,根为 0 |
pcode | string | 父节点代码 |
pname | string | 父节点名称 |
isleaf | number | 是否叶子:1 可作为成分查询参数 |
调用示例
Python
import requests
url = "https://liangmai.pro/api/gateway"
params = {
"token": "YOUR_TOKEN",
"api": "sector_catalog",
}
r = requests.post(url, params=params)
print(r.json())PHP
$url = "https://liangmai.pro/api/gateway";
$data = [
'token' => 'YOUR_TOKEN',
'api' => 'sector_catalog',
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
echo $res;JavaScript
const params = new URLSearchParams({
token: "YOUR_TOKEN",
api: "sector_catalog",
});
fetch("https://liangmai.pro/api/gateway", {
method: "POST",
body: params
})
.then(r => r.json())
.then(data => console.log(data));更新与限流
数据更新:约每周六凌晨批量刷新(以实际为准)。
调用限制:受您当前 Token 的每分钟请求上限约束;高峰时可能排队或短暂不可用。
注意事项
- type1/type2 完整枚举较长,可按需在本地建映射表。