From 0af4d5f029d41e77db68e92878da413eea14dc03 Mon Sep 17 00:00:00 2001 From: linqi Date: Fri, 24 Jul 2026 18:53:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=E8=B0=83=E6=95=B4sdk=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/API_REFERENCE.md | 34 ++----------------------------- src/ftshare/apis/stock.py | 37 ---------------------------------- src/ftshare/endpoints/stock.py | 7 ------- tests/test_client.py | 3 +-- 4 files changed, 3 insertions(+), 78 deletions(-) diff --git a/docs/API_REFERENCE.md b/docs/API_REFERENCE.md index a9551b9..8cbe2d7 100644 --- a/docs/API_REFERENCE.md +++ b/docs/API_REFERENCE.md @@ -6,7 +6,7 @@ | 指标 | 数量 | |---|---:| -| SDK 方法总数 | 201 | +| SDK 方法总数 | 200 | ## 专题分布 @@ -14,7 +14,7 @@ | ftshare-doc 专题 | SDK 方法数 | API mixin 模块 | Endpoint 模块 | |---|---:|---|---| -| 股票数据 | 96 | `ftshare.apis.stock` | `ftshare.endpoints.stock` | +| 股票数据 | 95 | `ftshare.apis.stock` | `ftshare.endpoints.stock` | | 港股数据 | 14 | `ftshare.apis.hk` | `ftshare.endpoints.hk` | | 美股数据 | 9 | `ftshare.apis.us` | `ftshare.endpoints.us` | | 指数专题 | 10 | `ftshare.apis.index` | `ftshare.endpoints.index` | @@ -132,7 +132,6 @@ df = market.baidu_financial_calendar( | [`stock_share`](#api-stock-share) | 股本 | `GET` | `api/v1/market/data/share/get-stock-share` | `stock_code`, `date` | `股本.md` | | [`stock_share_chg`](#api-stock-share-chg) | 股东增减持 | `GET` | `api/v1/market/data/holder/stock-share-chg` | `stock_code`, `is_last`, `page`, `page_size` | `股东增减持.md` | | [`stock_signal_latest_snapshot`](#api-stock-signal-latest-snapshot) | 信号最新快照 | `GET` | `api/v1/market/data/stock-signal-latest-snapshot` | `signal_type`, `page`, `page_size` | `信号最新快照.md` | -| [`stock_trade`](#api-stock-trade) | 标的逐笔成交 | `GET` | `api/v1/market/data/daec/history/trades` | `symbol` | `标的逐笔成交.md` | | [`stock_unlock`](#api-stock-unlock) | 限售解禁 | `GET` | `api/v1/market/data/unlock/stock-unlock` | `stock_code`, `page`, `page_size` | `限售解禁.md` | | [`stock_unlock_by_date`](#api-stock-unlock-by-date) | 限售解禁按日期 | `GET` | `api/v1/market/data/unlock/stock-unlock-by-date` | `start_date`, `end_date`, `page`, `page_size` | `限售解禁按日期.md` | | [`suspension_list`](#api-suspension-list) | 停牌列表 | `GET` | `api/v1/market/data/suspension-list` | `trade_date`, `page`, `page_size` | `停牌列表.md` | @@ -3074,35 +3073,6 @@ Returns: payloads when multi-page fetching is used with ``raw=True``. ``` -

stock_trade

- -- 接口名称:标的逐笔成交 -- HTTP:`GET` -- Path:`api/v1/market/data/daec/history/trades` -- 参数:`symbol` -- 来源文档:`标的逐笔成交.md` -- 原始接口:`stock_trade` - -```text -股票分时成交. - -Endpoint: ``api/v1/market/data/daec/history/trades``. -Method: ``GET``. -Documented endpoint: ``stock_trade``. - -Args: - symbol: 标的代码 (type: SymbolKey; required: Y). - raw: Return the decoded JSON payload without tabular extraction. - fields: Optional field list or comma-separated field string applied after extraction. - as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows. - **kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated. - -Returns: - A pandas ``DataFrame`` by default, Python rows when - ``as_dataframe=False``, raw JSON when ``raw=True``, or raw page - payloads when multi-page fetching is used with ``raw=True``. -``` -

stock_unlock

- 接口名称:限售解禁 diff --git a/src/ftshare/apis/stock.py b/src/ftshare/apis/stock.py index 3c20c86..cb3b0d5 100644 --- a/src/ftshare/apis/stock.py +++ b/src/ftshare/apis/stock.py @@ -4540,43 +4540,6 @@ def stock_signal_latest_snapshot( **request_params, ) - def stock_trade( - self, - symbol: Any | None = None, - *, - raw: bool = False, - fields: Sequence[str] | str | None = None, - as_dataframe: bool = True, - **kwargs: Any, - ) -> Any: - """股票分时成交. - - Endpoint: ``api/v1/market/data/daec/history/trades``. - Method: ``GET``. - Documented endpoint: ``stock_trade``. - - Args: - symbol: 标的代码 (type: SymbolKey; required: Y). - raw: Return the decoded JSON payload without tabular extraction. - fields: Optional field list or comma-separated field string applied after extraction. - as_dataframe: Return a pandas ``DataFrame`` by default; set to ``False`` for Python rows. - **kwargs: Extra request parameters forwarded unchanged. Useful when the service adds parameters before the SDK is regenerated. - - Returns: - A pandas ``DataFrame`` by default, Python rows when - ``as_dataframe=False``, raw JSON when ``raw=True``, or raw page - payloads when multi-page fetching is used with ``raw=True``. - """ - request_params = {'symbol': symbol} - request_params.update(kwargs) - return self._call_endpoint( - 'stock_trade', - raw=raw, - fields=fields, - as_dataframe=as_dataframe, - **request_params, - ) - def stock_unlock( self, stock_code: Any | None = None, diff --git a/src/ftshare/endpoints/stock.py b/src/ftshare/endpoints/stock.py index 436ae6e..c744224 100644 --- a/src/ftshare/endpoints/stock.py +++ b/src/ftshare/endpoints/stock.py @@ -598,13 +598,6 @@ 'original_api': 'stock_signal_latest_snapshot', 'params': ('signal_type', 'page', 'page_size'), }, - 'stock_trade': { - 'path': 'api/v1/market/data/daec/history/trades', - 'title': '标的逐笔成交', - 'doc_file': '标的逐笔成交.md', - 'original_api': 'stock_trade', - 'params': ('symbol',), - }, 'stock_unlock': { 'path': 'api/v1/market/data/unlock/stock-unlock', 'title': '限售解禁', diff --git a/tests/test_client.py b/tests/test_client.py index 5994e27..9825c92 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -175,7 +175,7 @@ def test_endpoint_methods_map_to_expected_paths(method_name, kwargs): def test_all_documented_endpoints_are_available_as_client_methods(): client = FtshareClient(session=FakeSession([])) - assert len(ENDPOINTS) >= 180 + assert len(ENDPOINTS) >= 179 missing = [ name @@ -270,7 +270,6 @@ def test_missing_path_parameter_raises_value_error(): def test_confirmed_todo_endpoints_map_to_public_server_paths(): cases = [ - ("stock_trade", {"symbol": "600000.XSHG"}, "api/v1/market/data/daec/history/trades", {"symbol": "600000.XSHG"}), ( "stock_prev_close", {"symbol": "600000.XSHG", "since": "20240501", "until": "20240531"}, From aef9e6760f9d0003767c210997384cb8eb7ac771 Mon Sep 17 00:00:00 2001 From: linqi Date: Fri, 24 Jul 2026 19:07:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E8=B0=83=E6=95=B4=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_client.py | 7 ++++++- tests/test_endpoint_contracts.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 9825c92..83bbda5 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -175,7 +175,7 @@ def test_endpoint_methods_map_to_expected_paths(method_name, kwargs): def test_all_documented_endpoints_are_available_as_client_methods(): client = FtshareClient(session=FakeSession([])) - assert len(ENDPOINTS) >= 179 + assert len(ENDPOINTS) >= 200 missing = [ name @@ -186,6 +186,11 @@ def test_all_documented_endpoints_are_available_as_client_methods(): assert missing == [] +def test_removed_stock_trade_is_not_exposed(): + assert "stock_trade" not in ENDPOINTS + assert not hasattr(FtshareClient, "stock_trade") + + def test_generated_method_docstring_includes_parameter_metadata(): doc = FtshareClient.baidu_financial_calendar.__doc__ or "" diff --git a/tests/test_endpoint_contracts.py b/tests/test_endpoint_contracts.py index 1093bcb..302eaed 100644 --- a/tests/test_endpoint_contracts.py +++ b/tests/test_endpoint_contracts.py @@ -52,7 +52,7 @@ def _response_payload(name: str) -> Any: def test_contract_cases_cover_all_public_sdk_methods(): - assert len(PUBLIC_CONTRACTS) == 197 + assert len(PUBLIC_CONTRACTS) == 196 assert PUBLIC_CONTRACTS | NON_PUBLISHED_ENDPOINTS == set(ENDPOINTS) assert not (PUBLIC_CONTRACTS & NON_PUBLISHED_ENDPOINTS)