ftshare 1.0.9__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.
- ftshare/__init__.py +98 -0
- ftshare/apis/__init__.py +29 -0
- ftshare/apis/bond.py +443 -0
- ftshare/apis/economic.py +1054 -0
- ftshare/apis/etf.py +623 -0
- ftshare/apis/forex.py +12 -0
- ftshare/apis/fund.py +985 -0
- ftshare/apis/futures.py +765 -0
- ftshare/apis/hk.py +44 -0
- ftshare/apis/index.py +499 -0
- ftshare/apis/llm_corpus.py +308 -0
- ftshare/apis/spot.py +69 -0
- ftshare/apis/stock.py +4673 -0
- ftshare/apis/us.py +117 -0
- ftshare/base.py +478 -0
- ftshare/client.py +74 -0
- ftshare/config.py +56 -0
- ftshare/dataframe.py +18 -0
- ftshare/endpoints/__init__.py +35 -0
- ftshare/endpoints/bond.py +89 -0
- ftshare/endpoints/economic.py +178 -0
- ftshare/endpoints/etf.py +143 -0
- ftshare/endpoints/forex.py +9 -0
- ftshare/endpoints/fund.py +136 -0
- ftshare/endpoints/futures.py +143 -0
- ftshare/endpoints/hk.py +32 -0
- ftshare/endpoints/index.py +123 -0
- ftshare/endpoints/llm_corpus.py +45 -0
- ftshare/endpoints/spot.py +16 -0
- ftshare/endpoints/stock.py +949 -0
- ftshare/endpoints/types.py +40 -0
- ftshare/endpoints/us.py +23 -0
- ftshare/exceptions.py +59 -0
- ftshare/fields.py +35 -0
- ftshare/pagination.py +33 -0
- ftshare/params.py +13 -0
- ftshare/py.typed +1 -0
- ftshare/response.py +69 -0
- ftshare-1.0.9.dist-info/METADATA +256 -0
- ftshare-1.0.9.dist-info/RECORD +42 -0
- ftshare-1.0.9.dist-info/WHEEL +4 -0
- ftshare-1.0.9.dist-info/licenses/LICENSE +21 -0
ftshare/__init__.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""Public entrypoint for the ftshare Python SDK.
|
|
2
|
+
|
|
3
|
+
Typical usage:
|
|
4
|
+
|
|
5
|
+
import ftshare as ft
|
|
6
|
+
|
|
7
|
+
market = ft.market_api()
|
|
8
|
+
payload = market.baidu_financial_calendar(
|
|
9
|
+
start_date="2026-05-26",
|
|
10
|
+
end_date="2026-05-27",
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
The package-level ``BASE_URL`` is intentionally mutable so deployments can
|
|
14
|
+
switch environments without changing every client construction site.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from collections.abc import Mapping
|
|
20
|
+
|
|
21
|
+
from . import client as _client
|
|
22
|
+
from .client import DEFAULT_BASE_URL, FtshareClient
|
|
23
|
+
from .exceptions import (
|
|
24
|
+
FtshareAPIError,
|
|
25
|
+
FtshareDecodeError,
|
|
26
|
+
FtshareError,
|
|
27
|
+
FtshareHTTPError,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
BASE_URL = _client.get_base_url()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_base_url() -> str:
|
|
34
|
+
"""Return the package-level base URL used by ``market_api()``.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
The normalized base URL, always ending with ``/``.
|
|
38
|
+
"""
|
|
39
|
+
return BASE_URL
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def set_base_url(url: str) -> str:
|
|
43
|
+
"""Set the package-level base URL used by new clients.
|
|
44
|
+
|
|
45
|
+
Args:
|
|
46
|
+
url: API base URL. Both ``https://host/gateway`` and
|
|
47
|
+
``https://host/gateway/`` are accepted.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
The normalized base URL.
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
ValueError: If ``url`` is empty after stripping whitespace.
|
|
54
|
+
"""
|
|
55
|
+
global BASE_URL
|
|
56
|
+
BASE_URL = _client.set_base_url(url)
|
|
57
|
+
return BASE_URL
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def market_api(
|
|
61
|
+
base_url: str | None = None,
|
|
62
|
+
timeout: float = 10,
|
|
63
|
+
headers: Mapping[str, str] | None = None,
|
|
64
|
+
api_key: str | None = None,
|
|
65
|
+
) -> FtshareClient:
|
|
66
|
+
"""Create a synchronous FTShare market data API client.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
base_url: Optional client-specific base URL. If omitted, the current
|
|
70
|
+
package-level ``BASE_URL`` is used.
|
|
71
|
+
timeout: Request timeout in seconds.
|
|
72
|
+
headers: Optional headers applied to every request from this client.
|
|
73
|
+
api_key: Optional FTShare API key. Defaults to the ``FTSHARE_API_KEY``
|
|
74
|
+
environment variable.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
A configured ``FtshareClient`` instance.
|
|
78
|
+
"""
|
|
79
|
+
return _client.market_api(
|
|
80
|
+
base_url=base_url or BASE_URL,
|
|
81
|
+
timeout=timeout,
|
|
82
|
+
headers=headers,
|
|
83
|
+
api_key=api_key,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
__all__ = [
|
|
88
|
+
"BASE_URL",
|
|
89
|
+
"DEFAULT_BASE_URL",
|
|
90
|
+
"FtshareAPIError",
|
|
91
|
+
"FtshareClient",
|
|
92
|
+
"FtshareDecodeError",
|
|
93
|
+
"FtshareError",
|
|
94
|
+
"FtshareHTTPError",
|
|
95
|
+
"get_base_url",
|
|
96
|
+
"market_api",
|
|
97
|
+
"set_base_url",
|
|
98
|
+
]
|
ftshare/apis/__init__.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""ftshare-doc topic API mixins used by ``FtshareClient``."""
|
|
2
|
+
|
|
3
|
+
from .stock import StockApiMixin
|
|
4
|
+
from .hk import HkApiMixin
|
|
5
|
+
from .us import UsApiMixin
|
|
6
|
+
from .index import IndexApiMixin
|
|
7
|
+
from .etf import EtfApiMixin
|
|
8
|
+
from .fund import FundApiMixin
|
|
9
|
+
from .futures import FuturesApiMixin
|
|
10
|
+
from .bond import BondApiMixin
|
|
11
|
+
from .economic import EconomicApiMixin
|
|
12
|
+
from .llm_corpus import LlmCorpusApiMixin
|
|
13
|
+
from .spot import SpotApiMixin
|
|
14
|
+
from .forex import ForexApiMixin
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
'StockApiMixin',
|
|
18
|
+
'HkApiMixin',
|
|
19
|
+
'UsApiMixin',
|
|
20
|
+
'IndexApiMixin',
|
|
21
|
+
'EtfApiMixin',
|
|
22
|
+
'FundApiMixin',
|
|
23
|
+
'FuturesApiMixin',
|
|
24
|
+
'BondApiMixin',
|
|
25
|
+
'EconomicApiMixin',
|
|
26
|
+
'LlmCorpusApiMixin',
|
|
27
|
+
'SpotApiMixin',
|
|
28
|
+
'ForexApiMixin',
|
|
29
|
+
]
|
ftshare/apis/bond.py
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
"""Bond API methods grouped by ftshare-doc."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Sequence
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from ..endpoints import ENDPOINTS
|
|
9
|
+
from ..params import symbols_to_json_string
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BondApiMixin:
|
|
13
|
+
"""Endpoint methods for the bond ftshare-doc topic."""
|
|
14
|
+
|
|
15
|
+
def convertible_bond_candlesticks(
|
|
16
|
+
self,
|
|
17
|
+
symbol: Any | None = None,
|
|
18
|
+
interval_unit: Any | None = None,
|
|
19
|
+
adjust_kind: Any | None = None,
|
|
20
|
+
since_ts_millis: Any | None = None,
|
|
21
|
+
until_ts_millis: Any | None = None,
|
|
22
|
+
limit: Any | None = None,
|
|
23
|
+
*,
|
|
24
|
+
raw: bool = False,
|
|
25
|
+
fields: Sequence[str] | str | None = None,
|
|
26
|
+
as_dataframe: bool = True,
|
|
27
|
+
**kwargs: Any,
|
|
28
|
+
) -> Any:
|
|
29
|
+
"""可转债历史K线.
|
|
30
|
+
|
|
31
|
+
Endpoint: ``api/v1/market/data/convertible-bond-candlesticks``.
|
|
32
|
+
Method: ``GET``.
|
|
33
|
+
Documented endpoint: ``convertible_bond_candlesticks``.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
symbol: 单只可转债代码,如 113042.SH;也接受 .XSHG、.XSHE 后缀 (type: string; required: Y).
|
|
37
|
+
interval_unit: 周期单位:Day/Week/Month/Year,大小写不敏感 (type: enum; required: Y).
|
|
38
|
+
adjust_kind: 复权:None(默认,不复权)/Forward(前复权)/Backward(后复权) (type: enum; required: N).
|
|
39
|
+
since_ts_millis: 起始时间戳,单位毫秒;不得晚于 until,且与 until 相差不超过 12 个自然月 (type: int(ms); required: Y).
|
|
40
|
+
until_ts_millis: 结束时间戳,单位毫秒 (type: int(ms); required: Y).
|
|
41
|
+
limit: 保留最新 K 线条数上限;省略返回窗口内全部记录 (type: int; required: N).
|
|
42
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
43
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
44
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
45
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
49
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
50
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
51
|
+
"""
|
|
52
|
+
request_params = {'symbol': symbol, 'interval_unit': interval_unit, 'adjust_kind': adjust_kind, 'since_ts_millis': since_ts_millis, 'until_ts_millis': until_ts_millis, 'limit': limit}
|
|
53
|
+
request_params.update(kwargs)
|
|
54
|
+
return self._call_endpoint(
|
|
55
|
+
'convertible_bond_candlesticks',
|
|
56
|
+
raw=raw,
|
|
57
|
+
fields=fields,
|
|
58
|
+
as_dataframe=as_dataframe,
|
|
59
|
+
**request_params,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def convertible_bond_candlesticks_batch(
|
|
63
|
+
self,
|
|
64
|
+
symbols: Any | None = None,
|
|
65
|
+
interval_unit: Any | None = None,
|
|
66
|
+
adjust_kind: Any | None = None,
|
|
67
|
+
since_ts_millis: Any | None = None,
|
|
68
|
+
until_ts_millis: Any | None = None,
|
|
69
|
+
limit: Any | None = None,
|
|
70
|
+
*,
|
|
71
|
+
raw: bool = False,
|
|
72
|
+
fields: Sequence[str] | str | None = None,
|
|
73
|
+
as_dataframe: bool = True,
|
|
74
|
+
**kwargs: Any,
|
|
75
|
+
) -> Any:
|
|
76
|
+
"""批量可转债历史K线.
|
|
77
|
+
|
|
78
|
+
Endpoint: ``api/v2/market/data/convertible-bond-candlesticks/batch``.
|
|
79
|
+
Method: ``GET``.
|
|
80
|
+
Documented endpoint: ``convertible_bond_candlesticks_batch``.
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
symbols: 可转债代码列表,1~20 个;支持重复参数、逗号分隔或 JSON 字符串数组 (type: string[]; required: Y).
|
|
84
|
+
interval_unit: 周期单位:Day/Week/Month/Year,大小写不敏感 (type: enum; required: Y).
|
|
85
|
+
adjust_kind: 复权:None(默认,不复权)/Forward(前复权)/Backward(后复权) (type: enum; required: N).
|
|
86
|
+
since_ts_millis: 起始时间戳,单位毫秒;不得晚于 until,且与 until 相差不超过 12 个自然月 (type: int(ms); required: Y).
|
|
87
|
+
until_ts_millis: 结束时间戳,单位毫秒 (type: int(ms); required: Y).
|
|
88
|
+
limit: 每个标的最新 K 线条数上限;省略返回窗口内全部记录 (type: int; required: N).
|
|
89
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
90
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
91
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
92
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
96
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
97
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
98
|
+
"""
|
|
99
|
+
request_params = {'symbols': symbols, 'interval_unit': interval_unit, 'adjust_kind': adjust_kind, 'since_ts_millis': since_ts_millis, 'until_ts_millis': until_ts_millis, 'limit': limit}
|
|
100
|
+
request_params.update(kwargs)
|
|
101
|
+
return self._call_endpoint(
|
|
102
|
+
'convertible_bond_candlesticks_batch',
|
|
103
|
+
raw=raw,
|
|
104
|
+
fields=fields,
|
|
105
|
+
as_dataframe=as_dataframe,
|
|
106
|
+
**request_params,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def convertible_bond_minute_candlesticks(
|
|
110
|
+
self,
|
|
111
|
+
symbol: Any | None = None,
|
|
112
|
+
symbols: Any | None = None,
|
|
113
|
+
interval_value: Any | None = None,
|
|
114
|
+
since_ts_millis: Any | None = None,
|
|
115
|
+
until_ts_millis: Any | None = None,
|
|
116
|
+
limit: Any | None = None,
|
|
117
|
+
*,
|
|
118
|
+
raw: bool = False,
|
|
119
|
+
fields: Sequence[str] | str | None = None,
|
|
120
|
+
as_dataframe: bool = True,
|
|
121
|
+
**kwargs: Any,
|
|
122
|
+
) -> Any:
|
|
123
|
+
"""可转债历史分钟K线.
|
|
124
|
+
|
|
125
|
+
Endpoint: ``api/v2/market/data/convertible-bond-minute-candlesticks``.
|
|
126
|
+
Method: ``GET``.
|
|
127
|
+
Documented endpoint: ``convertible_bond_minute_candlesticks``.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
symbol: 单只可转债代码(与 symbols 二选一,不能同时传) (type: string; required: N).
|
|
131
|
+
symbols: 1~20 个可转债代码;支持重复参数、逗号分隔或 JSON 字符串数组(与 symbol 二选一) (type: string[]; required: N).
|
|
132
|
+
interval_value: 分钟周期:仅支持 1、5、15,默认 1 (type: enum; required: N).
|
|
133
|
+
since_ts_millis: 起始时间戳,单位毫秒;单只、批量都必须提供 (type: int(ms); required: Y).
|
|
134
|
+
until_ts_millis: 结束时间戳,单位毫秒;不得早于 since,且单次跨度不超过 3 个自然日 (type: int(ms); required: Y).
|
|
135
|
+
limit: 每只标的聚合后最多返回条数,范围 1~1000;省略返回窗口内全部记录 (type: int; required: N).
|
|
136
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
137
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
138
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
139
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
143
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
144
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
145
|
+
"""
|
|
146
|
+
request_params = {'symbol': symbol, 'symbols': symbols, 'interval_value': interval_value, 'since_ts_millis': since_ts_millis, 'until_ts_millis': until_ts_millis, 'limit': limit}
|
|
147
|
+
request_params.update(kwargs)
|
|
148
|
+
return self._call_endpoint(
|
|
149
|
+
'convertible_bond_minute_candlesticks',
|
|
150
|
+
raw=raw,
|
|
151
|
+
fields=fields,
|
|
152
|
+
as_dataframe=as_dataframe,
|
|
153
|
+
**request_params,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
def convertible_bond_realtime_day_kline(self, symbols: Any | None = None, *, raw: bool = False, fields: Sequence[str] | str | None = None, as_dataframe: bool = True, **kwargs: Any) -> Any:
|
|
157
|
+
"""可转债实时日K线.
|
|
158
|
+
|
|
159
|
+
Endpoint: ``api/v4/market/data/convertible-bond-realtime-day-kline``.
|
|
160
|
+
Method: ``GET``.
|
|
161
|
+
Documented endpoint: ``convertible_bond_realtime_day_kline``.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
symbols: 1~20 个可转债代码的 JSON 字符串数组,如 ``["113042.SH","123107.SZ"]``;单只也必须传单元素数组 (type: string; required: Y).
|
|
165
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
166
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
167
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
168
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
172
|
+
``as_dataframe=False``, or raw JSON when ``raw=True``.
|
|
173
|
+
"""
|
|
174
|
+
params = {'symbols': symbols_to_json_string(symbols)}
|
|
175
|
+
params.update(kwargs)
|
|
176
|
+
return self._call_endpoint('convertible_bond_realtime_day_kline', raw=raw, fields=fields, as_dataframe=as_dataframe, **params)
|
|
177
|
+
|
|
178
|
+
def convertible_bond_realtime_minute_kline(self, symbols: Any | None = None, *, raw: bool = False, fields: Sequence[str] | str | None = None, as_dataframe: bool = True, **kwargs: Any) -> Any:
|
|
179
|
+
"""可转债实时分钟K线.
|
|
180
|
+
|
|
181
|
+
Endpoint: ``api/v4/market/data/convertible-bond-realtime-minute-kline``.
|
|
182
|
+
Method: ``GET``.
|
|
183
|
+
Documented endpoint: ``convertible_bond_realtime_minute_kline``.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
symbols: 1~20 个可转债代码的 JSON 字符串数组,如 ``["113042.SH","123107.SZ"]``;单只也必须传单元素数组 (type: string; required: Y).
|
|
187
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
188
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
189
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
190
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
194
|
+
``as_dataframe=False``, or raw JSON when ``raw=True``.
|
|
195
|
+
"""
|
|
196
|
+
params = {'symbols': symbols_to_json_string(symbols)}
|
|
197
|
+
params.update(kwargs)
|
|
198
|
+
return self._call_endpoint('convertible_bond_realtime_minute_kline', raw=raw, fields=fields, as_dataframe=as_dataframe, **params)
|
|
199
|
+
|
|
200
|
+
def szse_convertible_bond_matching_trades(
|
|
201
|
+
self,
|
|
202
|
+
security_code: Any | None = None,
|
|
203
|
+
trade_date: Any | None = None,
|
|
204
|
+
start_date: Any | None = None,
|
|
205
|
+
end_date: Any | None = None,
|
|
206
|
+
page: int | None = None,
|
|
207
|
+
page_size: int | None = None,
|
|
208
|
+
limit: int | None = None,
|
|
209
|
+
all_pages: bool = False,
|
|
210
|
+
max_pages: int | None = None,
|
|
211
|
+
*,
|
|
212
|
+
raw: bool = False,
|
|
213
|
+
fields: Sequence[str] | str | None = None,
|
|
214
|
+
as_dataframe: bool = True,
|
|
215
|
+
**kwargs: Any,
|
|
216
|
+
) -> Any:
|
|
217
|
+
"""深交所可转债匹配成交.
|
|
218
|
+
|
|
219
|
+
Endpoint: ``api/v1/market/data/convertible-bond/szse/matching-trades``.
|
|
220
|
+
Method: ``GET``.
|
|
221
|
+
Documented endpoint: ``szse_convertible_bond_matching_trades``.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
security_code: 六位可转债证券代码,例如 `123001`。 (type: string; required: N).
|
|
225
|
+
trade_date: 单个交易日,格式 `YYYYMMDD`;不能与 `start_date`、`end_date` 同时使用。 (type: integer; required: N).
|
|
226
|
+
start_date: 查询开始日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
227
|
+
end_date: 查询结束日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
228
|
+
page: Page number, starting from 1. If omitted, the server default is used unless ``limit`` or ``all_pages`` is set.
|
|
229
|
+
page_size: Rows per page. The SDK validates this against the endpoint-specific maximum.
|
|
230
|
+
limit: Maximum number of rows to return. The SDK may fetch multiple pages to satisfy this limit.
|
|
231
|
+
all_pages: Fetch and combine pages until the server reports the last page.
|
|
232
|
+
max_pages: Optional safety cap for ``all_pages``.
|
|
233
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
234
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
235
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
236
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
237
|
+
|
|
238
|
+
Returns:
|
|
239
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
240
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
241
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
242
|
+
"""
|
|
243
|
+
request_params = {'security_code': security_code, 'trade_date': trade_date, 'start_date': start_date, 'end_date': end_date}
|
|
244
|
+
request_params.update(kwargs)
|
|
245
|
+
path = ENDPOINTS['szse_convertible_bond_matching_trades'].path
|
|
246
|
+
return self.get_paginated(
|
|
247
|
+
path,
|
|
248
|
+
page=page,
|
|
249
|
+
page_size=page_size,
|
|
250
|
+
limit=limit,
|
|
251
|
+
all_pages=all_pages,
|
|
252
|
+
max_pages=max_pages,
|
|
253
|
+
raw=raw,
|
|
254
|
+
fields=fields,
|
|
255
|
+
as_dataframe=as_dataframe,
|
|
256
|
+
**request_params,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def szse_convertible_bond_negotiated_trades(
|
|
261
|
+
self,
|
|
262
|
+
security_code: Any | None = None,
|
|
263
|
+
trade_date: Any | None = None,
|
|
264
|
+
start_date: Any | None = None,
|
|
265
|
+
end_date: Any | None = None,
|
|
266
|
+
page: int | None = None,
|
|
267
|
+
page_size: int | None = None,
|
|
268
|
+
limit: int | None = None,
|
|
269
|
+
all_pages: bool = False,
|
|
270
|
+
max_pages: int | None = None,
|
|
271
|
+
*,
|
|
272
|
+
raw: bool = False,
|
|
273
|
+
fields: Sequence[str] | str | None = None,
|
|
274
|
+
as_dataframe: bool = True,
|
|
275
|
+
**kwargs: Any,
|
|
276
|
+
) -> Any:
|
|
277
|
+
"""深交所可转债协议成交.
|
|
278
|
+
|
|
279
|
+
Endpoint: ``api/v1/market/data/convertible-bond/szse/negotiated-trades``.
|
|
280
|
+
Method: ``GET``.
|
|
281
|
+
Documented endpoint: ``szse_convertible_bond_negotiated_trades``.
|
|
282
|
+
|
|
283
|
+
Args:
|
|
284
|
+
security_code: 六位可转债证券代码,例如 `123001`。 (type: string; required: N).
|
|
285
|
+
trade_date: 单个交易日,格式 `YYYYMMDD`;不能与 `start_date`、`end_date` 同时使用。 (type: integer; required: N).
|
|
286
|
+
start_date: 查询开始日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
287
|
+
end_date: 查询结束日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
288
|
+
page: Page number, starting from 1. If omitted, the server default is used unless ``limit`` or ``all_pages`` is set.
|
|
289
|
+
page_size: Rows per page. The SDK validates this against the endpoint-specific maximum.
|
|
290
|
+
limit: Maximum number of rows to return. The SDK may fetch multiple pages to satisfy this limit.
|
|
291
|
+
all_pages: Fetch and combine pages until the server reports the last page.
|
|
292
|
+
max_pages: Optional safety cap for ``all_pages``.
|
|
293
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
294
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
295
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
296
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
300
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
301
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
302
|
+
"""
|
|
303
|
+
request_params = {'security_code': security_code, 'trade_date': trade_date, 'start_date': start_date, 'end_date': end_date}
|
|
304
|
+
request_params.update(kwargs)
|
|
305
|
+
path = ENDPOINTS['szse_convertible_bond_negotiated_trades'].path
|
|
306
|
+
return self.get_paginated(
|
|
307
|
+
path,
|
|
308
|
+
page=page,
|
|
309
|
+
page_size=page_size,
|
|
310
|
+
limit=limit,
|
|
311
|
+
all_pages=all_pages,
|
|
312
|
+
max_pages=max_pages,
|
|
313
|
+
raw=raw,
|
|
314
|
+
fields=fields,
|
|
315
|
+
as_dataframe=as_dataframe,
|
|
316
|
+
**request_params,
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def szse_convertible_bond_directed_trades(
|
|
321
|
+
self,
|
|
322
|
+
security_code: Any | None = None,
|
|
323
|
+
trade_date: Any | None = None,
|
|
324
|
+
start_date: Any | None = None,
|
|
325
|
+
end_date: Any | None = None,
|
|
326
|
+
page: int | None = None,
|
|
327
|
+
page_size: int | None = None,
|
|
328
|
+
limit: int | None = None,
|
|
329
|
+
all_pages: bool = False,
|
|
330
|
+
max_pages: int | None = None,
|
|
331
|
+
*,
|
|
332
|
+
raw: bool = False,
|
|
333
|
+
fields: Sequence[str] | str | None = None,
|
|
334
|
+
as_dataframe: bool = True,
|
|
335
|
+
**kwargs: Any,
|
|
336
|
+
) -> Any:
|
|
337
|
+
"""深交所可转债定向成交.
|
|
338
|
+
|
|
339
|
+
Endpoint: ``api/v1/market/data/convertible-bond/szse/directed-trades``.
|
|
340
|
+
Method: ``GET``.
|
|
341
|
+
Documented endpoint: ``szse_convertible_bond_directed_trades``.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
security_code: 六位可转债证券代码,例如 `123001`。 (type: string; required: N).
|
|
345
|
+
trade_date: 单个交易日,格式 `YYYYMMDD`;不能与 `start_date`、`end_date` 同时使用。 (type: integer; required: N).
|
|
346
|
+
start_date: 查询开始日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
347
|
+
end_date: 查询结束日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
348
|
+
page: Page number, starting from 1. If omitted, the server default is used unless ``limit`` or ``all_pages`` is set.
|
|
349
|
+
page_size: Rows per page. The SDK validates this against the endpoint-specific maximum.
|
|
350
|
+
limit: Maximum number of rows to return. The SDK may fetch multiple pages to satisfy this limit.
|
|
351
|
+
all_pages: Fetch and combine pages until the server reports the last page.
|
|
352
|
+
max_pages: Optional safety cap for ``all_pages``.
|
|
353
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
354
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
355
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
356
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
357
|
+
|
|
358
|
+
Returns:
|
|
359
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
360
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
361
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
362
|
+
"""
|
|
363
|
+
request_params = {'security_code': security_code, 'trade_date': trade_date, 'start_date': start_date, 'end_date': end_date}
|
|
364
|
+
request_params.update(kwargs)
|
|
365
|
+
path = ENDPOINTS['szse_convertible_bond_directed_trades'].path
|
|
366
|
+
return self.get_paginated(
|
|
367
|
+
path,
|
|
368
|
+
page=page,
|
|
369
|
+
page_size=page_size,
|
|
370
|
+
limit=limit,
|
|
371
|
+
all_pages=all_pages,
|
|
372
|
+
max_pages=max_pages,
|
|
373
|
+
raw=raw,
|
|
374
|
+
fields=fields,
|
|
375
|
+
as_dataframe=as_dataframe,
|
|
376
|
+
**request_params,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def cb_lists(self, *, raw: bool = False, fields: Sequence[str] | str | None = None, as_dataframe: bool = True, **kwargs: Any) -> Any:
|
|
381
|
+
"""可转债列表."""
|
|
382
|
+
params = {}
|
|
383
|
+
params.update(kwargs)
|
|
384
|
+
return self._call_endpoint('cb_lists', raw=raw, fields=fields, as_dataframe=as_dataframe, **params)
|
|
385
|
+
|
|
386
|
+
def szse_convertible_bond_declaration_snapshots(
|
|
387
|
+
self,
|
|
388
|
+
security_code: Any | None = None,
|
|
389
|
+
trade_date: Any | None = None,
|
|
390
|
+
start_date: Any | None = None,
|
|
391
|
+
end_date: Any | None = None,
|
|
392
|
+
page: int | None = None,
|
|
393
|
+
page_size: int | None = None,
|
|
394
|
+
limit: int | None = None,
|
|
395
|
+
all_pages: bool = False,
|
|
396
|
+
max_pages: int | None = None,
|
|
397
|
+
*,
|
|
398
|
+
raw: bool = False,
|
|
399
|
+
fields: Sequence[str] | str | None = None,
|
|
400
|
+
as_dataframe: bool = True,
|
|
401
|
+
**kwargs: Any,
|
|
402
|
+
) -> Any:
|
|
403
|
+
"""深交所可转债申报快照.
|
|
404
|
+
|
|
405
|
+
Endpoint: ``api/v1/market/data/convertible-bond/szse/declaration-snapshots``.
|
|
406
|
+
Method: ``GET``.
|
|
407
|
+
Documented endpoint: ``szse_convertible_bond_declaration_snapshots``.
|
|
408
|
+
|
|
409
|
+
Args:
|
|
410
|
+
security_code: 六位可转债证券代码,例如 `123001`。 (type: string; required: N).
|
|
411
|
+
trade_date: 单个交易日,格式 `YYYYMMDD`;不能与 `start_date`、`end_date` 同时使用。 (type: integer; required: N).
|
|
412
|
+
start_date: 查询开始日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
413
|
+
end_date: 查询结束日期,格式 `YYYYMMDD`。 (type: integer; required: N).
|
|
414
|
+
page: Page number, starting from 1. If omitted, the server default is used unless ``limit`` or ``all_pages`` is set.
|
|
415
|
+
page_size: Rows per page. The SDK validates this against the endpoint-specific maximum.
|
|
416
|
+
limit: Maximum number of rows to return. The SDK may fetch multiple pages to satisfy this limit.
|
|
417
|
+
all_pages: Fetch and combine pages until the server reports the last page.
|
|
418
|
+
max_pages: Optional safety cap for ``all_pages``.
|
|
419
|
+
raw: Return the decoded JSON payload without tabular extraction.
|
|
420
|
+
fields: Optional field list or comma-separated field string applied after extraction.
|
|
421
|
+
as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows.
|
|
422
|
+
**kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated.
|
|
423
|
+
|
|
424
|
+
Returns:
|
|
425
|
+
A pandas ``DataFrame`` by default, Python rows when
|
|
426
|
+
``as_dataframe=False``, raw JSON when ``raw=True``, or raw page
|
|
427
|
+
payloads when multi-page fetching is used with ``raw=True``.
|
|
428
|
+
"""
|
|
429
|
+
request_params = {'security_code': security_code, 'trade_date': trade_date, 'start_date': start_date, 'end_date': end_date}
|
|
430
|
+
request_params.update(kwargs)
|
|
431
|
+
path = ENDPOINTS['szse_convertible_bond_declaration_snapshots'].path
|
|
432
|
+
return self.get_paginated(
|
|
433
|
+
path,
|
|
434
|
+
page=page,
|
|
435
|
+
page_size=page_size,
|
|
436
|
+
limit=limit,
|
|
437
|
+
all_pages=all_pages,
|
|
438
|
+
max_pages=max_pages,
|
|
439
|
+
raw=raw,
|
|
440
|
+
fields=fields,
|
|
441
|
+
as_dataframe=as_dataframe,
|
|
442
|
+
**request_params,
|
|
443
|
+
)
|