lixinger-python 0.3.3__py3-none-any.whl → 0.3.4__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/candlestick.py +50 -13
- {lixinger_python-0.3.3.dist-info → lixinger_python-0.3.4.dist-info}/METADATA +1 -1
- {lixinger_python-0.3.3.dist-info → lixinger_python-0.3.4.dist-info}/RECORD +5 -5
- {lixinger_python-0.3.3.dist-info → lixinger_python-0.3.4.dist-info}/WHEEL +0 -0
- {lixinger_python-0.3.3.dist-info → lixinger_python-0.3.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,13 +11,15 @@ from lixinger.utils.dataframe import get_response_df
|
|
|
11
11
|
class CandlestickAPI(BaseAPI):
|
|
12
12
|
"""Candlestick (K-line) data APIs."""
|
|
13
13
|
|
|
14
|
-
async def get_candlestick(
|
|
14
|
+
async def get_candlestick( # noqa: PLR0913
|
|
15
15
|
self,
|
|
16
|
-
type: Literal["1d", "1w", "1m", "5m", "15m", "30m", "60m"],
|
|
17
16
|
stock_code: str,
|
|
18
17
|
start_date: str,
|
|
19
18
|
end_date: str,
|
|
20
|
-
adjust_type: Literal["
|
|
19
|
+
adjust_type: Literal["ex_rights", "lxr_fc_rights", "fc_rights", "bc_rights"] | None = None,
|
|
20
|
+
adjust_forward_date: str | None = None,
|
|
21
|
+
adjust_backward_date: str | None = None,
|
|
22
|
+
limit: int | None = None,
|
|
21
23
|
) -> pd.DataFrame:
|
|
22
24
|
"""获取K线数据.
|
|
23
25
|
|
|
@@ -25,21 +27,35 @@ class CandlestickAPI(BaseAPI):
|
|
|
25
27
|
API Method: POST
|
|
26
28
|
|
|
27
29
|
Args:
|
|
28
|
-
type: K线类型 (1d, 1w, 1m, 5m, 15m, 30m, 60m)
|
|
29
30
|
stock_code: 股票代码
|
|
30
31
|
start_date: 开始日期 (YYYY-MM-DD)
|
|
31
32
|
end_date: 结束日期 (YYYY-MM-DD)
|
|
32
|
-
adjust_type: 复权类型
|
|
33
|
+
adjust_type: 复权类型
|
|
34
|
+
- ex_rights: 不复权
|
|
35
|
+
- lxr_fc_rights: 理杏仁前复权
|
|
36
|
+
- fc_rights: 前复权
|
|
37
|
+
- bc_rights: 后复权
|
|
38
|
+
adjust_forward_date: 前复权指定起始时间点 (YYYY-MM-DD),需要与endDate一起使用且大于或等于endDate
|
|
39
|
+
adjust_backward_date: 后复权指定起始时间点 (YYYY-MM-DD),需要与startDate一起使用且小于或等于startDate
|
|
40
|
+
limit: 返回最近数据的数量
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
DataFrame containing candlestick data
|
|
33
44
|
|
|
34
45
|
"""
|
|
35
46
|
payload: dict[str, Any] = {
|
|
36
|
-
"type": type,
|
|
37
47
|
"stockCode": stock_code,
|
|
38
48
|
"startDate": start_date,
|
|
39
49
|
"endDate": end_date,
|
|
40
50
|
}
|
|
41
51
|
if adjust_type is not None:
|
|
42
|
-
payload["
|
|
52
|
+
payload["type"] = adjust_type
|
|
53
|
+
if adjust_forward_date is not None:
|
|
54
|
+
payload["adjustForwardDate"] = adjust_forward_date
|
|
55
|
+
if adjust_backward_date is not None:
|
|
56
|
+
payload["adjustBackwardDate"] = adjust_backward_date
|
|
57
|
+
if limit is not None:
|
|
58
|
+
payload["limit"] = limit
|
|
43
59
|
|
|
44
60
|
data = await self._request("POST", "/cn/company/candlestick", json=payload)
|
|
45
61
|
return get_response_df(data, Candlestick)
|
|
@@ -50,27 +66,48 @@ _api_instance = CandlestickAPI()
|
|
|
50
66
|
|
|
51
67
|
|
|
52
68
|
@api
|
|
53
|
-
async def get_candlestick(
|
|
54
|
-
type: Literal["1d", "1w", "1m", "5m", "15m", "30m", "60m"],
|
|
69
|
+
async def get_candlestick( # noqa: PLR0913
|
|
55
70
|
stock_code: str,
|
|
56
71
|
start_date: str,
|
|
57
72
|
end_date: str,
|
|
58
|
-
adjust_type: Literal["
|
|
73
|
+
adjust_type: Literal["ex_rights", "lxr_fc_rights", "fc_rights", "bc_rights"] | None = None,
|
|
74
|
+
adjust_forward_date: str | None = None,
|
|
75
|
+
adjust_backward_date: str | None = None,
|
|
76
|
+
limit: int | None = None,
|
|
59
77
|
) -> pd.DataFrame:
|
|
60
78
|
"""获取K线数据.
|
|
61
79
|
|
|
62
80
|
Args:
|
|
63
|
-
type: K线类型 (1d, 1w, 1m, 5m, 15m, 30m, 60m)
|
|
64
81
|
stock_code: 股票代码
|
|
65
82
|
start_date: 开始日期 (YYYY-MM-DD)
|
|
66
83
|
end_date: 结束日期 (YYYY-MM-DD)
|
|
67
|
-
adjust_type: 复权类型
|
|
84
|
+
adjust_type: 复权类型
|
|
85
|
+
- ex_rights: 不复权
|
|
86
|
+
- lxr_fc_rights: 理杏仁前复权
|
|
87
|
+
- fc_rights: 前复权
|
|
88
|
+
- bc_rights: 后复权
|
|
89
|
+
adjust_forward_date: 前复权指定起始时间点 (YYYY-MM-DD)
|
|
90
|
+
adjust_backward_date: 后复权指定起始时间点 (YYYY-MM-DD)
|
|
91
|
+
limit: 返回最近数据的数量
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
DataFrame containing candlestick data
|
|
95
|
+
|
|
96
|
+
Example:
|
|
97
|
+
>>> df = await get_candlestick(
|
|
98
|
+
... stock_code="300750",
|
|
99
|
+
... start_date="2025-04-01",
|
|
100
|
+
... end_date="2026-04-01",
|
|
101
|
+
... adjust_type="lxr_fc_rights"
|
|
102
|
+
... )
|
|
68
103
|
|
|
69
104
|
"""
|
|
70
105
|
return await _api_instance.get_candlestick(
|
|
71
|
-
type=type,
|
|
72
106
|
stock_code=stock_code,
|
|
73
107
|
start_date=start_date,
|
|
74
108
|
end_date=end_date,
|
|
75
109
|
adjust_type=adjust_type,
|
|
110
|
+
adjust_forward_date=adjust_forward_date,
|
|
111
|
+
adjust_backward_date=adjust_backward_date,
|
|
112
|
+
limit=limit,
|
|
76
113
|
)
|
|
@@ -8,7 +8,7 @@ lixinger/api/base.py,sha256=lmlfLV4DGm1WQKEjBzC_PWnD8m1xbdvFFp8wzoClsnc,3174
|
|
|
8
8
|
lixinger/api/cn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
lixinger/api/cn/company/__init__.py,sha256=K8aNp2gGj4iQOvc8KjXA5668QUAhwyTfMBPhP3tgtMg,961
|
|
10
10
|
lixinger/api/cn/company/announcement.py,sha256=lYt4AWOV5b9OTKfvJ7ZOqWP61pcPcyIQzb5N2DqFT6k,1920
|
|
11
|
-
lixinger/api/cn/company/candlestick.py,sha256=
|
|
11
|
+
lixinger/api/cn/company/candlestick.py,sha256=mfd5rjcqLIcK43JPyB3nX_AlAGBBFYiIbtMCLJ9GO7w,3741
|
|
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
|
|
@@ -79,7 +79,7 @@ lixinger/utils/dataframe.py,sha256=tYBrNdmJ4poyuwD-9XgzHt3A_A8bBo0cdHiu8Yy9e9A,2
|
|
|
79
79
|
lixinger/utils/dict.py,sha256=yvbUtv8QpRmy0d_o_7gCuEwwiEfBji5_xB490ANxilw,589
|
|
80
80
|
lixinger/utils/rate_limiter.py,sha256=DCaG87kIjDU5triYHU33-FW7h6KsbELBnU9f6mCQKCU,1133
|
|
81
81
|
lixinger/utils/retry.py,sha256=sXtb0ESp12_JedjzDxoeIH48TlOrbxtIA0j1V33DW7M,1026
|
|
82
|
-
lixinger_python-0.3.
|
|
83
|
-
lixinger_python-0.3.
|
|
84
|
-
lixinger_python-0.3.
|
|
85
|
-
lixinger_python-0.3.
|
|
82
|
+
lixinger_python-0.3.4.dist-info/METADATA,sha256=0LWQiaWyHXtTOEDTtvr_luYvphjD4P2pYozxUbg4tTI,9209
|
|
83
|
+
lixinger_python-0.3.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
84
|
+
lixinger_python-0.3.4.dist-info/licenses/LICENSE,sha256=5oOwRq1lHSOScbNGCHr2feuNnhNYdGcArj6fSUfsC5U,1064
|
|
85
|
+
lixinger_python-0.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|