ffdata 0.2.5__tar.gz → 0.2.8__tar.gz

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.
Files changed (27) hide show
  1. {ffdata-0.2.5 → ffdata-0.2.8}/PKG-INFO +1 -1
  2. {ffdata-0.2.5 → ffdata-0.2.8}/pyproject.toml +1 -1
  3. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/__init__.py +24 -0
  4. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/client.py +113 -2
  5. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata.egg-info/PKG-INFO +1 -1
  6. {ffdata-0.2.5 → ffdata-0.2.8}/README.md +0 -0
  7. {ffdata-0.2.5 → ffdata-0.2.8}/scripts/configure_ffdata.sh +0 -0
  8. {ffdata-0.2.5 → ffdata-0.2.8}/setup.cfg +0 -0
  9. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/cli.py +0 -0
  10. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/datasets/__init__.py +0 -0
  11. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/datasets/manager.py +0 -0
  12. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/local/__init__.py +0 -0
  13. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/local/store.py +0 -0
  14. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/transport/__init__.py +0 -0
  15. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata/transport/http.py +0 -0
  16. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata.egg-info/SOURCES.txt +0 -0
  17. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata.egg-info/dependency_links.txt +0 -0
  18. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata.egg-info/entry_points.txt +0 -0
  19. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata.egg-info/requires.txt +0 -0
  20. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata.egg-info/top_level.txt +0 -0
  21. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/__init__.py +0 -0
  22. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/codecs/__init__.py +0 -0
  23. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/codecs/arrow.py +0 -0
  24. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/errors.py +0 -0
  25. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/protocol.py +0 -0
  26. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/schemas/__init__.py +0 -0
  27. {ffdata-0.2.5 → ffdata-0.2.8}/src/ffdata_common/schemas/manifest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffdata
3
- Version: 0.2.5
3
+ Version: 0.2.8
4
4
  Summary: ffdata lightweight Python client for governed financial-data APIs
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ffdata"
3
- version = "0.2.5"
3
+ version = "0.2.8"
4
4
  description = "ffdata lightweight Python client for governed financial-data APIs"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -82,6 +82,21 @@ def index_industry(*args: Any, **kwargs: Any):
82
82
  return _client().index_industry(*args, **kwargs)
83
83
 
84
84
 
85
+ def index_performance(*args: Any, **kwargs: Any):
86
+ """通过默认客户端查询指数区间行情表现(12 个区间,120 列)。"""
87
+ return _client().index_performance(*args, **kwargs)
88
+
89
+
90
+ def index_valuation(*args: Any, **kwargs: Any):
91
+ """通过默认客户端查询指数估值指标(33 列)。"""
92
+ return _client().index_valuation(*args, **kwargs)
93
+
94
+
95
+ def index_fina_indicator(*args: Any, **kwargs: Any):
96
+ """通过默认客户端查询指数财务指标(季频,118 列)。"""
97
+ return _client().index_fina_indicator(*args, **kwargs)
98
+
99
+
85
100
  def etf_basic(*args: Any, **kwargs: Any):
86
101
  """通过默认客户端查询 ETF 基础信息(返回含 ETF 与跟踪目标两个聚源内码)。"""
87
102
  return _client().etf_basic(*args, **kwargs)
@@ -137,6 +152,11 @@ def fund_stock_portfolio(*args: Any, **kwargs: Any):
137
152
  return _client().fund_stock_portfolio(*args, **kwargs)
138
153
 
139
154
 
155
+ def sge_daily(*args: Any, **kwargs: Any):
156
+ """通过默认客户端查询上海黄金交易所现货日行情(20 列,前 14 列对齐 Tushare)。"""
157
+ return _client().sge_daily(*args, **kwargs)
158
+
159
+
140
160
  def macro_indicator_basic(*args: Any, **kwargs: Any):
141
161
  return _client().macro_indicator_basic(*args, **kwargs)
142
162
 
@@ -171,11 +191,15 @@ __all__ = [
171
191
  "fund_stock_portfolio",
172
192
  "index_basic",
173
193
  "index_daily",
194
+ "index_fina_indicator",
195
+ "index_performance",
196
+ "index_valuation",
174
197
  "index_weight",
175
198
  "index_industry",
176
199
  "macro_indicator_basic",
177
200
  "macro_indicator_data",
178
201
  "query",
202
+ "sge_daily",
179
203
  "sql_query",
180
204
  "set_token",
181
205
  "stock_adjusting_factor",
@@ -274,6 +274,85 @@ class Client:
274
274
  fields=fields,
275
275
  )
276
276
 
277
+ def index_performance(
278
+ self,
279
+ ts_code: str | list[str] | None = None,
280
+ *,
281
+ trade_date: Any = None,
282
+ start_date: Any = None,
283
+ end_date: Any = None,
284
+ fields: list[str] | None = None,
285
+ ) -> pd.DataFrame:
286
+ """查询指数区间行情表现(12 个区间,120 列,ffdata 扩展接口)。
287
+
288
+ ``ts_code`` 与 ``trade_date`` 至少提供一个;``trade_date`` 与起止日期互斥。
289
+ 字段名与聚源 ``QT_IndexPerformance`` 源字段一一对应(机械 snake_case),
290
+ 例如 ``change_pct_tw``(1 周以来涨跌幅)、``change_pct_ytd``(今年以来涨跌幅)、
291
+ ``change_pct``(成立以来涨跌幅)。本接口仅支持远程查询。
292
+ """
293
+ return self.query(
294
+ "index_performance",
295
+ ts_code=ts_code,
296
+ trade_date=trade_date,
297
+ start_date=start_date,
298
+ end_date=end_date,
299
+ fields=fields,
300
+ )
301
+
302
+ def index_valuation(
303
+ self,
304
+ ts_code: str | list[str] | None = None,
305
+ *,
306
+ trade_date: Any = None,
307
+ start_date: Any = None,
308
+ end_date: Any = None,
309
+ fields: list[str] | None = None,
310
+ ) -> pd.DataFrame:
311
+ """查询 A 股/港股主要股票指数的每日估值指标(33 列,ffdata 扩展接口)。
312
+
313
+ 覆盖总市值、流通市值、自由流通市值、PE/PB/PCF/PS、股息率、风险溢价、PEG 等;
314
+ 过滤规则与 :meth:`index_performance` 相同。本接口仅支持远程查询。
315
+ """
316
+ return self.query(
317
+ "index_valuation",
318
+ ts_code=ts_code,
319
+ trade_date=trade_date,
320
+ start_date=start_date,
321
+ end_date=end_date,
322
+ fields=fields,
323
+ )
324
+
325
+ def index_fina_indicator(
326
+ self,
327
+ ts_code: str | list[str] | None = None,
328
+ *,
329
+ period: Any = None,
330
+ ann_date: Any = None,
331
+ start_ann_date: Any = None,
332
+ end_ann_date: Any = None,
333
+ start_date: Any = None,
334
+ end_date: Any = None,
335
+ fields: list[str] | None = None,
336
+ ) -> pd.DataFrame:
337
+ """查询 A 股/港股主要股票指数的季度财务指标(118 列,ffdata 扩展接口)。
338
+
339
+ 报告期维度(``period`` 或 ``start_date``+``end_date``)与公告日维度
340
+ (``ann_date`` 或 ``start_ann_date``+``end_ann_date``)可组合求交集;
341
+ 同维度参数互斥、区间成对。同一报告期可能有多个发布版本,接口不去重。
342
+ 本接口仅支持远程查询。
343
+ """
344
+ return self.query(
345
+ "index_fina_indicator",
346
+ ts_code=ts_code,
347
+ period=period,
348
+ ann_date=ann_date,
349
+ start_ann_date=start_ann_date,
350
+ end_ann_date=end_ann_date,
351
+ start_date=start_date,
352
+ end_date=end_date,
353
+ fields=fields,
354
+ )
355
+
277
356
  def macro_indicator_basic(
278
357
  self,
279
358
  *,
@@ -401,6 +480,7 @@ class Client:
401
480
  list_status: str | None = None,
402
481
  exchange: str | None = None,
403
482
  mgr: str | None = None,
483
+ csrc_category: str | None = None,
404
484
  fields: list[str] | None = None,
405
485
  ) -> pd.DataFrame:
406
486
  """查询 ETF 基础信息。
@@ -409,8 +489,9 @@ class Client:
409
489
  或纯代码(服务端剥离后缀后匹配,并校验后缀与交易所一致);``index_code``
410
490
  是跟踪目标代码,可能是指数,也可能是现货/商品标的;``list_status`` 取
411
491
  ``L``/``D``/``P``;``exchange`` 取 ``SH``/``SZ``;``mgr`` 按管理人简称
412
- 模糊匹配。返回 16 列,其中 ``inner_code``(ETF 聚源内码)与
413
- ``index_inner_code``(跟踪目标聚源内码)是 ffdata 扩展字段;不传任何过滤
492
+ 模糊匹配;``csrc_category`` 按证监会分类中文名称等值过滤。返回 21 列,其中 ``inner_code``(ETF 聚源内码)、
493
+ ``index_inner_code``(跟踪目标聚源内码)、``track_asset_type``(跟踪资产类型)
494
+ 与 ``track_asset_category``(原始类别编码)是 ffdata 扩展字段;不传任何过滤
414
495
  条件时返回全部沪深上市 ETF。本接口仅支持远程查询。
415
496
  """
416
497
  return self.query(
@@ -421,6 +502,7 @@ class Client:
421
502
  list_status=list_status,
422
503
  exchange=exchange,
423
504
  mgr=mgr,
505
+ csrc_category=csrc_category,
424
506
  fields=fields,
425
507
  )
426
508
 
@@ -504,6 +586,35 @@ class Client:
504
586
  fields=fields,
505
587
  )
506
588
 
589
+ def sge_daily(
590
+ self,
591
+ *,
592
+ ts_code: str | list[str] | None = None,
593
+ trade_date: Any = None,
594
+ start_date: Any = None,
595
+ end_date: Any = None,
596
+ date_type: int = 3,
597
+ fields: list[str] | None = None,
598
+ ) -> pd.DataFrame:
599
+ """查询上海黄金交易所现货日行情(20 列,前 14 列对齐 Tushare ``sge_daily``)。
600
+
601
+ ``ts_code`` 为聚源现货合约代码原值(如 ``Au99.99``、``Au(T+D)``、``iAu99.99``),
602
+ **不带市场后缀**,支持列表与逗号分隔;``trade_date`` 与 ``start_date``/
603
+ ``end_date`` 互斥,且至少需要 ``ts_code`` 或 ``trade_date`` 之一。
604
+ ``date_type`` 默认 ``3``(日,与 Tushare 一致),``4`` 为聚源周频扩展。
605
+ 价格元/克、``vol`` 千克、``amount`` 元、``pct_change`` 为百分数;``change`` 与
606
+ ``pct_change`` 为聚源原值(两者比较基准不同,见接口文档)。
607
+ """
608
+ return self.query(
609
+ "sge_daily",
610
+ ts_code=ts_code,
611
+ trade_date=trade_date,
612
+ start_date=start_date,
613
+ end_date=end_date,
614
+ date_type=date_type,
615
+ fields=fields,
616
+ )
617
+
507
618
  def cb_daily(
508
619
  self,
509
620
  *,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ffdata
3
- Version: 0.2.5
3
+ Version: 0.2.8
4
4
  Summary: ffdata lightweight Python client for governed financial-data APIs
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
File without changes
File without changes
File without changes
File without changes