reportify-sdk 0.3.0__py3-none-any.whl → 0.3.1__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.
reportify_sdk/__init__.py CHANGED
@@ -20,7 +20,7 @@ from reportify_sdk.exceptions import (
20
20
  APIError,
21
21
  )
22
22
 
23
- __version__ = "0.3.0"
23
+ __version__ = "0.3.1"
24
24
  __all__ = [
25
25
  "Reportify",
26
26
  "ReportifyError",
reportify_sdk/client.py CHANGED
@@ -74,7 +74,7 @@ class Reportify:
74
74
  return {
75
75
  "Authorization": f"Bearer {self.api_key}",
76
76
  "Content-Type": "application/json",
77
- "User-Agent": "reportify-sdk-python/0.3.0",
77
+ "User-Agent": "reportify-sdk-python/0.3.1",
78
78
  }
79
79
 
80
80
  def _request(
reportify_sdk/quant.py CHANGED
@@ -315,6 +315,63 @@ class QuantModule:
315
315
  response = self._client._post("/v1/quant/quotes/ohlcv/batch", json=data)
316
316
  return self._to_dataframe(response.get("datas", []))
317
317
 
318
+ # -------------------------------------------------------------------------
319
+ # Financials
320
+ # -------------------------------------------------------------------------
321
+
322
+ def financials(
323
+ self,
324
+ financial_type: Literal["income", "cashflow", "balancesheet", "equity"],
325
+ symbol: str,
326
+ *,
327
+ market: StockMarket = "cn",
328
+ start_year: int | None = None,
329
+ end_year: int | None = None,
330
+ ) -> pd.DataFrame:
331
+ """
332
+ Get historical financial statement data for a single symbol
333
+
334
+ Args:
335
+ financial_type: Type of financial statement
336
+ - "income": Income statement (利润表)
337
+ - "cashflow": Cash flow statement (现金流量表)
338
+ - "balancesheet": Balance sheet (资产负债表)
339
+ - "equity": Equity statement (股东权益变动表)
340
+ symbol: Stock code
341
+ market: Stock market ("cn", "hk", "us"), default "cn"
342
+ start_year: Start year (default: 3 years ago)
343
+ end_year: End year (default: current year)
344
+
345
+ Returns:
346
+ DataFrame with financial data sorted by report period
347
+
348
+ Example:
349
+ >>> # Get income statement
350
+ >>> df = client.quant.financials("income", "000001")
351
+ >>> print(df[["report_period", "revenue", "net_profit"]])
352
+
353
+ >>> # Get balance sheet for specific years
354
+ >>> df = client.quant.financials(
355
+ ... "balancesheet", "600519",
356
+ ... start_year=2020,
357
+ ... end_year=2024
358
+ ... )
359
+
360
+ >>> # Get cash flow statement for HK stock
361
+ >>> df = client.quant.financials("cashflow", "00700", market="hk")
362
+ """
363
+ params: dict[str, Any] = {
364
+ "symbol": symbol,
365
+ "market": market,
366
+ }
367
+ if start_year:
368
+ params["start_year"] = start_year
369
+ if end_year:
370
+ params["end_year"] = end_year
371
+
372
+ response = self._client._get(f"/v1/quant/financials/{financial_type}", params=params)
373
+ return self._to_dataframe(response.get("datas", []))
374
+
318
375
  # -------------------------------------------------------------------------
319
376
  # Backtest
320
377
  # -------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reportify-sdk
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Python SDK for Reportify API - Financial data and document search
5
5
  Author-email: Reportify <support@reportify.cn>
6
6
  License-Expression: MIT
@@ -1,19 +1,19 @@
1
- reportify_sdk/__init__.py,sha256=l7E4ELvxQ8qSEpgDK3-I3JfhBBKmLS8RP4hpbxieVac,662
1
+ reportify_sdk/__init__.py,sha256=EnQDmMSdKDtDP-in6pgEHvx224JTzWltM7AGVTBHMV8,662
2
2
  reportify_sdk/agent.py,sha256=y1iP4Jq7-ESMxeCWB_vxkAvwCjUCWT8K-ZSeJswU6nQ,6358
3
3
  reportify_sdk/channels.py,sha256=VbBCispCiP2Mzqn5lmBWVNWog4ElVni46mK2zg7KKzg,3518
4
4
  reportify_sdk/chat.py,sha256=GQVfre4p2H9Kb0imX1-LvGqMrtnsuGhjQskBNUqUI_I,3613
5
- reportify_sdk/client.py,sha256=RqJusEisy7-bWC35gTByb3E6BaD5DlDsTP7VmZ9zFQ0,8206
5
+ reportify_sdk/client.py,sha256=fj5pMBXZSMgwfgj_BqD1Riqaz5PW4S7fTq7PXuRqkPM,8206
6
6
  reportify_sdk/concepts.py,sha256=XlHPuuZacFFUccMthyeb5R2OTayFYxXgIODKNfJLa_c,1891
7
7
  reportify_sdk/docs.py,sha256=PsOJrm-tFvvfHyVOWUptLC6wHhze5AMizD8MkcktEBo,16814
8
8
  reportify_sdk/exceptions.py,sha256=r2_C_kTh6tCrQnfA3UozSqMMA-2OBnoP3pGpgYeqcdU,1049
9
9
  reportify_sdk/kb.py,sha256=3e82_56hvnGQ2fI404g3DAem9javPY7OpE5B8goYOB8,2895
10
- reportify_sdk/quant.py,sha256=9rWKWo2UlG3GfsQC-jpEgXUl25ojEabpvOGISyGMamM,15110
10
+ reportify_sdk/quant.py,sha256=BfhdKiimfC4tZDRkaMjssyoQJKy39aXbz2KfjShLiTg,17245
11
11
  reportify_sdk/search.py,sha256=rzleME8_DwdiJ-__0qPjXkQZmaJ6JXH-ycJ_mUlkkNw,11866
12
12
  reportify_sdk/stock.py,sha256=sBUYmbj3nz5HaOGF5HakRF5Qt9Y5veZA1U2vDRau2vw,21473
13
13
  reportify_sdk/timeline.py,sha256=7ZbF5-0eGoF_N5h9swEyYgZSaMb54PMwLDXlaqFS4ns,5396
14
14
  reportify_sdk/user.py,sha256=lsdhvaovllEwYiz4fhhSwl8PMX8tKswzABAvZbB0iJw,1261
15
- reportify_sdk-0.3.0.dist-info/licenses/LICENSE,sha256=zBUq4DL4lE-fZU_PMkr0gnxkYS1LhdRHFw8_LmCb-ek,1066
16
- reportify_sdk-0.3.0.dist-info/METADATA,sha256=1xLeNuSnTG6nMOzBH6AIzmoWdDWAN5d3HXXGPSQfMZA,6451
17
- reportify_sdk-0.3.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
18
- reportify_sdk-0.3.0.dist-info/top_level.txt,sha256=tc_dzCSWIDsNbHSi-FlyEEX8xwinhN9gl-CwyLRE4B0,14
19
- reportify_sdk-0.3.0.dist-info/RECORD,,
15
+ reportify_sdk-0.3.1.dist-info/licenses/LICENSE,sha256=zBUq4DL4lE-fZU_PMkr0gnxkYS1LhdRHFw8_LmCb-ek,1066
16
+ reportify_sdk-0.3.1.dist-info/METADATA,sha256=Mc2ecqS81TS9UlR2_RrHp26RQsUkg5DTpXi6Sa9_4dE,6451
17
+ reportify_sdk-0.3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
18
+ reportify_sdk-0.3.1.dist-info/top_level.txt,sha256=tc_dzCSWIDsNbHSi-FlyEEX8xwinhN9gl-CwyLRE4B0,14
19
+ reportify_sdk-0.3.1.dist-info/RECORD,,