lixinger-python 0.3.0__py3-none-any.whl → 0.3.2__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/dividend.py +34 -8
- lixinger/api/cn/index/constituent_weightings.py +44 -6
- lixinger/api/cn/index/constituents.py +49 -8
- lixinger/api/cn/index/index.py +69 -8
- lixinger/api/cn/index/namespace.py +85 -0
- lixinger/client.py +35 -8
- lixinger/models/cn/company/dividend.py +28 -2
- lixinger/models/cn/company/fundamental/security.py +1 -1
- {lixinger_python-0.3.0.dist-info → lixinger_python-0.3.2.dist-info}/METADATA +1 -1
- {lixinger_python-0.3.0.dist-info → lixinger_python-0.3.2.dist-info}/RECORD +12 -11
- {lixinger_python-0.3.0.dist-info → lixinger_python-0.3.2.dist-info}/WHEEL +0 -0
- {lixinger_python-0.3.0.dist-info → lixinger_python-0.3.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -14,27 +14,47 @@ class DividendAPI(BaseAPI):
|
|
|
14
14
|
async def get_dividend(
|
|
15
15
|
self,
|
|
16
16
|
stock_code: str,
|
|
17
|
-
start_date: str
|
|
17
|
+
start_date: str,
|
|
18
18
|
end_date: str | None = None,
|
|
19
|
+
limit: int | None = None,
|
|
19
20
|
) -> pd.DataFrame:
|
|
20
21
|
"""获取分红数据.
|
|
21
22
|
|
|
22
23
|
API Endpoint: /cn/company/dividend
|
|
23
24
|
API Method: POST
|
|
25
|
+
Documentation: https://www.lixinger.com/open/api/doc?api-key=cn/company/dividend
|
|
24
26
|
|
|
25
27
|
Args:
|
|
26
28
|
stock_code: 股票代码
|
|
27
|
-
start_date: 开始日期 (YYYY-MM-DD)
|
|
28
|
-
end_date: 结束日期 (YYYY-MM-DD)
|
|
29
|
+
start_date: 开始日期 (YYYY-MM-DD), 必填。起始时间和结束时间间隔不超过10年
|
|
30
|
+
end_date: 结束日期 (YYYY-MM-DD), 可选。默认值是上周一
|
|
31
|
+
limit: 返回最近数据的数量, 可选
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
包含分红数据的 DataFrame
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
获取分红数据::
|
|
38
|
+
|
|
39
|
+
from lixinger import AsyncLixingerClient
|
|
40
|
+
|
|
41
|
+
async with AsyncLixingerClient() as client:
|
|
42
|
+
df = await client.company.dividend.get_dividend(
|
|
43
|
+
stock_code="600036",
|
|
44
|
+
start_date="2023-01-01",
|
|
45
|
+
end_date="2024-01-01"
|
|
46
|
+
)
|
|
47
|
+
print(df)
|
|
29
48
|
|
|
30
49
|
"""
|
|
31
50
|
payload: dict[str, Any] = {
|
|
32
51
|
"stockCode": stock_code,
|
|
52
|
+
"startDate": start_date,
|
|
33
53
|
}
|
|
34
|
-
if start_date is not None:
|
|
35
|
-
payload["startDate"] = start_date
|
|
36
54
|
if end_date is not None:
|
|
37
55
|
payload["endDate"] = end_date
|
|
56
|
+
if limit is not None:
|
|
57
|
+
payload["limit"] = limit
|
|
38
58
|
|
|
39
59
|
data = await self._request("POST", "/cn/company/dividend", json=payload)
|
|
40
60
|
for item in data:
|
|
@@ -49,19 +69,25 @@ _api_instance = DividendAPI()
|
|
|
49
69
|
@api
|
|
50
70
|
async def get_dividend(
|
|
51
71
|
stock_code: str,
|
|
52
|
-
start_date: str
|
|
72
|
+
start_date: str,
|
|
53
73
|
end_date: str | None = None,
|
|
74
|
+
limit: int | None = None,
|
|
54
75
|
) -> pd.DataFrame:
|
|
55
76
|
"""获取分红数据.
|
|
56
77
|
|
|
57
78
|
Args:
|
|
58
79
|
stock_code: 股票代码
|
|
59
|
-
start_date: 开始日期 (YYYY-MM-DD)
|
|
60
|
-
end_date: 结束日期 (YYYY-MM-DD)
|
|
80
|
+
start_date: 开始日期 (YYYY-MM-DD), 必填。起始时间和结束时间间隔不超过10年
|
|
81
|
+
end_date: 结束日期 (YYYY-MM-DD), 可选。默认值是上周一
|
|
82
|
+
limit: 返回最近数据的数量, 可选
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
包含分红数据的 DataFrame
|
|
61
86
|
|
|
62
87
|
"""
|
|
63
88
|
return await _api_instance.get_dividend(
|
|
64
89
|
stock_code=stock_code,
|
|
65
90
|
start_date=start_date,
|
|
66
91
|
end_date=end_date,
|
|
92
|
+
limit=limit,
|
|
67
93
|
)
|
|
@@ -19,18 +19,40 @@ class ConstituentWeightingsAPI(BaseAPI):
|
|
|
19
19
|
start_date: str,
|
|
20
20
|
end_date: str,
|
|
21
21
|
) -> pd.DataFrame:
|
|
22
|
-
"""
|
|
22
|
+
"""获取指数成分股权重数据.
|
|
23
23
|
|
|
24
24
|
API Endpoint: /cn/index/constituent-weightings
|
|
25
25
|
API Method: POST
|
|
26
|
+
Documentation: https://www.lixinger.com/open/api/doc?api-key=cn/index/constituent-weightings
|
|
26
27
|
|
|
27
28
|
Args:
|
|
28
|
-
stock_code:
|
|
29
|
+
stock_code: 指数代码,如 "000300" (沪深300)
|
|
29
30
|
start_date: 开始日期 (YYYY-MM-DD)
|
|
30
31
|
end_date: 结束日期 (YYYY-MM-DD)
|
|
31
32
|
|
|
32
33
|
Returns:
|
|
33
|
-
DataFrame
|
|
34
|
+
包含指数成分股权重信息的 DataFrame,包含以下字段:
|
|
35
|
+
- date: 日期
|
|
36
|
+
- stock_code: 成分股代码
|
|
37
|
+
- weighting: 权重(0-1之间的浮点数)
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
获取沪深300指数成分股权重::
|
|
41
|
+
|
|
42
|
+
from lixinger import AsyncLixingerClient
|
|
43
|
+
|
|
44
|
+
async with AsyncLixingerClient() as client:
|
|
45
|
+
# 查询指定时间段的成分股权重
|
|
46
|
+
df = await client.index.get_constituent_weightings(
|
|
47
|
+
stock_code="000300",
|
|
48
|
+
start_date="2024-01-01",
|
|
49
|
+
end_date="2024-12-31"
|
|
50
|
+
)
|
|
51
|
+
print(df)
|
|
52
|
+
|
|
53
|
+
# 查看权重最大的成分股
|
|
54
|
+
top_stocks = df.sort_values("weighting", ascending=False).head(10)
|
|
55
|
+
print(top_stocks)
|
|
34
56
|
|
|
35
57
|
"""
|
|
36
58
|
payload: dict[str, Any] = {
|
|
@@ -53,15 +75,31 @@ async def get_constituent_weightings(
|
|
|
53
75
|
start_date: str,
|
|
54
76
|
end_date: str,
|
|
55
77
|
) -> pd.DataFrame:
|
|
56
|
-
"""
|
|
78
|
+
"""获取指数成分股权重数据.
|
|
57
79
|
|
|
58
80
|
Args:
|
|
59
|
-
stock_code:
|
|
81
|
+
stock_code: 指数代码,如 "000300" (沪深300)
|
|
60
82
|
start_date: 开始日期 (YYYY-MM-DD)
|
|
61
83
|
end_date: 结束日期 (YYYY-MM-DD)
|
|
62
84
|
|
|
63
85
|
Returns:
|
|
64
|
-
DataFrame
|
|
86
|
+
包含指数成分股权重信息的 DataFrame,包含以下字段:
|
|
87
|
+
- date: 日期
|
|
88
|
+
- stock_code: 成分股代码
|
|
89
|
+
- weighting: 权重(0-1之间的浮点数)
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
获取沪深300指数成分股权重::
|
|
93
|
+
|
|
94
|
+
from lixinger import get_constituent_weightings
|
|
95
|
+
|
|
96
|
+
# 查询指定时间段的成分股权重
|
|
97
|
+
df = await get_constituent_weightings(
|
|
98
|
+
stock_code="000300",
|
|
99
|
+
start_date="2024-01-01",
|
|
100
|
+
end_date="2024-12-31"
|
|
101
|
+
)
|
|
102
|
+
print(df)
|
|
65
103
|
|
|
66
104
|
"""
|
|
67
105
|
return await _api_instance.get_constituent_weightings(
|
|
@@ -18,17 +18,42 @@ class ConstituentsAPI(BaseAPI):
|
|
|
18
18
|
stock_codes: list[str],
|
|
19
19
|
date: str,
|
|
20
20
|
) -> pd.DataFrame:
|
|
21
|
-
"""
|
|
21
|
+
"""获取指数成分股列表.
|
|
22
22
|
|
|
23
23
|
API Endpoint: /cn/index/constituents
|
|
24
24
|
API Method: POST
|
|
25
|
+
Documentation: https://www.lixinger.com/open/api/doc?api-key=cn/index/constituents
|
|
25
26
|
|
|
26
27
|
Args:
|
|
27
|
-
stock_codes:
|
|
28
|
-
date:
|
|
28
|
+
stock_codes: 指数代码列表,如 ["000001.SH", "399001.SZ"]
|
|
29
|
+
date: 查询日期 (YYYY-MM-DD),返回该日期的成分股列表
|
|
29
30
|
|
|
30
31
|
Returns:
|
|
31
|
-
DataFrame
|
|
32
|
+
包含指数成分股信息的 DataFrame,包含以下字段:
|
|
33
|
+
- index_stock_code: 指数代码
|
|
34
|
+
- stock_code: 成分股代码
|
|
35
|
+
- area_code: 地区代码
|
|
36
|
+
- market: 市场
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
获取沪深300指数的成分股::
|
|
40
|
+
|
|
41
|
+
from lixinger import AsyncLixingerClient
|
|
42
|
+
|
|
43
|
+
async with AsyncLixingerClient() as client:
|
|
44
|
+
# 查询单个指数的成分股
|
|
45
|
+
df = await client.index.get_constituents(
|
|
46
|
+
stock_codes=["000300.SH"],
|
|
47
|
+
date="2024-12-31"
|
|
48
|
+
)
|
|
49
|
+
print(df)
|
|
50
|
+
|
|
51
|
+
# 查询多个指数的成分股
|
|
52
|
+
df = await client.index.get_constituents(
|
|
53
|
+
stock_codes=["000001.SH", "399001.SZ"],
|
|
54
|
+
date="2024-12-31"
|
|
55
|
+
)
|
|
56
|
+
print(df)
|
|
32
57
|
|
|
33
58
|
"""
|
|
34
59
|
payload: dict[str, Any] = {
|
|
@@ -55,14 +80,30 @@ async def get_constituents(
|
|
|
55
80
|
stock_codes: list[str],
|
|
56
81
|
date: str,
|
|
57
82
|
) -> pd.DataFrame:
|
|
58
|
-
"""
|
|
83
|
+
"""获取指数成分股列表.
|
|
59
84
|
|
|
60
85
|
Args:
|
|
61
|
-
stock_codes:
|
|
62
|
-
date:
|
|
86
|
+
stock_codes: 指数代码列表,如 ["000001.SH", "399001.SZ"]
|
|
87
|
+
date: 查询日期 (YYYY-MM-DD),返回该日期的成分股列表
|
|
63
88
|
|
|
64
89
|
Returns:
|
|
65
|
-
DataFrame
|
|
90
|
+
包含指数成分股信息的 DataFrame,包含以下字段:
|
|
91
|
+
- index_stock_code: 指数代码
|
|
92
|
+
- stock_code: 成分股代码
|
|
93
|
+
- area_code: 地区代码
|
|
94
|
+
- market: 市场
|
|
95
|
+
|
|
96
|
+
Example:
|
|
97
|
+
获取沪深300指数的成分股::
|
|
98
|
+
|
|
99
|
+
from lixinger import get_constituents
|
|
100
|
+
|
|
101
|
+
# 查询单个指数的成分股
|
|
102
|
+
df = await get_constituents(
|
|
103
|
+
stock_codes=["000300.SH"],
|
|
104
|
+
date="2024-12-31"
|
|
105
|
+
)
|
|
106
|
+
print(df)
|
|
66
107
|
|
|
67
108
|
"""
|
|
68
109
|
return await _api_instance.get_constituents(
|
lixinger/api/cn/index/index.py
CHANGED
|
@@ -21,17 +21,54 @@ class IndexAPI(BaseAPI):
|
|
|
21
21
|
stock_codes: list[str] | None = None,
|
|
22
22
|
source: str | None = None,
|
|
23
23
|
) -> pd.DataFrame:
|
|
24
|
-
"""
|
|
24
|
+
"""获取指数基本信息.
|
|
25
25
|
|
|
26
26
|
API Endpoint: /cn/index
|
|
27
27
|
API Method: POST
|
|
28
|
+
Documentation: https://www.lixinger.com/open/api/doc?api-key=cn/index
|
|
28
29
|
|
|
29
30
|
Args:
|
|
30
|
-
stock_codes:
|
|
31
|
-
source:
|
|
31
|
+
stock_codes: 指数代码列表,如 ["000300", "000001"]。不传则返回所有指数
|
|
32
|
+
source: 指数来源筛选,可选值:
|
|
33
|
+
- "csi": 中证指数
|
|
34
|
+
- "cni": 国证指数
|
|
35
|
+
- "sse": 上证指数
|
|
36
|
+
- "szse": 深证指数
|
|
37
|
+
不传则返回所有来源的指数
|
|
32
38
|
|
|
33
39
|
Returns:
|
|
34
|
-
DataFrame
|
|
40
|
+
包含指数基本信息的 DataFrame,包含以下字段:
|
|
41
|
+
- name: 指数名称
|
|
42
|
+
- stock_code: 指数代码
|
|
43
|
+
- area_code: 地区代码
|
|
44
|
+
- market: 市场
|
|
45
|
+
- source: 指数来源 (csi/cni/sse/szse等)
|
|
46
|
+
- fs_table_type: 财报类型 (hybrid/non_financial等)
|
|
47
|
+
- currency: 货币单位
|
|
48
|
+
- launch_date: 发布日期
|
|
49
|
+
- rebalancing_frequency: 调仓频率 (semi-annually/quarterly等)
|
|
50
|
+
- caculation_method: 计算方法 (grading_weighted等)
|
|
51
|
+
- series: 指数系列分类
|
|
52
|
+
|
|
53
|
+
Example:
|
|
54
|
+
获取指数基本信息::
|
|
55
|
+
|
|
56
|
+
from lixinger import AsyncLixingerClient
|
|
57
|
+
|
|
58
|
+
async with AsyncLixingerClient() as client:
|
|
59
|
+
# 获取指定指数的信息
|
|
60
|
+
df = await client.index.get_index(
|
|
61
|
+
stock_codes=["000300", "000905"]
|
|
62
|
+
)
|
|
63
|
+
print(df[["name", "stock_code", "source", "launch_date"]])
|
|
64
|
+
|
|
65
|
+
# 获取中证指数系列
|
|
66
|
+
df = await client.index.get_index(source="csi")
|
|
67
|
+
print(df[["name", "stock_code"]])
|
|
68
|
+
|
|
69
|
+
# 获取所有指数
|
|
70
|
+
df = await client.index.get_index()
|
|
71
|
+
print(f"Total indices: {len(df)}")
|
|
35
72
|
|
|
36
73
|
"""
|
|
37
74
|
payload: dict[str, Any] = {}
|
|
@@ -53,14 +90,38 @@ async def get_index(
|
|
|
53
90
|
stock_codes: list[str] | None = None,
|
|
54
91
|
source: str | None = None,
|
|
55
92
|
) -> pd.DataFrame:
|
|
56
|
-
"""
|
|
93
|
+
"""获取指数基本信息.
|
|
57
94
|
|
|
58
95
|
Args:
|
|
59
|
-
stock_codes:
|
|
60
|
-
source:
|
|
96
|
+
stock_codes: 指数代码列表,如 ["000300", "000001"]。不传则返回所有指数
|
|
97
|
+
source: 指数来源筛选 (csi/cni/sse/szse)。不传则返回所有来源
|
|
61
98
|
|
|
62
99
|
Returns:
|
|
63
|
-
DataFrame
|
|
100
|
+
包含指数基本信息的 DataFrame,包含以下字段:
|
|
101
|
+
- name: 指数名称
|
|
102
|
+
- stock_code: 指数代码
|
|
103
|
+
- area_code: 地区代码
|
|
104
|
+
- market: 市场
|
|
105
|
+
- source: 指数来源
|
|
106
|
+
- fs_table_type: 财报类型
|
|
107
|
+
- currency: 货币单位
|
|
108
|
+
- launch_date: 发布日期
|
|
109
|
+
- rebalancing_frequency: 调仓频率
|
|
110
|
+
- caculation_method: 计算方法
|
|
111
|
+
- series: 指数系列分类
|
|
112
|
+
|
|
113
|
+
Example:
|
|
114
|
+
获取指数基本信息::
|
|
115
|
+
|
|
116
|
+
from lixinger import get_index
|
|
117
|
+
|
|
118
|
+
# 获取指定指数
|
|
119
|
+
df = await get_index(stock_codes=["000300", "000905"])
|
|
120
|
+
print(df[["name", "stock_code", "source"]])
|
|
121
|
+
|
|
122
|
+
# 获取中证指数系列
|
|
123
|
+
df = await get_index(source="csi")
|
|
124
|
+
print(df)
|
|
64
125
|
|
|
65
126
|
"""
|
|
66
127
|
return await _api_instance.get_index(
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Index namespace for grouping related APIs."""
|
|
2
|
+
|
|
3
|
+
from lixinger.api.cn.index.candlestick import IndexCandlestickAPI
|
|
4
|
+
from lixinger.api.cn.index.constituent_weightings import ConstituentWeightingsAPI
|
|
5
|
+
from lixinger.api.cn.index.constituents import ConstituentsAPI
|
|
6
|
+
from lixinger.api.cn.index.drawdown import DrawdownAPI
|
|
7
|
+
from lixinger.api.cn.index.fundamental import IndexFundamentalAPI
|
|
8
|
+
from lixinger.api.cn.index.index import IndexAPI
|
|
9
|
+
from lixinger.api.cn.index.tracking_fund import TrackingFundAPI
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IndexNamespace:
|
|
13
|
+
"""Namespace for index-related APIs.
|
|
14
|
+
|
|
15
|
+
This class groups all index-related APIs under a single namespace.
|
|
16
|
+
Access APIs via their specific attributes:
|
|
17
|
+
|
|
18
|
+
- index: Index information API (get_index)
|
|
19
|
+
- constituents: Index constituents API (get_constituents)
|
|
20
|
+
- constituent_weightings: Index constituent weightings API (get_constituent_weightings)
|
|
21
|
+
- fundamental: Index fundamental data API (get_index_fundamental)
|
|
22
|
+
- candlestick: Index candlestick data API (get_candlestick)
|
|
23
|
+
- drawdown: Index drawdown data API (get_drawdown)
|
|
24
|
+
- tracking_fund: Index tracking fund API (get_tracking_fund)
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__( # noqa: PLR0913
|
|
29
|
+
self,
|
|
30
|
+
index: IndexAPI,
|
|
31
|
+
constituents: ConstituentsAPI,
|
|
32
|
+
constituent_weightings: ConstituentWeightingsAPI,
|
|
33
|
+
fundamental: IndexFundamentalAPI,
|
|
34
|
+
candlestick: IndexCandlestickAPI,
|
|
35
|
+
drawdown: DrawdownAPI,
|
|
36
|
+
tracking_fund: TrackingFundAPI,
|
|
37
|
+
):
|
|
38
|
+
"""Initialize the index namespace.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
index: Index information API
|
|
42
|
+
constituents: Index constituents API
|
|
43
|
+
constituent_weightings: Index constituent weightings API
|
|
44
|
+
fundamental: Index fundamental data API
|
|
45
|
+
candlestick: Index candlestick data API
|
|
46
|
+
drawdown: Index drawdown data API
|
|
47
|
+
tracking_fund: Index tracking fund API
|
|
48
|
+
|
|
49
|
+
"""
|
|
50
|
+
self.index = index
|
|
51
|
+
self.constituents = constituents
|
|
52
|
+
self.constituent_weightings = constituent_weightings
|
|
53
|
+
self.fundamental = fundamental
|
|
54
|
+
self.candlestick = candlestick
|
|
55
|
+
self.drawdown = drawdown
|
|
56
|
+
self.tracking_fund = tracking_fund
|
|
57
|
+
|
|
58
|
+
# Convenience aliases for shorter access
|
|
59
|
+
def get_index(self, *args, **kwargs):
|
|
60
|
+
"""Alias for index.get_index."""
|
|
61
|
+
return self.index.get_index(*args, **kwargs)
|
|
62
|
+
|
|
63
|
+
def get_constituents(self, *args, **kwargs):
|
|
64
|
+
"""Alias for constituents.get_constituents."""
|
|
65
|
+
return self.constituents.get_constituents(*args, **kwargs)
|
|
66
|
+
|
|
67
|
+
def get_constituent_weightings(self, *args, **kwargs):
|
|
68
|
+
"""Alias for constituent_weightings.get_constituent_weightings."""
|
|
69
|
+
return self.constituent_weightings.get_constituent_weightings(*args, **kwargs)
|
|
70
|
+
|
|
71
|
+
def get_fundamental(self, *args, **kwargs):
|
|
72
|
+
"""Alias for fundamental.get_fundamental."""
|
|
73
|
+
return self.fundamental.get_fundamental(*args, **kwargs)
|
|
74
|
+
|
|
75
|
+
def get_candlestick(self, *args, **kwargs):
|
|
76
|
+
"""Alias for candlestick.get_candlestick."""
|
|
77
|
+
return self.candlestick.get_candlestick(*args, **kwargs)
|
|
78
|
+
|
|
79
|
+
def get_drawdown(self, *args, **kwargs):
|
|
80
|
+
"""Alias for drawdown.get_drawdown."""
|
|
81
|
+
return self.drawdown.get_drawdown(*args, **kwargs)
|
|
82
|
+
|
|
83
|
+
def get_tracking_fund(self, *args, **kwargs):
|
|
84
|
+
"""Alias for tracking_fund.get_tracking_fund."""
|
|
85
|
+
return self.tracking_fund.get_tracking_fund(*args, **kwargs)
|
lixinger/client.py
CHANGED
|
@@ -32,6 +32,7 @@ from lixinger.api.cn.index import (
|
|
|
32
32
|
IndexFundamentalAPI,
|
|
33
33
|
TrackingFundAPI,
|
|
34
34
|
)
|
|
35
|
+
from lixinger.api.cn.index.namespace import IndexNamespace
|
|
35
36
|
from lixinger.config import get_config_from_env
|
|
36
37
|
from lixinger.utils.rate_limiter import AsyncRateLimiter
|
|
37
38
|
|
|
@@ -156,15 +157,36 @@ class AsyncLixingerClient:
|
|
|
156
157
|
self.cn_company_indices = cn_company_indices
|
|
157
158
|
self.cn_company_dividend = cn_company_dividend
|
|
158
159
|
self.cn_company_announcement = cn_company_announcement
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
self.
|
|
162
|
-
|
|
160
|
+
|
|
161
|
+
# Index APIs
|
|
162
|
+
cn_index = IndexAPI(self._http_client, self.config, self._rate_limiter)
|
|
163
|
+
cn_index_constituents = ConstituentsAPI(self._http_client, self.config, self._rate_limiter)
|
|
164
|
+
cn_index_constituent_weightings = ConstituentWeightingsAPI(self._http_client, self.config, self._rate_limiter)
|
|
165
|
+
cn_index_candlestick = IndexCandlestickAPI(self._http_client, self.config, self._rate_limiter)
|
|
166
|
+
cn_index_drawdown = DrawdownAPI(self._http_client, self.config, self._rate_limiter)
|
|
167
|
+
cn_index_fundamental = IndexFundamentalAPI(self._http_client, self.config, self._rate_limiter)
|
|
168
|
+
cn_index_tracking_fund = TrackingFundAPI(self._http_client, self.config, self._rate_limiter)
|
|
169
|
+
|
|
170
|
+
# Index namespace (groups all index APIs)
|
|
171
|
+
self.cn_index = IndexNamespace(
|
|
172
|
+
index=cn_index,
|
|
173
|
+
constituents=cn_index_constituents,
|
|
174
|
+
constituent_weightings=cn_index_constituent_weightings,
|
|
175
|
+
fundamental=cn_index_fundamental,
|
|
176
|
+
candlestick=cn_index_candlestick,
|
|
177
|
+
drawdown=cn_index_drawdown,
|
|
178
|
+
tracking_fund=cn_index_tracking_fund,
|
|
163
179
|
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
self.
|
|
167
|
-
self.
|
|
180
|
+
|
|
181
|
+
# Legacy flat access for index APIs (deprecated, for backward compatibility)
|
|
182
|
+
self.cn_index_constituents = cn_index_constituents
|
|
183
|
+
self.cn_index_constituent_weightings = cn_index_constituent_weightings
|
|
184
|
+
self.cn_index_candlestick = cn_index_candlestick
|
|
185
|
+
self.cn_index_drawdown = cn_index_drawdown
|
|
186
|
+
self.cn_index_fundamental = cn_index_fundamental
|
|
187
|
+
self.cn_index_tracking_fund = cn_index_tracking_fund
|
|
188
|
+
|
|
189
|
+
# Fund APIs
|
|
168
190
|
self.cn_fund = FundAPI(self._http_client, self.config, self._rate_limiter)
|
|
169
191
|
self.cn_fund_profile = FundProfileAPI(self._http_client, self.config, self._rate_limiter)
|
|
170
192
|
self.cn_fund_candlestick = FundCandlestickAPI(self._http_client, self.config, self._rate_limiter)
|
|
@@ -190,6 +212,11 @@ class AsyncLixingerClient:
|
|
|
190
212
|
"""Alias for cn_company."""
|
|
191
213
|
return self.cn_company
|
|
192
214
|
|
|
215
|
+
@property
|
|
216
|
+
def index(self) -> IndexNamespace:
|
|
217
|
+
"""Alias for cn_index."""
|
|
218
|
+
return self.cn_index
|
|
219
|
+
|
|
193
220
|
@property
|
|
194
221
|
def candlestick(self) -> CandlestickAPI:
|
|
195
222
|
"""Alias for cn_company_candlestick."""
|
|
@@ -4,7 +4,27 @@ import pandera.pandas as pa
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Dividend(pa.DataFrameModel):
|
|
7
|
-
"""Dividend data model.
|
|
7
|
+
"""Dividend data model.
|
|
8
|
+
|
|
9
|
+
API文档: https://www.lixinger.com/open/api/doc?api-key=cn/company/dividend
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
date: 公告日期
|
|
13
|
+
content: 内容
|
|
14
|
+
bonus_shares_from_profit: 送股(股)
|
|
15
|
+
bonus_shares_from_capital_reserve: 转增(股)
|
|
16
|
+
dividend: 分红
|
|
17
|
+
currency: 货币
|
|
18
|
+
dividend_amount: 分红金额
|
|
19
|
+
annual_net_profit: 年度净利润
|
|
20
|
+
annual_net_profit_dividend_ratio: 年度净利润分红比例
|
|
21
|
+
register_date: 股权登记日
|
|
22
|
+
ex_date: 除权除息日
|
|
23
|
+
payment_date: 分红到账日
|
|
24
|
+
fs_end_date: 财报时间
|
|
25
|
+
stock_code: 股票代码(由SDK添加)
|
|
26
|
+
|
|
27
|
+
"""
|
|
8
28
|
|
|
9
29
|
class Config:
|
|
10
30
|
"""Pandera configuration."""
|
|
@@ -12,14 +32,20 @@ class Dividend(pa.DataFrameModel):
|
|
|
12
32
|
coerce = True
|
|
13
33
|
strict = False
|
|
14
34
|
|
|
35
|
+
# 必填字段
|
|
15
36
|
date: pa.typing.Series[pa.typing.DateTime]
|
|
16
37
|
fs_end_date: pa.typing.Series[pa.typing.DateTime]
|
|
17
38
|
currency: pa.typing.Series[str]
|
|
18
39
|
bonus_shares_from_profit: pa.typing.Series[float]
|
|
19
40
|
bonus_shares_from_capital_reserve: pa.typing.Series[float]
|
|
20
41
|
dividend: pa.typing.Series[float]
|
|
42
|
+
stock_code: pa.typing.Series[str]
|
|
43
|
+
|
|
44
|
+
# 可选字段
|
|
45
|
+
content: pa.typing.Series[str] | None = pa.Field(nullable=True)
|
|
21
46
|
register_date: pa.typing.Series[pa.typing.DateTime] | None = pa.Field(nullable=True)
|
|
22
47
|
ex_date: pa.typing.Series[pa.typing.DateTime] | None = pa.Field(nullable=True)
|
|
23
48
|
payment_date: pa.typing.Series[pa.typing.DateTime] | None = pa.Field(nullable=True)
|
|
24
49
|
dividend_amount: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
25
|
-
|
|
50
|
+
annual_net_profit: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
51
|
+
annual_net_profit_dividend_ratio: pa.typing.Series[float] | None = pa.Field(nullable=True)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
lixinger/__init__.py,sha256=_W43coEZ9iVNFec80S_uRcYYkSkgLuvq3PaPLFj16qU,2126
|
|
2
|
-
lixinger/client.py,sha256=
|
|
2
|
+
lixinger/client.py,sha256=aaYJfOjc9-IxqGe1LqiXtR6ldUNrqoorMSg67TbUA0A,10333
|
|
3
3
|
lixinger/config.py,sha256=JPz8EOrf1kP4Do-Z5-MsnOM0pMrNE1ZsP-Qoarh9y4c,2008
|
|
4
4
|
lixinger/exceptions.py,sha256=eWSDO-3CRESPsfzomzMc-9NYPBQ1EEPJ_CPSIo-UlDM,508
|
|
5
5
|
lixinger/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -10,7 +10,7 @@ lixinger/api/cn/company/__init__.py,sha256=K8aNp2gGj4iQOvc8KjXA5668QUAhwyTfMBPhP
|
|
|
10
10
|
lixinger/api/cn/company/announcement.py,sha256=lYt4AWOV5b9OTKfvJ7ZOqWP61pcPcyIQzb5N2DqFT6k,1920
|
|
11
11
|
lixinger/api/cn/company/candlestick.py,sha256=VRG5ZPyVNYLvdCcCxB3wjzrpVXYK2M5-x5xprTpp1fU,2132
|
|
12
12
|
lixinger/api/cn/company/company.py,sha256=D6yhmFPzhdWadBsNka-8h4mkbKjD4HoBFQCw72hTWnY,2904
|
|
13
|
-
lixinger/api/cn/company/dividend.py,sha256=
|
|
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
15
|
lixinger/api/cn/company/indices.py,sha256=GFoCf58DDh1a4Fx4lGaqPmk9NBW0hlRbnaIYoXBtFXI,1161
|
|
16
16
|
lixinger/api/cn/company/namespace.py,sha256=qNyzM0qHwf9sJUTSZpb-_gaJYpT62oTUJinJzYpC7RE,5117
|
|
@@ -33,11 +33,12 @@ lixinger/api/cn/fund/profile.py,sha256=kTbqmz3obYRNjFjkD74I-R3x0SBsZCqI0KPjiWe84
|
|
|
33
33
|
lixinger/api/cn/fund/shareholdings.py,sha256=aGFsyBiIW-wsbpAnwnAnRY6duiBKeYbQVKfpdQXs3tY,2358
|
|
34
34
|
lixinger/api/cn/index/__init__.py,sha256=T1vGReTsHm9l-nCp0H_Um0nCQcNb7y0KR9gGVh--xQs,982
|
|
35
35
|
lixinger/api/cn/index/candlestick.py,sha256=MdFGWf3pSoqPtzkCQJbSY1b6vw1nmZ6lKmgxdFMIMlo,2356
|
|
36
|
-
lixinger/api/cn/index/constituent_weightings.py,sha256=
|
|
37
|
-
lixinger/api/cn/index/constituents.py,sha256=
|
|
36
|
+
lixinger/api/cn/index/constituent_weightings.py,sha256=UuAmqhgapMAMW6qZge3yKb9E9h7WNuZZ83sLkZIq-rA,3352
|
|
37
|
+
lixinger/api/cn/index/constituents.py,sha256=8kQjTJER8PqpZMTQWusDK9mbQ27YLYgYxw8u_vHqsy4,3372
|
|
38
38
|
lixinger/api/cn/index/drawdown.py,sha256=D-fhA-Sv2-gf6VzX0zG1dm7Tn5Wy7NK1IB-f5kFXi7w,2450
|
|
39
39
|
lixinger/api/cn/index/fundamental.py,sha256=MyhGmMk7GkOZflpT0JMoiLsCs3DLMLLkopyUsD94Y4Q,2474
|
|
40
|
-
lixinger/api/cn/index/index.py,sha256=
|
|
40
|
+
lixinger/api/cn/index/index.py,sha256=5gDwE5K3tYNlCrV-EsSC4HXhfIi58uqWpHQxTt9LJMk,4177
|
|
41
|
+
lixinger/api/cn/index/namespace.py,sha256=YoxOwbA3_8o4iUvqIRWFPIBnvkF3PfToelBy1aWPkkw,3431
|
|
41
42
|
lixinger/api/cn/index/tracking_fund.py,sha256=su0zJRROKuTZlHe0XkIQz8kJOyPZmyg7HxZIbmpM_YM,1960
|
|
42
43
|
lixinger/models/__init__.py,sha256=OAUYpI_JaGZExFqZ0H6l8fJ5qyLW0oFnnO4JGJQknTE,154
|
|
43
44
|
lixinger/models/cn/__init__.py,sha256=mhTq_PfPJ_0720E1rTKdqBTpb9A14_ZDDWLfJXjcVck,27
|
|
@@ -45,7 +46,7 @@ lixinger/models/cn/company/__init__.py,sha256=7E7p1NED5qr0yf_wcmOq_DDvOq2hzXv3bD
|
|
|
45
46
|
lixinger/models/cn/company/announcement.py,sha256=VBtsxP6Cpi-w2H-iciByj_rFm1dMzaI09zEV1QQxOyI,468
|
|
46
47
|
lixinger/models/cn/company/candlestick.py,sha256=TfvdySyPBxU8l-sHH1xQq20wKoslKNeLECdyasRPrb8,674
|
|
47
48
|
lixinger/models/cn/company/company.py,sha256=BJRUWLifoxMVN3umOw99t8thaFcuwK244Hv_CDogH4w,933
|
|
48
|
-
lixinger/models/cn/company/dividend.py,sha256=
|
|
49
|
+
lixinger/models/cn/company/dividend.py,sha256=NxVIP9iCw7Imat76in03iKRQsEfgmLkSBD1YgNXvu2Y,1831
|
|
49
50
|
lixinger/models/cn/company/equity_change.py,sha256=8I0u8Jkfj-bnIpQi_0YHpYhrPK-1X0BON_9YcIbLVzk,860
|
|
50
51
|
lixinger/models/cn/company/indices.py,sha256=Dxi_lAZPEWy3evcUHArsST0oTmJHyYAcT2Y8suqZQdc,349
|
|
51
52
|
lixinger/models/cn/company/fs/__init__.py,sha256=qYUQzRdsr7vvyczQ-79ntZvRkHQWSnkQxIXWA81-nqA,162
|
|
@@ -55,7 +56,7 @@ lixinger/models/cn/company/fundamental/bank.py,sha256=CvqEfU3btDWlphJTDWMxlUyTiA
|
|
|
55
56
|
lixinger/models/cn/company/fundamental/insurance.py,sha256=-bP3VeKr-0yYvGuZnolCxvoU9R4Yg3-w8czskWUpK1g,404
|
|
56
57
|
lixinger/models/cn/company/fundamental/non_financial.py,sha256=oIe_xDAQRwLdHjjdIQKe9u-plC7IbiUiAekG73d7WTw,415
|
|
57
58
|
lixinger/models/cn/company/fundamental/other_financial.py,sha256=FWpX9lk22-UhV6RVIySpsKL1I2tlDRyxdj2s9ORsGLo,421
|
|
58
|
-
lixinger/models/cn/company/fundamental/security.py,sha256=
|
|
59
|
+
lixinger/models/cn/company/fundamental/security.py,sha256=W0ppyeftEHQrjidymOfLS96WWdWjb4IuwqM22Fx7wV4,385
|
|
59
60
|
lixinger/models/cn/fund/__init__.py,sha256=V_RlPF8F8xZxazWtec8RHcOlFUh4w10VPVKTAXn2o0k,643
|
|
60
61
|
lixinger/models/cn/fund/announcement.py,sha256=T8tUGpI7wo_l5tuf6QnY8AMbnFAKEtrcI1jfSKoQzsA,510
|
|
61
62
|
lixinger/models/cn/fund/asset_combination.py,sha256=b7O-tisxT-qnAFc_tKnOLNhYJZWp0InMB7t22lT9xC4,1538
|
|
@@ -78,7 +79,7 @@ lixinger/utils/dataframe.py,sha256=tYBrNdmJ4poyuwD-9XgzHt3A_A8bBo0cdHiu8Yy9e9A,2
|
|
|
78
79
|
lixinger/utils/dict.py,sha256=yvbUtv8QpRmy0d_o_7gCuEwwiEfBji5_xB490ANxilw,589
|
|
79
80
|
lixinger/utils/rate_limiter.py,sha256=DCaG87kIjDU5triYHU33-FW7h6KsbELBnU9f6mCQKCU,1133
|
|
80
81
|
lixinger/utils/retry.py,sha256=sXtb0ESp12_JedjzDxoeIH48TlOrbxtIA0j1V33DW7M,1026
|
|
81
|
-
lixinger_python-0.3.
|
|
82
|
-
lixinger_python-0.3.
|
|
83
|
-
lixinger_python-0.3.
|
|
84
|
-
lixinger_python-0.3.
|
|
82
|
+
lixinger_python-0.3.2.dist-info/METADATA,sha256=2sRCUZFwOBUSP2NF6SWq7Yk82sS5-7FCZ66cGiuOlCQ,9209
|
|
83
|
+
lixinger_python-0.3.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
84
|
+
lixinger_python-0.3.2.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
|
|
85
|
+
lixinger_python-0.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|