lixinger-python 0.3.15__py3-none-any.whl → 0.3.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lixinger/__init__.py CHANGED
@@ -45,6 +45,8 @@ from lixinger.api.cn.index import (
45
45
  from lixinger.api.cn.industry import (
46
46
  get_industry_cni_margin_trading,
47
47
  get_industry_sw_2021_bank_statements,
48
+ get_industry_sw_2021_constituents,
49
+ get_industry_sw_2021_fundamental,
48
50
  get_industry_sw_2021_hybrid_statements,
49
51
  get_industry_sw_2021_insurance_statements,
50
52
  get_industry_sw_2021_margin_trading,
@@ -121,6 +123,10 @@ __all__ = [
121
123
  "get_industry_sw_2021_insurance_statements",
122
124
  "get_industry_sw_2021_non_financial_statements",
123
125
  "get_industry_sw_2021_security_statements",
126
+ # Industry constituents (申万2021版)
127
+ "get_industry_sw_2021_constituents",
128
+ # Industry fundamental (申万2021版)
129
+ "get_industry_sw_2021_fundamental",
124
130
  # Macro
125
131
  "get_national_debt",
126
132
  "get_rmb_deposits",
@@ -1,5 +1,9 @@
1
1
  """Industry-related APIs."""
2
2
 
3
+ from lixinger.api.cn.industry.constituents import (
4
+ IndustrySw2021ConstituentsAPI,
5
+ get_industry_sw_2021_constituents,
6
+ )
3
7
  from lixinger.api.cn.industry.fs import (
4
8
  IndustrySw2021BankStatementAPI,
5
9
  IndustrySw2021HybridStatementAPI,
@@ -12,6 +16,10 @@ from lixinger.api.cn.industry.fs import (
12
16
  get_industry_sw_2021_non_financial_statements,
13
17
  get_industry_sw_2021_security_statements,
14
18
  )
19
+ from lixinger.api.cn.industry.fundamental import (
20
+ IndustrySw2021FundamentalAPI,
21
+ get_industry_sw_2021_fundamental,
22
+ )
15
23
  from lixinger.api.cn.industry.margin_trading import (
16
24
  IndustryCniMarginTradingAPI,
17
25
  IndustrySw2021MarginTradingAPI,
@@ -25,6 +33,8 @@ __all__ = [
25
33
  # API Classes
26
34
  "IndustryCniMarginTradingAPI",
27
35
  "IndustrySw2021BankStatementAPI",
36
+ "IndustrySw2021ConstituentsAPI",
37
+ "IndustrySw2021FundamentalAPI",
28
38
  "IndustrySw2021HybridStatementAPI",
29
39
  "IndustrySw2021InsuranceStatementAPI",
30
40
  "IndustrySw2021MarginTradingAPI",
@@ -34,6 +44,8 @@ __all__ = [
34
44
  # Functional APIs
35
45
  "get_industry_cni_margin_trading",
36
46
  "get_industry_sw_2021_bank_statements",
47
+ "get_industry_sw_2021_constituents",
48
+ "get_industry_sw_2021_fundamental",
37
49
  "get_industry_sw_2021_hybrid_statements",
38
50
  "get_industry_sw_2021_insurance_statements",
39
51
  "get_industry_sw_2021_margin_trading",
@@ -0,0 +1,19 @@
1
+ """Industry constituents APIs.
2
+
3
+ This module provides access to industry constituent APIs by industry
4
+ classification system:
5
+
6
+ - sw_2021: 申万2021版行业 (Shenwan 2021)
7
+ """
8
+
9
+ from lixinger.api.cn.industry.constituents.sw_2021 import (
10
+ IndustrySw2021ConstituentsAPI,
11
+ get_industry_sw_2021_constituents,
12
+ )
13
+
14
+ __all__ = [
15
+ # API Classes
16
+ "IndustrySw2021ConstituentsAPI",
17
+ # Functional APIs
18
+ "get_industry_sw_2021_constituents",
19
+ ]
@@ -0,0 +1,122 @@
1
+ """Industry (申万2021版) constituents APIs."""
2
+
3
+ from typing import Any
4
+
5
+ import pandas as pd
6
+
7
+ from lixinger.api.base import BaseAPI
8
+ from lixinger.models.cn.industry.constituents.sw_2021 import IndustrySw2021Constituent
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class IndustrySw2021ConstituentsAPI(BaseAPI):
14
+ """申万2021版行业成分股 API."""
15
+
16
+ async def get_constituents(
17
+ self,
18
+ stock_codes: list[str],
19
+ date: str = "latest",
20
+ ) -> pd.DataFrame:
21
+ """获取申万2021版行业成分股列表.
22
+
23
+ 获取申万2021版行业分类在指定日期的成分股列表. 可按行业代码批量查询获取
24
+ 指定时间样本信息, 返回信息包括每只成分股的代码、地区和市场信息.
25
+ 注意该行业划分多从2021年开始, 更早的时间可能没有数据. 当用户需要查看
26
+ 申万2021行业成分股列表、获取成分股清单或确认股票行业分类时, 调用此接口.
27
+
28
+ API Endpoint: /cn/industry/constituents/sw_2021
29
+ API Method: POST
30
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/industry/constituents/sw_2021
31
+
32
+ Args:
33
+ stock_codes: 申万2021版行业代码列表, 长度 >=1 且 <=100, 例如
34
+ ``["490000"]``. 请参考行业信息API获取合法的stockCode.
35
+ date: 信息日期 (YYYY-MM-DD, 北京时间) 或 ``"latest"``, 默认 ``"latest"``.
36
+
37
+ Returns:
38
+ DataFrame containing sw_2021 industry constituents with columns:
39
+
40
+ - industry_stock_code: 行业代码
41
+ - stock_code: 成分股代码
42
+ - area_code: 地区代码
43
+ - market: 市场
44
+ - stock_name_cn: 股票中文名称
45
+ - stock_name_en: 股票英文名称
46
+
47
+ Example:
48
+ 获取申万2021版行业成分股列表::
49
+
50
+ from lixinger import AsyncLixingerClient
51
+
52
+ async with AsyncLixingerClient() as client:
53
+ df = await client.cn_industry.constituents.sw_2021.get_constituents(
54
+ stock_codes=["490000"],
55
+ date="latest",
56
+ )
57
+ print(df)
58
+
59
+ """
60
+ payload: dict[str, Any] = {
61
+ "date": date,
62
+ }
63
+ if stock_codes:
64
+ payload["stockCodes"] = stock_codes
65
+
66
+ data = await self._request("POST", "/cn/industry/constituents/sw_2021", json=payload)
67
+
68
+ # Flatten nested response: one row per constituent per industry, with the
69
+ # nested stockName {cmn_hans_cn, en} broken out into separate columns.
70
+ flattened_data: list[dict[str, Any]] = []
71
+ for item in data:
72
+ industry_stock_code = item.get("stockCode")
73
+ for constituent in item.get("constituents", []):
74
+ stock_name = constituent.get("stockName") or {}
75
+ flattened_data.append(
76
+ {
77
+ "industry_stock_code": industry_stock_code,
78
+ "stock_code": constituent.get("stockCode"),
79
+ "area_code": constituent.get("areaCode"),
80
+ "market": constituent.get("market"),
81
+ "stock_name_cn": stock_name.get("cmn_hans_cn") if isinstance(stock_name, dict) else None,
82
+ "stock_name_en": stock_name.get("en") if isinstance(stock_name, dict) else None,
83
+ }
84
+ )
85
+
86
+ return get_response_df(flattened_data, IndustrySw2021Constituent)
87
+
88
+
89
+ # Functional API instance
90
+ _api_instance = IndustrySw2021ConstituentsAPI()
91
+
92
+
93
+ @api
94
+ async def get_industry_sw_2021_constituents(
95
+ stock_codes: list[str],
96
+ date: str = "latest",
97
+ ) -> pd.DataFrame:
98
+ """获取申万2021版行业成分股列表.
99
+
100
+ Args:
101
+ stock_codes: 申万2021版行业代码列表.
102
+ date: 信息日期 (YYYY-MM-DD) 或 ``"latest"``, 默认 ``"latest"``.
103
+
104
+ Returns:
105
+ DataFrame containing sw_2021 industry constituents.
106
+
107
+ Example:
108
+ 获取申万2021版行业成分股列表::
109
+
110
+ from lixinger import get_industry_sw_2021_constituents
111
+
112
+ df = await get_industry_sw_2021_constituents(
113
+ stock_codes=["490000"],
114
+ date="latest",
115
+ )
116
+ print(df)
117
+
118
+ """
119
+ return await _api_instance.get_constituents(
120
+ stock_codes=stock_codes,
121
+ date=date,
122
+ )
@@ -0,0 +1,19 @@
1
+ """Industry fundamental data APIs.
2
+
3
+ This module provides access to industry fundamental (valuation) APIs by
4
+ industry classification system:
5
+
6
+ - sw_2021: 申万2021版行业 (Shenwan 2021)
7
+ """
8
+
9
+ from lixinger.api.cn.industry.fundamental.sw_2021 import (
10
+ IndustrySw2021FundamentalAPI,
11
+ get_industry_sw_2021_fundamental,
12
+ )
13
+
14
+ __all__ = [
15
+ # API Classes
16
+ "IndustrySw2021FundamentalAPI",
17
+ # Functional APIs
18
+ "get_industry_sw_2021_fundamental",
19
+ ]
@@ -0,0 +1,153 @@
1
+ """Industry (申万2021版) fundamental data APIs."""
2
+
3
+ from typing import Any
4
+
5
+ import pandas as pd
6
+
7
+ from lixinger.api.base import BaseAPI
8
+ from lixinger.models.cn.industry.fundamental.sw_2021 import IndustrySw2021Fundamental
9
+ from lixinger.utils.api import api
10
+ from lixinger.utils.dataframe import get_response_df
11
+
12
+
13
+ class IndustrySw2021FundamentalAPI(BaseAPI):
14
+ """申万2021版行业基本面数据 API."""
15
+
16
+ async def get_fundamental( # noqa: PLR0913
17
+ self,
18
+ stock_codes: list[str],
19
+ metrics: list[str],
20
+ date: str | None = None,
21
+ start_date: str | None = None,
22
+ end_date: str | None = None,
23
+ limit: int | None = None,
24
+ ) -> pd.DataFrame:
25
+ """获取申万2021版行业基本面估值数据.
26
+
27
+ 获取申万2021版行业的基本面估值数据及相关统计数据. 可按行业代码、日期或
28
+ 时间范围进行筛选, 由用户指定需要的指标返回对应的日数据. 指标包括
29
+ PE-TTM、PB、PS-TTM、股息率、市值、A股市值、流通市值、自由流通市值,
30
+ 以及 PE-TTM、PB、PS-TTM、股息率的在不同时间周期(1年/3年/5年/10年/20年/
31
+ 上市以来) 下的统计数据(分位点、20%分位点对应值、50%分位点对应值、
32
+ 80%分位点对应值、最大值、最小值、平均值). 当用户需要比较不同申万2021版
33
+ 行业的估值高低、查看历史估值分位或做行业估值择时分析时, 调用此接口.
34
+
35
+ API Endpoint: /cn/industry/fundamental/sw_2021
36
+ API Method: POST
37
+ API Doc: https://www.lixinger.com/open/api/doc?api-key=cn/industry/fundamental/sw_2021
38
+
39
+ Args:
40
+ stock_codes: 申万2021版行业代码列表, 长度 >=1 且 <=100. 需要注意的是,
41
+ 当传入 start_date 时只能传入一个行业代码.
42
+ metrics: 指标数组, 例如 ``["mc", "pe_ttm.ew", "pe_ttm.y10.ew.cvpos"]``.
43
+ 共有三种形式的指标格式:
44
+
45
+ - ``[metricsName].[granularity].[metricsType].[statisticsDataType]``:
46
+ 支持指标有 pe_ttm, pb, ps_ttm, dyr (股息率)
47
+ - ``[metricsName].[metricsType]``: 支持指标有
48
+ dyr (股息率), pe_ttm, pb, ps_ttm
49
+ - ``[metricsName]``: 被剩余的指标支持, 如 mc (市值),
50
+ tv (成交量), ta (成交金额) 等
51
+ date: 指定日期 (YYYY-MM-DD, 北京时间), 与 start_date 二选一.
52
+ start_date: 信息起始时间 (YYYY-MM-DD, 北京时间), 与 date 二选一.
53
+ 开始和结束的时间间隔不超过10年.
54
+ end_date: 信息结束时间 (YYYY-MM-DD, 北京时间), 默认值是上周一.
55
+ 需要与 start_date 一起使用.
56
+ limit: 返回最近数据的数量, 仅在请求数据为 date range 的情况下生效.
57
+
58
+ Returns:
59
+ DataFrame containing sw_2021 industry fundamental data with columns:
60
+
61
+ - date: 数据时间
62
+ - stock_code: 行业代码
63
+ - 请求的指标列 (例如 ``pe_ttm.mcw``, ``pe_ttm.y10.mcw.cvpos``, ``mc``)
64
+
65
+ Example:
66
+ 通过日期获取申万2021版行业基本面数据::
67
+
68
+ from lixinger import AsyncLixingerClient
69
+
70
+ async with AsyncLixingerClient() as client:
71
+ df = await client.cn_industry.fundamental.sw_2021.get_fundamental(
72
+ stock_codes=["490000"],
73
+ metrics=["pe_ttm.y10.mcw.cvpos", "pe_ttm.mcw", "mc"],
74
+ date="2026-06-02",
75
+ )
76
+ print(df)
77
+
78
+ 通过时间范围获取申万2021版行业基本面数据::
79
+
80
+ async with AsyncLixingerClient() as client:
81
+ df = await client.cn_industry.fundamental.sw_2021.get_fundamental(
82
+ stock_codes=["490000"],
83
+ metrics=["pe_ttm.y10.mcw.cvpos", "pe_ttm.mcw", "mc"],
84
+ start_date="2025-06-13",
85
+ end_date="2026-06-13",
86
+ )
87
+ print(df)
88
+
89
+ """
90
+ payload: dict[str, Any] = {
91
+ "stockCodes": stock_codes,
92
+ "metricsList": metrics,
93
+ }
94
+ if date is not None:
95
+ payload["date"] = date
96
+ if start_date is not None:
97
+ payload["startDate"] = start_date
98
+ if end_date is not None:
99
+ payload["endDate"] = end_date
100
+ if limit is not None:
101
+ payload["limit"] = limit
102
+
103
+ data = await self._request("POST", "/cn/industry/fundamental/sw_2021", json=payload)
104
+ return get_response_df(data, IndustrySw2021Fundamental)
105
+
106
+
107
+ # Functional API instance
108
+ _api_instance = IndustrySw2021FundamentalAPI()
109
+
110
+
111
+ @api
112
+ async def get_industry_sw_2021_fundamental( # noqa: PLR0913
113
+ stock_codes: list[str],
114
+ metrics: list[str],
115
+ date: str | None = None,
116
+ start_date: str | None = None,
117
+ end_date: str | None = None,
118
+ limit: int | None = None,
119
+ ) -> pd.DataFrame:
120
+ """获取申万2021版行业基本面估值数据.
121
+
122
+ Args:
123
+ stock_codes: 申万2021版行业代码列表.
124
+ metrics: 指标数组.
125
+ date: 指定日期 (YYYY-MM-DD), 与 start_date 二选一.
126
+ start_date: 信息起始时间 (YYYY-MM-DD), 与 date 二选一.
127
+ end_date: 信息结束时间 (YYYY-MM-DD).
128
+ limit: 返回最近数据的数量, 仅在 date range 请求下生效.
129
+
130
+ Returns:
131
+ DataFrame containing sw_2021 industry fundamental data.
132
+
133
+ Example:
134
+ 通过日期获取申万2021版行业基本面数据::
135
+
136
+ from lixinger import get_industry_sw_2021_fundamental
137
+
138
+ df = await get_industry_sw_2021_fundamental(
139
+ stock_codes=["490000"],
140
+ metrics=["pe_ttm.y10.mcw.cvpos", "pe_ttm.mcw", "mc"],
141
+ date="2026-06-02",
142
+ )
143
+ print(df)
144
+
145
+ """
146
+ return await _api_instance.get_fundamental(
147
+ stock_codes=stock_codes,
148
+ metrics=metrics,
149
+ date=date,
150
+ start_date=start_date,
151
+ end_date=end_date,
152
+ limit=limit,
153
+ )
@@ -4,6 +4,7 @@ from typing import Any
4
4
 
5
5
  import pandas as pd
6
6
 
7
+ from lixinger.api.cn.industry.constituents.sw_2021 import IndustrySw2021ConstituentsAPI
7
8
  from lixinger.api.cn.industry.fs.sw_2021.bank import IndustrySw2021BankStatementAPI
8
9
  from lixinger.api.cn.industry.fs.sw_2021.hybrid import IndustrySw2021HybridStatementAPI
9
10
  from lixinger.api.cn.industry.fs.sw_2021.insurance import IndustrySw2021InsuranceStatementAPI
@@ -11,6 +12,7 @@ from lixinger.api.cn.industry.fs.sw_2021.non_financial import (
11
12
  IndustrySw2021NonFinancialStatementAPI,
12
13
  )
13
14
  from lixinger.api.cn.industry.fs.sw_2021.security import IndustrySw2021SecurityStatementAPI
15
+ from lixinger.api.cn.industry.fundamental.sw_2021 import IndustrySw2021FundamentalAPI
14
16
  from lixinger.api.cn.industry.margin_trading.cni import IndustryCniMarginTradingAPI
15
17
  from lixinger.api.cn.industry.margin_trading.sw import IndustrySwMarginTradingAPI
16
18
  from lixinger.api.cn.industry.margin_trading.sw_2021 import (
@@ -106,6 +108,44 @@ class IndustryFSNamespace:
106
108
  self.sw_2021 = sw_2021
107
109
 
108
110
 
111
+ class IndustryConstituentsNamespace:
112
+ """Namespace for industry constituents APIs.
113
+
114
+ Groups all industry constituent APIs by industry classification system:
115
+
116
+ - sw_2021: 申万2021版行业成分股
117
+
118
+ """
119
+
120
+ def __init__(self, sw_2021: IndustrySw2021ConstituentsAPI) -> None:
121
+ """Initialize the industry constituents namespace.
122
+
123
+ Args:
124
+ sw_2021: 申万2021版行业成分股 API
125
+
126
+ """
127
+ self.sw_2021 = sw_2021
128
+
129
+
130
+ class IndustryFundamentalNamespace:
131
+ """Namespace for industry fundamental (valuation) APIs.
132
+
133
+ Groups all industry fundamental APIs by industry classification system:
134
+
135
+ - sw_2021: 申万2021版行业基本面数据
136
+
137
+ """
138
+
139
+ def __init__(self, sw_2021: IndustrySw2021FundamentalAPI) -> None:
140
+ """Initialize the industry fundamental namespace.
141
+
142
+ Args:
143
+ sw_2021: 申万2021版行业基本面数据 API
144
+
145
+ """
146
+ self.sw_2021 = sw_2021
147
+
148
+
109
149
  class IndustryNamespace:
110
150
  """Namespace for industry-related APIs.
111
151
 
@@ -122,6 +162,10 @@ class IndustryNamespace:
122
162
  - fs.sw_2021.insurance: 申万2021版保险类行业财报
123
163
  - fs.sw_2021.non_financial: 申万2021版非金融类行业财报
124
164
  - fs.sw_2021.security: 申万2021版证券类行业财报
165
+ - constituents: 行业成分股 API 组
166
+ - constituents.sw_2021: 申万2021版行业成分股
167
+ - fundamental: 行业基本面数据 API 组
168
+ - fundamental.sw_2021: 申万2021版行业基本面数据
125
169
 
126
170
  """
127
171
 
@@ -135,6 +179,8 @@ class IndustryNamespace:
135
179
  fs_sw_2021_insurance: IndustrySw2021InsuranceStatementAPI,
136
180
  fs_sw_2021_non_financial: IndustrySw2021NonFinancialStatementAPI,
137
181
  fs_sw_2021_security: IndustrySw2021SecurityStatementAPI,
182
+ constituents_sw_2021: IndustrySw2021ConstituentsAPI,
183
+ fundamental_sw_2021: IndustrySw2021FundamentalAPI,
138
184
  ) -> None:
139
185
  """Initialize the industry namespace.
140
186
 
@@ -147,6 +193,8 @@ class IndustryNamespace:
147
193
  fs_sw_2021_insurance: 申万2021版保险类行业财报 API
148
194
  fs_sw_2021_non_financial: 申万2021版非金融类行业财报 API
149
195
  fs_sw_2021_security: 申万2021版证券类行业财报 API
196
+ constituents_sw_2021: 申万2021版行业成分股 API
197
+ fundamental_sw_2021: 申万2021版行业基本面数据 API
150
198
 
151
199
  """
152
200
  self.margin_trading = IndustryMarginTradingNamespace(
@@ -163,6 +211,12 @@ class IndustryNamespace:
163
211
  security=fs_sw_2021_security,
164
212
  ),
165
213
  )
214
+ self.constituents = IndustryConstituentsNamespace(
215
+ sw_2021=constituents_sw_2021,
216
+ )
217
+ self.fundamental = IndustryFundamentalNamespace(
218
+ sw_2021=fundamental_sw_2021,
219
+ )
166
220
 
167
221
  # Convenience aliases for shorter access
168
222
  async def get_sw_margin_trading(self, *args: Any, **kwargs: Any) -> pd.DataFrame:
@@ -196,3 +250,11 @@ class IndustryNamespace:
196
250
  async def get_sw_2021_security_statements(self, *args: Any, **kwargs: Any) -> pd.DataFrame:
197
251
  """Alias for fs.sw_2021.security.get_security_statements."""
198
252
  return await self.fs.sw_2021.security.get_security_statements(*args, **kwargs)
253
+
254
+ async def get_sw_2021_constituents(self, *args: Any, **kwargs: Any) -> pd.DataFrame:
255
+ """Alias for constituents.sw_2021.get_constituents."""
256
+ return await self.constituents.sw_2021.get_constituents(*args, **kwargs)
257
+
258
+ async def get_sw_2021_fundamental(self, *args: Any, **kwargs: Any) -> pd.DataFrame:
259
+ """Alias for fundamental.sw_2021.get_fundamental."""
260
+ return await self.fundamental.sw_2021.get_fundamental(*args, **kwargs)
lixinger/client.py CHANGED
@@ -47,6 +47,8 @@ from lixinger.api.cn.index.namespace import IndexNamespace
47
47
  from lixinger.api.cn.industry import (
48
48
  IndustryCniMarginTradingAPI,
49
49
  IndustrySw2021BankStatementAPI,
50
+ IndustrySw2021ConstituentsAPI,
51
+ IndustrySw2021FundamentalAPI,
50
52
  IndustrySw2021HybridStatementAPI,
51
53
  IndustrySw2021InsuranceStatementAPI,
52
54
  IndustrySw2021MarginTradingAPI,
@@ -261,6 +263,12 @@ class AsyncLixingerClient:
261
263
  cn_industry_fs_sw_2021_security = IndustrySw2021SecurityStatementAPI(
262
264
  self._http_client, self.config, self._rate_limiter
263
265
  )
266
+ cn_industry_constituents_sw_2021 = IndustrySw2021ConstituentsAPI(
267
+ self._http_client, self.config, self._rate_limiter
268
+ )
269
+ cn_industry_fundamental_sw_2021 = IndustrySw2021FundamentalAPI(
270
+ self._http_client, self.config, self._rate_limiter
271
+ )
264
272
 
265
273
  # Industry namespace (groups all industry APIs)
266
274
  self.cn_industry = IndustryNamespace(
@@ -272,6 +280,8 @@ class AsyncLixingerClient:
272
280
  fs_sw_2021_insurance=cn_industry_fs_sw_2021_insurance,
273
281
  fs_sw_2021_non_financial=cn_industry_fs_sw_2021_non_financial,
274
282
  fs_sw_2021_security=cn_industry_fs_sw_2021_security,
283
+ constituents_sw_2021=cn_industry_constituents_sw_2021,
284
+ fundamental_sw_2021=cn_industry_fundamental_sw_2021,
275
285
  )
276
286
 
277
287
  # Legacy flat access for industry APIs (deprecated, for backward compatibility)
@@ -283,6 +293,8 @@ class AsyncLixingerClient:
283
293
  self.cn_industry_fs_sw_2021_insurance = cn_industry_fs_sw_2021_insurance
284
294
  self.cn_industry_fs_sw_2021_non_financial = cn_industry_fs_sw_2021_non_financial
285
295
  self.cn_industry_fs_sw_2021_security = cn_industry_fs_sw_2021_security
296
+ self.cn_industry_constituents_sw_2021 = cn_industry_constituents_sw_2021
297
+ self.cn_industry_fundamental_sw_2021 = cn_industry_fundamental_sw_2021
286
298
 
287
299
  # Macro APIs
288
300
  macro_national_debt = NationalDebtAPI(self._http_client, self.config, self._rate_limiter)
@@ -1,5 +1,6 @@
1
1
  """Industry-related models."""
2
2
 
3
+ from lixinger.models.cn.industry.constituents import IndustrySw2021Constituent
3
4
  from lixinger.models.cn.industry.fs import (
4
5
  IndustrySw2021BankStatementSchema,
5
6
  IndustrySw2021HybridStatementSchema,
@@ -7,6 +8,7 @@ from lixinger.models.cn.industry.fs import (
7
8
  IndustrySw2021NonFinancialStatementSchema,
8
9
  IndustrySw2021SecurityStatementSchema,
9
10
  )
11
+ from lixinger.models.cn.industry.fundamental import IndustrySw2021Fundamental
10
12
  from lixinger.models.cn.industry.margin_trading import (
11
13
  IndustryCniMarginTrading,
12
14
  IndustrySw2021MarginTrading,
@@ -16,6 +18,8 @@ from lixinger.models.cn.industry.margin_trading import (
16
18
  __all__ = [
17
19
  "IndustryCniMarginTrading",
18
20
  "IndustrySw2021BankStatementSchema",
21
+ "IndustrySw2021Constituent",
22
+ "IndustrySw2021Fundamental",
19
23
  "IndustrySw2021HybridStatementSchema",
20
24
  "IndustrySw2021InsuranceStatementSchema",
21
25
  "IndustrySw2021MarginTrading",
@@ -0,0 +1,13 @@
1
+ """Industry constituents models.
2
+
3
+ This module provides Pandera schemas for industry constituent stocks
4
+ organized by industry classification system:
5
+
6
+ - sw_2021: 申万2021版行业成分股
7
+ """
8
+
9
+ from lixinger.models.cn.industry.constituents.sw_2021 import IndustrySw2021Constituent
10
+
11
+ __all__ = [
12
+ "IndustrySw2021Constituent",
13
+ ]
@@ -0,0 +1,24 @@
1
+ """Industry (申万2021版) constituents model."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class IndustrySw2021Constituent(pa.DataFrameModel):
7
+ """申万2021版行业成分股模型.
8
+
9
+ 表示单个申万2021版行业下的一只成分股, 包含所属行业代码、股票代码、
10
+ 地区、市场以及股票名称(中文/英文) 信息.
11
+ """
12
+
13
+ class Config:
14
+ """Pandera configuration."""
15
+
16
+ coerce = True
17
+ strict = False
18
+
19
+ industry_stock_code: pa.typing.Series[str]
20
+ stock_code: pa.typing.Series[str]
21
+ area_code: pa.typing.Series[str]
22
+ market: pa.typing.Series[str]
23
+ stock_name_cn: pa.typing.Series[str] | None = pa.Field(nullable=True)
24
+ stock_name_en: pa.typing.Series[str] | None = pa.Field(nullable=True)
@@ -0,0 +1,13 @@
1
+ """Industry fundamental data models.
2
+
3
+ This module provides Pandera schemas for industry fundamental (valuation)
4
+ data organized by industry classification system:
5
+
6
+ - sw_2021: 申万2021版行业基本面数据
7
+ """
8
+
9
+ from lixinger.models.cn.industry.fundamental.sw_2021 import IndustrySw2021Fundamental
10
+
11
+ __all__ = [
12
+ "IndustrySw2021Fundamental",
13
+ ]
@@ -0,0 +1,23 @@
1
+ """Industry (申万2021版) fundamental data model."""
2
+
3
+ import pandera.pandas as pa
4
+
5
+
6
+ class IndustrySw2021Fundamental(pa.DataFrameModel):
7
+ """申万2021版行业基本面数据模型.
8
+
9
+ 每一行代表某一行业(stockCode)在指定日期(date) 的基本面指标.
10
+ 指标列由请求参数 ``metricsList`` 动态生成(例如
11
+ ``pe_ttm.mcw``, ``pe_ttm.y10.mcw.cvpos``, ``mc`` 等), 因此本 Schema
12
+ 仅约束通用字段 ``date`` 与 ``stock_code``, 允许 DataFrame 包含额外
13
+ 的指标列.
14
+ """
15
+
16
+ class Config:
17
+ """Pandera configuration."""
18
+
19
+ coerce = True
20
+ strict = False # Allow extra metrics columns
21
+
22
+ date: pa.typing.Series[pa.typing.DateTime]
23
+ stock_code: pa.typing.Series[str]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lixinger-python
3
- Version: 0.3.15
3
+ Version: 0.3.16
4
4
  Summary: Python SDK for Lixinger Financial Data API
5
5
  Project-URL: Homepage, https://www.lixinger.com
6
6
  Project-URL: Documentation, https://www.lixinger.com/open/api/doc
@@ -1,5 +1,5 @@
1
- lixinger/__init__.py,sha256=UJw1snOuJOR2n_XDQGX_s_qIUzP18PLBQT-JIm5kXMI,3812
2
- lixinger/client.py,sha256=Az6obw2f2djk3s30Y6mYgCS4P01YqgUJEARUwQLR_Kc,17108
1
+ lixinger/__init__.py,sha256=m0F0QLl0b-k0l1cmh2Mv4rh2y55Jt9_qn4DjAZNwZJY,4057
2
+ lixinger/client.py,sha256=yOG7y9t9a-JMmYdx-hZy-a1XKfCAIB7nid4qx5Y3Jkc,17761
3
3
  lixinger/config.py,sha256=JPz8EOrf1kP4Do-Z5-MsnOM0pMrNE1ZsP-Qoarh9y4c,2008
4
4
  lixinger/exceptions.py,sha256=Gkv1z-LC09paYGVs430-gDgDs43dLyRHbglB3Frehd4,1069
5
5
  lixinger/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -50,8 +50,10 @@ lixinger/api/cn/index/fs/bank.py,sha256=zjDB_d06E_gxAvVNyk9Byoa5ShlevNoc75z5gVBH
50
50
  lixinger/api/cn/index/fs/hybrid.py,sha256=qs25ZXdCBiIRQ3mm2yyXQngSGtLIs1W93nvRxQDubIE,4429
51
51
  lixinger/api/cn/index/fs/non_financial.py,sha256=XlP9Jl5bHUto6mybj4WGCb11LjYINzwYhJaG_WEHYww,4599
52
52
  lixinger/api/cn/index/fs/security.py,sha256=l1Raf8GuYpthRDgNSMnVjDn9AcKLG5qP-wVKMd4GKQw,4458
53
- lixinger/api/cn/industry/__init__.py,sha256=uUWs9_EL1Pk7Q6DGaVR8JdRx8k_mSmqMqQTWPV_83k4,1505
54
- lixinger/api/cn/industry/namespace.py,sha256=PxqzjTk4OEuk8FVI8JEGMa5eZ3vMW9NeuLaM-lbjRmk,7869
53
+ lixinger/api/cn/industry/__init__.py,sha256=tgNdzXyl-b3tZT4eCyPlXFvwpYbQ5wczujwHoeH7uaI,1912
54
+ lixinger/api/cn/industry/namespace.py,sha256=Tmti1AO-swzRKb0JlLMWMG1V47JflZBwxPXhKCZjTjk,10148
55
+ lixinger/api/cn/industry/constituents/__init__.py,sha256=dwY1PVWeeoBADnooml_K24EPMTEc0hHoD6FrMeTlRIg,445
56
+ lixinger/api/cn/industry/constituents/sw_2021.py,sha256=nrjDQYy7Jpt7Vl1mNvYDaaqBL-k22zkm-M5JFDylKtA,4459
55
57
  lixinger/api/cn/industry/fs/__init__.py,sha256=6incmfX-jJGo5AJ7yhD_5G3wSYUbZTpIKA-Oy-276FM,1173
56
58
  lixinger/api/cn/industry/fs/sw_2021/__init__.py,sha256=PgVEwKY7MFznIGP-DYOLOlT8_heZAlutha_mOjH8D7I,1635
57
59
  lixinger/api/cn/industry/fs/sw_2021/bank.py,sha256=NhcrDaa_DhArBmg0QYVEIfKIMX4dtq6gL_d7UD1Cjkw,4812
@@ -59,6 +61,8 @@ lixinger/api/cn/industry/fs/sw_2021/hybrid.py,sha256=mUZyBmeDEUZ7F5p3RB1BHcDe8I3
59
61
  lixinger/api/cn/industry/fs/sw_2021/insurance.py,sha256=WVMt0Rn3qjXvHYqQPQjEiLkDBW7ZqxsvkeaH2W1vGPk,4960
60
62
  lixinger/api/cn/industry/fs/sw_2021/non_financial.py,sha256=lOgcL21hgubNoo2ZEkt9tkXW1GaKRGdDJLsKMXtDyjk,4947
61
63
  lixinger/api/cn/industry/fs/sw_2021/security.py,sha256=z2hDfXTELXVJAQMJ-Q7Vvjo9-nE9ZMbCWIfAx0jUx3A,4957
64
+ lixinger/api/cn/industry/fundamental/__init__.py,sha256=giibNA8ANlteap-GNGsSUn7BQDmOTnZvjdFV9bUw3jg,456
65
+ lixinger/api/cn/industry/fundamental/sw_2021.py,sha256=AT10HDnrYgoo4zxt-ypTuaUNJRP7HSxcsqIcZl7jdNU,6183
62
66
  lixinger/api/cn/industry/margin_trading/__init__.py,sha256=4JZDCF6v2TPg9uyBLKXAfHKVrDGpshjQkoJejdKwCC4,944
63
67
  lixinger/api/cn/industry/margin_trading/cni.py,sha256=7IqidE2N2_INiVybeiTt5qFRUY4PJsY6nUPEGtdWJlM,4600
64
68
  lixinger/api/cn/industry/margin_trading/sw.py,sha256=hjC5Uf7XXSwiiqoloIWFx5nDzbxd_D5bB1QPQCEjUjg,4591
@@ -112,7 +116,9 @@ lixinger/models/cn/index/fs/bank.py,sha256=DA_sRFSsK5IE0JQtp3pHdvPJQxbipHsSyKahc
112
116
  lixinger/models/cn/index/fs/hybrid.py,sha256=AlCoEfkkPdWGxE_K71rBKgwWpR4iWTaMJ8bc56YxYrk,565
113
117
  lixinger/models/cn/index/fs/non_financial.py,sha256=UpWXDDMiOdJN6WNc5R-PsHy9l9Th3xsKnOjUbID4Gug,585
114
118
  lixinger/models/cn/index/fs/security.py,sha256=VTYDvTQ5CKhqZsXeEyWqFNvugZ4UA3CLW0DkYTrOHtc,571
115
- lixinger/models/cn/industry/__init__.py,sha256=qkYcHTxSbJfTVhpxYYGw1sgwdgZA82KgcrDf_WJkiSw,781
119
+ lixinger/models/cn/industry/__init__.py,sha256=4V5WaOXSw8KCN1N_GERYV9gmeZpWGb-U9D7NfGC2mb8,1004
120
+ lixinger/models/cn/industry/constituents/__init__.py,sha256=MLR6DlZL50kBczGEMwcU8phbksWUa3uk4PgFKcg3wQs,329
121
+ lixinger/models/cn/industry/constituents/sw_2021.py,sha256=SHFcGGjMRmvr6QwLDrzcIVwoZQUXZoYCjtcdVjs-ya0,755
116
122
  lixinger/models/cn/industry/fs/__init__.py,sha256=JRgbHzfMKocZmUyOmK0rxtP-6fVCcB6MrxkcNzKrDls,552
117
123
  lixinger/models/cn/industry/fs/sw_2021/__init__.py,sha256=TgGBHhteRuLcXd_uESeSocTlcbU65s_Bw-vWFohyGSs,780
118
124
  lixinger/models/cn/industry/fs/sw_2021/bank.py,sha256=WvcyzTYcihtxhV9tIW2OPMtoqxRycf0vHWGKboGyEYw,610
@@ -120,6 +126,8 @@ lixinger/models/cn/industry/fs/sw_2021/hybrid.py,sha256=Su7kc7rgXjeoKwfhv6jhDH1_
120
126
  lixinger/models/cn/industry/fs/sw_2021/insurance.py,sha256=ixd-x7ZcewSef_HngePEVL5vc2pU_Xx7NCGrIS-3lRw,615
121
127
  lixinger/models/cn/industry/fs/sw_2021/non_financial.py,sha256=sZPTiMjbrOZhayDAbzTLi_A8x_dIlg4VXqr5XEvAXNc,624
122
128
  lixinger/models/cn/industry/fs/sw_2021/security.py,sha256=VjZXFgy4OE0agEyiGXEQkkoUpzTPZZ6zoSAihjW4xT0,614
129
+ lixinger/models/cn/industry/fundamental/__init__.py,sha256=FUu-Sm5PZQbNnVHAaHI0Ud15I2l1zTFy52NXF16boMo,348
130
+ lixinger/models/cn/industry/fundamental/sw_2021.py,sha256=VojcgeJrvpI9xRYITJOKeUExAjVzkWzuAFjawk6VFQY,743
123
131
  lixinger/models/cn/industry/margin_trading/__init__.py,sha256=JHzyvqzawYkgHa3HPNcY1B58PN2SZe-ZXhThHXlmSJ8,432
124
132
  lixinger/models/cn/industry/margin_trading/cni.py,sha256=D8O-SXFR1_6lboRzMMNxaLA3KnSlHHeS1N5kjUIUPrs,1375
125
133
  lixinger/models/cn/industry/margin_trading/sw.py,sha256=GyBhpZxSm1aoQHdzJvjb5INp_lrTFh4Alp2WaDyPhVM,1374
@@ -135,7 +143,7 @@ lixinger/utils/dataframe.py,sha256=tYBrNdmJ4poyuwD-9XgzHt3A_A8bBo0cdHiu8Yy9e9A,2
135
143
  lixinger/utils/dict.py,sha256=yvbUtv8QpRmy0d_o_7gCuEwwiEfBji5_xB490ANxilw,589
136
144
  lixinger/utils/rate_limiter.py,sha256=ZHlRTTL60L62uRA_f--LD26qkAfk-pHBllRqPapAXQM,1141
137
145
  lixinger/utils/retry.py,sha256=C9QBcrpD7WYAuT8R4SJfWNUZFj1mZsv-qyTRIFQDmwc,2862
138
- lixinger_python-0.3.15.dist-info/METADATA,sha256=50zLHID5kZeywTeIOnGgmJKFTWIaiZ5fVl825ZJDwpk,9207
139
- lixinger_python-0.3.15.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
140
- lixinger_python-0.3.15.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
141
- lixinger_python-0.3.15.dist-info/RECORD,,
146
+ lixinger_python-0.3.16.dist-info/METADATA,sha256=PRU0-dt5Nm5Sl6tI5vOQb4wPG_dmffazcO_qUTp6Xs0,9207
147
+ lixinger_python-0.3.16.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
148
+ lixinger_python-0.3.16.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
149
+ lixinger_python-0.3.16.dist-info/RECORD,,