Skip to main content
POST
/
v1
/
stock
/
industry-constituents
Industry Constituents
curl --request POST \
  --url https://api.reportify.cn/v1/stock/industry-constituents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "market": "cn",
  "name": "军工",
  "type": "sw"
}
'
import requests

url = "https://api.reportify.cn/v1/stock/industry-constituents"

payload = {
"market": "cn",
"name": "军工",
"type": "sw"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({market: 'cn', name: '军工', type: 'sw'})
};

fetch('https://api.reportify.cn/v1/stock/industry-constituents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.reportify.cn/v1/stock/industry-constituents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'market' => 'cn',
'name' => '军工',
'type' => 'sw'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.reportify.cn/v1/stock/industry-constituents"

payload := strings.NewReader("{\n \"market\": \"cn\",\n \"name\": \"军工\",\n \"type\": \"sw\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.reportify.cn/v1/stock/industry-constituents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"market\": \"cn\",\n \"name\": \"军工\",\n \"type\": \"sw\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.reportify.cn/v1/stock/industry-constituents")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"market\": \"cn\",\n \"name\": \"军工\",\n \"type\": \"sw\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "code": 123,
  "message": "<string>",
  "data": {}
}
{
"status": 123,
"code": 123,
"message": "<string>"
}
{
"status": 123,
"code": 123,
"message": "<string>"
}
{
"status": 123,
"code": 123,
"message": "<string>"
}

查询行业成分股

URL: /v1/stock/industry-constituents
方法: POST
描述: 根据市场和行业名称查询行业成分股列表。

请求参数

参数名类型必填描述
marketstring股票市场:cn(中国)、hk(香港)、us(美国)
namestring行业名称
typestring行业分类类型:sw(申万)、wind、hs(恒生)、GICS。默认:CN 用申万,HK 用恒生,US 用 GICS

响应参数

参数名类型描述
statusintegerHTTP 状态码
codeinteger业务状态码
messagestring响应消息
dataobject响应数据

data 对象结构

参数名类型描述
itemsarray成分股列表

成分股对象结构

参数名类型描述
symbolstring股票代码
marketstring股票市场
namestring公司名称
type_namestring分类类型名称
industry_one_level_namestring一级行业名称
industry_second_level_namestring二级行业名称
industry_third_level_namestring三级行业名称

示例代码

cURL 示例

curl -X POST "https://api.reportify.cn/v1/stock/industry-constituents" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "market": "cn",
    "name": "军工",
    "type": "sw"
  }'

Python 示例

import requests

url = "https://api.reportify.cn/v1/stock/industry-constituents"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
data = {
    "market": "cn",
    "name": "军工",
    "type": "sw"
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

print(f"状态码: {result['status']}")
print(f"成分股数量: {len(result['data']['items'])}")

for item in result['data']['items'][:5]:  # 打印前5个
    print(f"\n股票代码: {item['symbol']}")
    print(f"公司名称: {item['name']}")
    print(f"一级行业: {item['industry_one_level_name']}")
    print(f"二级行业: {item['industry_second_level_name']}")
    print(f"三级行业: {item['industry_third_level_name']}")

TypeScript 示例

const response = await fetch('https://api.reportify.cn/v1/stock/industry-constituents', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    market: 'cn',
    name: '军工',
    type: 'sw'
  })
});

const result = await response.json();
console.log(`成分股数量: ${result.data.items.length}`);

响应示例

成功响应

{
  "status": 200,
  "code": 0,
  "message": "",
  "data": {
    "items": [
      {
        "symbol": "600760",
        "market": "cn",
        "name": "中航沈飞",
        "type_name": "申万2021行业",
        "industry_one_level_name": "国防军工",
        "industry_second_level_name": "航空装备",
        "industry_third_level_name": "航空装备"
      },
      {
        "symbol": "600893",
        "market": "cn",
        "name": "航发动力",
        "type_name": "申万2021行业",
        "industry_one_level_name": "国防军工",
        "industry_second_level_name": "航空装备",
        "industry_third_level_name": "航空装备"
      },
      {
        "symbol": "002013",
        "market": "cn",
        "name": "中航机电",
        "type_name": "申万2021行业",
        "industry_one_level_name": "国防军工",
        "industry_second_level_name": "航空装备",
        "industry_third_level_name": "航空装备"
      }
    ]
  }
}

成功响应(无数据)

{
  "status": 200,
  "code": 0,
  "message": "",
  "data": {
    "items": []
  }
}

行业分类类型说明

type 值适用市场说明
swcn申万行业分类(推荐用于 A 股)
windcnWind 行业分类
hshk恒生行业分类(推荐用于港股)
GICSusGICS 全球行业分类(推荐用于美股)

注意事项

  • market 参数值
    • cn - 中国 A 股市场
    • hk - 香港股票市场
    • us - 美国股票市场
  • type 参数:可选参数,不提供时会根据市场自动选择默认分类类型
  • 行业名称匹配:name 参数支持模糊匹配,例如输入”军工”可以匹配”国防军工”
  • 空响应:如果 data.items 为空数组,说明没有找到匹配的行业成分股

Authorizations

Authorization
string
header
required

Enter your Bearer token

Body

application/json

Input schema for industry constituents query

market
enum<string>
required

Stock market: cn (China), hk (Hong Kong), or us (United States)

Available options:
cn,
hk,
us
Example:

"cn"

name
string
required

Industry name

Example:

"军工"

type
string

Industry classification type: sw (申万), wind, hs (恒生), GICS. Default: sw for CN, hs for HK, GICS for US

Example:

"sw"

Response

Successful Response

Generic response wrapper from stock API

status
integer

HTTP status code

code
integer

Response code (0 for success)

message
string

Response message

data
Data · object

Response data (structure varies by endpoint)