lixinger-python 0.3.20__py3-none-any.whl → 0.3.22__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/api/cn/company/fund_shareholders.py +95 -0
- lixinger/api/cn/company/namespace.py +5 -0
- lixinger/client.py +4 -0
- lixinger/models/cn/company/__init__.py +2 -0
- lixinger/models/cn/company/fund_shareholders.py +27 -0
- {lixinger_python-0.3.20.dist-info → lixinger_python-0.3.22.dist-info}/METADATA +1 -1
- {lixinger_python-0.3.20.dist-info → lixinger_python-0.3.22.dist-info}/RECORD +9 -7
- {lixinger_python-0.3.20.dist-info → lixinger_python-0.3.22.dist-info}/WHEEL +0 -0
- {lixinger_python-0.3.20.dist-info → lixinger_python-0.3.22.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Company fund shareholders API."""
|
|
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.company import FundShareholders
|
|
9
|
+
from lixinger.utils.api import api
|
|
10
|
+
from lixinger.utils.dataframe import get_response_df
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class FundShareholdersAPI(BaseAPI):
|
|
14
|
+
"""Company fund shareholders API."""
|
|
15
|
+
|
|
16
|
+
async def get_fund_shareholders(
|
|
17
|
+
self,
|
|
18
|
+
stock_code: str,
|
|
19
|
+
start_date: str,
|
|
20
|
+
end_date: str | None = None,
|
|
21
|
+
limit: int | None = None,
|
|
22
|
+
) -> pd.DataFrame:
|
|
23
|
+
"""获取公募基金持股.
|
|
24
|
+
|
|
25
|
+
API Endpoint: /cn/company/fund-shareholders
|
|
26
|
+
API Method: POST
|
|
27
|
+
Documentation: https://www.lixinger.com/open/api/doc?api-key=cn/company/fund-shareholders
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
stock_code: 股票代码
|
|
31
|
+
start_date: 开始日期 (YYYY-MM-DD), 必填。起始时间和结束时间间隔不超过10年
|
|
32
|
+
end_date: 结束日期 (YYYY-MM-DD), 可选。默认值为今天结束
|
|
33
|
+
limit: 返回最近数据的数量, 可选
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
包含公募基金持股信息的 DataFrame
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
获取公募基金持股信息::
|
|
40
|
+
|
|
41
|
+
from lixinger import AsyncLixingerClient
|
|
42
|
+
|
|
43
|
+
async with AsyncLixingerClient() as client:
|
|
44
|
+
df = await client.company.fund_shareholders.get_fund_shareholders(
|
|
45
|
+
stock_code="300750",
|
|
46
|
+
start_date="2025-06-13",
|
|
47
|
+
end_date="2026-06-13"
|
|
48
|
+
)
|
|
49
|
+
print(df)
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
payload: dict[str, Any] = {
|
|
53
|
+
"stockCode": stock_code,
|
|
54
|
+
"startDate": start_date,
|
|
55
|
+
}
|
|
56
|
+
if end_date is not None:
|
|
57
|
+
payload["endDate"] = end_date
|
|
58
|
+
if limit is not None:
|
|
59
|
+
payload["limit"] = limit
|
|
60
|
+
|
|
61
|
+
data = await self._request("POST", "/cn/company/fund-shareholders", json=payload)
|
|
62
|
+
for item in data:
|
|
63
|
+
item["stockCode"] = stock_code
|
|
64
|
+
return get_response_df(data, FundShareholders)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# Functional API instance
|
|
68
|
+
_api_instance = FundShareholdersAPI()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@api
|
|
72
|
+
async def get_fund_shareholders(
|
|
73
|
+
stock_code: str,
|
|
74
|
+
start_date: str,
|
|
75
|
+
end_date: str | None = None,
|
|
76
|
+
limit: int | None = None,
|
|
77
|
+
) -> pd.DataFrame:
|
|
78
|
+
"""获取公募基金持股.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
stock_code: 股票代码
|
|
82
|
+
start_date: 开始日期 (YYYY-MM-DD), 必填。起始时间和结束时间间隔不超过10年
|
|
83
|
+
end_date: 结束日期 (YYYY-MM-DD), 可选。默认值为今天结束
|
|
84
|
+
limit: 返回最近数据的数量, 可选
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
包含公募基金持股信息的 DataFrame
|
|
88
|
+
|
|
89
|
+
"""
|
|
90
|
+
return await _api_instance.get_fund_shareholders(
|
|
91
|
+
stock_code=stock_code,
|
|
92
|
+
start_date=start_date,
|
|
93
|
+
end_date=end_date,
|
|
94
|
+
limit=limit,
|
|
95
|
+
)
|
|
@@ -10,6 +10,7 @@ from lixinger.api.cn.company.fs.insurance import InsuranceStatementAPI
|
|
|
10
10
|
from lixinger.api.cn.company.fs.non_financial import NonFinancialStatementAPI
|
|
11
11
|
from lixinger.api.cn.company.fs.other_financial import OtherFinancialStatementAPI
|
|
12
12
|
from lixinger.api.cn.company.fs.security import SecurityStatementAPI
|
|
13
|
+
from lixinger.api.cn.company.fund_shareholders import FundShareholdersAPI
|
|
13
14
|
from lixinger.api.cn.company.fundamental.bank import BankFundamentalAPI
|
|
14
15
|
from lixinger.api.cn.company.fundamental.insurance import InsuranceFundamentalAPI
|
|
15
16
|
from lixinger.api.cn.company.fundamental.non_financial import NonFinancialFundamentalAPI
|
|
@@ -99,6 +100,7 @@ class CompanyNamespace:
|
|
|
99
100
|
- indices: Company indices API
|
|
100
101
|
- dividend: Dividend data API
|
|
101
102
|
- announcement: Announcement data API
|
|
103
|
+
- fund_shareholders: Fund shareholders data API
|
|
102
104
|
|
|
103
105
|
"""
|
|
104
106
|
|
|
@@ -121,6 +123,7 @@ class CompanyNamespace:
|
|
|
121
123
|
indices: IndicesAPI,
|
|
122
124
|
dividend: DividendAPI,
|
|
123
125
|
announcement: AnnouncementAPI,
|
|
126
|
+
fund_shareholders: FundShareholdersAPI,
|
|
124
127
|
) -> None:
|
|
125
128
|
"""Initialize the company namespace.
|
|
126
129
|
|
|
@@ -142,6 +145,7 @@ class CompanyNamespace:
|
|
|
142
145
|
indices: Company indices API
|
|
143
146
|
dividend: Dividend data API
|
|
144
147
|
announcement: Announcement data API
|
|
148
|
+
fund_shareholders: Fund shareholders data API
|
|
145
149
|
|
|
146
150
|
"""
|
|
147
151
|
self.company = company
|
|
@@ -165,3 +169,4 @@ class CompanyNamespace:
|
|
|
165
169
|
self.indices = indices
|
|
166
170
|
self.dividend = dividend
|
|
167
171
|
self.announcement = announcement
|
|
172
|
+
self.fund_shareholders = fund_shareholders
|
lixinger/client.py
CHANGED
|
@@ -12,6 +12,7 @@ from lixinger.api.cn.company.fs.insurance import InsuranceStatementAPI
|
|
|
12
12
|
from lixinger.api.cn.company.fs.non_financial import NonFinancialStatementAPI
|
|
13
13
|
from lixinger.api.cn.company.fs.other_financial import OtherFinancialStatementAPI
|
|
14
14
|
from lixinger.api.cn.company.fs.security import SecurityStatementAPI
|
|
15
|
+
from lixinger.api.cn.company.fund_shareholders import FundShareholdersAPI
|
|
15
16
|
from lixinger.api.cn.company.fundamental.bank import BankFundamentalAPI
|
|
16
17
|
from lixinger.api.cn.company.fundamental.insurance import InsuranceFundamentalAPI
|
|
17
18
|
from lixinger.api.cn.company.fundamental.non_financial import NonFinancialFundamentalAPI
|
|
@@ -169,6 +170,7 @@ class AsyncLixingerClient:
|
|
|
169
170
|
cn_company_indices = IndicesAPI(self._http_client, self.config, self._rate_limiter)
|
|
170
171
|
cn_company_dividend = DividendAPI(self._http_client, self.config, self._rate_limiter)
|
|
171
172
|
cn_company_announcement = AnnouncementAPI(self._http_client, self.config, self._rate_limiter)
|
|
173
|
+
cn_company_fund_shareholders = FundShareholdersAPI(self._http_client, self.config, self._rate_limiter)
|
|
172
174
|
|
|
173
175
|
# Company namespace (groups all company APIs)
|
|
174
176
|
self.cn_company = CompanyNamespace(
|
|
@@ -189,6 +191,7 @@ class AsyncLixingerClient:
|
|
|
189
191
|
indices=cn_company_indices,
|
|
190
192
|
dividend=cn_company_dividend,
|
|
191
193
|
announcement=cn_company_announcement,
|
|
194
|
+
fund_shareholders=cn_company_fund_shareholders,
|
|
192
195
|
)
|
|
193
196
|
|
|
194
197
|
# Legacy flat access (deprecated, for backward compatibility)
|
|
@@ -201,6 +204,7 @@ class AsyncLixingerClient:
|
|
|
201
204
|
self.cn_company_indices = cn_company_indices
|
|
202
205
|
self.cn_company_dividend = cn_company_dividend
|
|
203
206
|
self.cn_company_announcement = cn_company_announcement
|
|
207
|
+
self.cn_company_fund_shareholders = cn_company_fund_shareholders
|
|
204
208
|
|
|
205
209
|
# Index APIs
|
|
206
210
|
cn_index = IndexAPI(self._http_client, self.config, self._rate_limiter)
|
|
@@ -5,6 +5,7 @@ from lixinger.models.cn.company.candlestick import Candlestick
|
|
|
5
5
|
from lixinger.models.cn.company.company import Company, CompanyProfile
|
|
6
6
|
from lixinger.models.cn.company.dividend import Dividend
|
|
7
7
|
from lixinger.models.cn.company.equity_change import EquityChangeData
|
|
8
|
+
from lixinger.models.cn.company.fund_shareholders import FundShareholders
|
|
8
9
|
from lixinger.models.cn.company.fundamental import (
|
|
9
10
|
BankFundamentalSchema,
|
|
10
11
|
InsuranceFundamentalSchema,
|
|
@@ -21,6 +22,7 @@ __all__ = [
|
|
|
21
22
|
"CompanyProfile",
|
|
22
23
|
"Dividend",
|
|
23
24
|
"EquityChangeData",
|
|
25
|
+
"FundShareholders",
|
|
24
26
|
"CompanyIndex",
|
|
25
27
|
"BankFundamentalSchema",
|
|
26
28
|
"InsuranceFundamentalSchema",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Fund shareholders data models."""
|
|
2
|
+
|
|
3
|
+
import pandera.pandas as pa
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FundShareholders(pa.DataFrameModel):
|
|
7
|
+
"""Fund shareholders data model."""
|
|
8
|
+
|
|
9
|
+
class Config:
|
|
10
|
+
"""Pandera configuration."""
|
|
11
|
+
|
|
12
|
+
coerce = True
|
|
13
|
+
strict = False
|
|
14
|
+
|
|
15
|
+
date: pa.typing.Series[pa.typing.DateTime]
|
|
16
|
+
fund_code: pa.typing.Series[str]
|
|
17
|
+
name: pa.typing.Series[str]
|
|
18
|
+
holdings: pa.typing.Series[float]
|
|
19
|
+
market_cap: pa.typing.Series[float]
|
|
20
|
+
stock_code: pa.typing.Series[str]
|
|
21
|
+
|
|
22
|
+
# 可选字段
|
|
23
|
+
declaration_date: pa.typing.Series[pa.typing.DateTime] | None = pa.Field(nullable=True)
|
|
24
|
+
market_cap_rank: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
25
|
+
net_value_ratio: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
26
|
+
outstanding_shares_a: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
27
|
+
proportion_of_outstanding_shares_a: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
lixinger/__init__.py,sha256=jTZQGSqxFYDLCtTcVuKzRzR0LAPaJEByZBeOSHUnMJI,4120
|
|
2
|
-
lixinger/client.py,sha256=
|
|
2
|
+
lixinger/client.py,sha256=ZiIPr_aJO79MDIm05uhD1_Cv10XZ-7xAOttL2srLUB0,18260
|
|
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
|
|
@@ -12,8 +12,9 @@ lixinger/api/cn/company/candlestick.py,sha256=mfd5rjcqLIcK43JPyB3nX_AlAGBBFYiIbt
|
|
|
12
12
|
lixinger/api/cn/company/company.py,sha256=D6yhmFPzhdWadBsNka-8h4mkbKjD4HoBFQCw72hTWnY,2904
|
|
13
13
|
lixinger/api/cn/company/dividend.py,sha256=21AWQbi56G7wVf8sv_YSy-Qy36OFKSvB9L2M3cbslGc,2658
|
|
14
14
|
lixinger/api/cn/company/equity_change.py,sha256=hf2SZhvCcYvu1lRhEz-b61yo9D7mDckKJSerAxGvsXI,2356
|
|
15
|
+
lixinger/api/cn/company/fund_shareholders.py,sha256=Nc9pL3oOqWBrXhIdyYA4KWEb1duTUsRJ0Cvb_ecBz68,2862
|
|
15
16
|
lixinger/api/cn/company/indices.py,sha256=GFoCf58DDh1a4Fx4lGaqPmk9NBW0hlRbnaIYoXBtFXI,1161
|
|
16
|
-
lixinger/api/cn/company/namespace.py,sha256=
|
|
17
|
+
lixinger/api/cn/company/namespace.py,sha256=JbV1GBwsrrEM2n1FWtsOqLe1YoI6dLp-BHCdHKFjuJw,7161
|
|
17
18
|
lixinger/api/cn/company/profile.py,sha256=iMwR5REcJNhKvS3hpWg6bCD1DOH-7fSN21zoIeRIh3k,1691
|
|
18
19
|
lixinger/api/cn/company/fs/__init__.py,sha256=B21nlQ_kwTvtwGbRovbsPQfDuj5rf3YqNp03orgpV0g,1281
|
|
19
20
|
lixinger/api/cn/company/fs/bank.py,sha256=rdUvFNVWwF1ZCMzy_a6Sc7e-NUykb8OfU4MnAL-EUI4,4514
|
|
@@ -76,12 +77,13 @@ lixinger/api/macro/rmb_loans.py,sha256=ne1gmtxqR6jF0qI4W0U99NPf0ds3-O7DBzfo9Vf2g
|
|
|
76
77
|
lixinger/api/macro/social_financing.py,sha256=QGYxqqsEfv-e3Zi5NJmOHa8k7Ft3m-3w-zaKi-rgZyg,4111
|
|
77
78
|
lixinger/models/__init__.py,sha256=OAUYpI_JaGZExFqZ0H6l8fJ5qyLW0oFnnO4JGJQknTE,154
|
|
78
79
|
lixinger/models/cn/__init__.py,sha256=mhTq_PfPJ_0720E1rTKdqBTpb9A14_ZDDWLfJXjcVck,27
|
|
79
|
-
lixinger/models/cn/company/__init__.py,sha256=
|
|
80
|
+
lixinger/models/cn/company/__init__.py,sha256=VfcgleYnbzG-9JsT96KcoGJkzu2ZmUbmcvX0c2HoXe8,1055
|
|
80
81
|
lixinger/models/cn/company/announcement.py,sha256=EzGx1w2DUumWCnQ1jZqx1oFlRT2g3d66S_yVxUchXCQ,501
|
|
81
82
|
lixinger/models/cn/company/candlestick.py,sha256=TfvdySyPBxU8l-sHH1xQq20wKoslKNeLECdyasRPrb8,674
|
|
82
83
|
lixinger/models/cn/company/company.py,sha256=BJRUWLifoxMVN3umOw99t8thaFcuwK244Hv_CDogH4w,933
|
|
83
84
|
lixinger/models/cn/company/dividend.py,sha256=yvIEHtNbj22eZOG_XPCLL-zCJLefe6DjomDiRpNwqU4,2044
|
|
84
85
|
lixinger/models/cn/company/equity_change.py,sha256=8I0u8Jkfj-bnIpQi_0YHpYhrPK-1X0BON_9YcIbLVzk,860
|
|
86
|
+
lixinger/models/cn/company/fund_shareholders.py,sha256=HbqzUziBLDoZgykn8SA6K6oyPJDYD6ZT2Ijxr7RzT7M,934
|
|
85
87
|
lixinger/models/cn/company/indices.py,sha256=Dxi_lAZPEWy3evcUHArsST0oTmJHyYAcT2Y8suqZQdc,349
|
|
86
88
|
lixinger/models/cn/company/fs/__init__.py,sha256=LPqxRhIlzOrV_c9RUFDxIVP25N1QtyQnDvBCAqKdn1s,603
|
|
87
89
|
lixinger/models/cn/company/fs/bank.py,sha256=1v3AevMLZvknay-4RLefP8c0a9li2TE_YjzWDDYoaNQ,694
|
|
@@ -145,7 +147,7 @@ lixinger/utils/dataframe.py,sha256=tYBrNdmJ4poyuwD-9XgzHt3A_A8bBo0cdHiu8Yy9e9A,2
|
|
|
145
147
|
lixinger/utils/dict.py,sha256=yvbUtv8QpRmy0d_o_7gCuEwwiEfBji5_xB490ANxilw,589
|
|
146
148
|
lixinger/utils/rate_limiter.py,sha256=ZHlRTTL60L62uRA_f--LD26qkAfk-pHBllRqPapAXQM,1141
|
|
147
149
|
lixinger/utils/retry.py,sha256=C9QBcrpD7WYAuT8R4SJfWNUZFj1mZsv-qyTRIFQDmwc,2862
|
|
148
|
-
lixinger_python-0.3.
|
|
149
|
-
lixinger_python-0.3.
|
|
150
|
-
lixinger_python-0.3.
|
|
151
|
-
lixinger_python-0.3.
|
|
150
|
+
lixinger_python-0.3.22.dist-info/METADATA,sha256=xFci9a_dtifW1feN6rhZTE6ApBaj-Fvj2nhpCEpy3c8,9207
|
|
151
|
+
lixinger_python-0.3.22.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
152
|
+
lixinger_python-0.3.22.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
|
|
153
|
+
lixinger_python-0.3.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|