akshare-one 0.3.11__py3-none-any.whl → 0.3.12__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.
@@ -28,8 +28,17 @@ class SinaFinancialReport(FinancialDataProvider):
28
28
  Returns:
29
29
  Standardized DataFrame with balance sheet data
30
30
  """
31
- raw_df = ak.stock_financial_report_sina(stock=self.stock, symbol="资产负债表")
32
- return self._clean_balance_data(raw_df)
31
+ try:
32
+ raw_df = ak.stock_financial_report_sina(
33
+ stock=self.stock, symbol="资产负债表"
34
+ )
35
+ if raw_df is None or raw_df.empty:
36
+ raise ValueError(f"Invalid stock symbol: {self.symbol}")
37
+ return self._clean_balance_data(raw_df)
38
+ except Exception as e:
39
+ raise ValueError(
40
+ f"Failed to get balance sheet for symbol {self.symbol}: {str(e)}"
41
+ ) from e
33
42
 
34
43
  @cache("financial_cache", key=lambda self: f"sina_income_{self.symbol}")
35
44
  def get_income_statement(self) -> pd.DataFrame:
@@ -41,8 +50,15 @@ class SinaFinancialReport(FinancialDataProvider):
41
50
  Returns:
42
51
  Standardized DataFrame with income statement data
43
52
  """
44
- raw_df = ak.stock_financial_report_sina(stock=self.stock, symbol="利润表")
45
- return self._clean_income_data(raw_df)
53
+ try:
54
+ raw_df = ak.stock_financial_report_sina(stock=self.stock, symbol="利润表")
55
+ if raw_df is None or raw_df.empty:
56
+ raise ValueError(f"Invalid stock symbol: {self.symbol}")
57
+ return self._clean_income_data(raw_df)
58
+ except Exception as e:
59
+ raise ValueError(
60
+ f"Failed to get income statement for symbol {self.symbol}: {str(e)}"
61
+ ) from e
46
62
 
47
63
  @cache("financial_cache", key=lambda self: f"sina_cash_{self.symbol}")
48
64
  def get_cash_flow(self) -> pd.DataFrame:
@@ -54,8 +70,17 @@ class SinaFinancialReport(FinancialDataProvider):
54
70
  Returns:
55
71
  Standardized DataFrame with cash flow data
56
72
  """
57
- raw_df = ak.stock_financial_report_sina(stock=self.stock, symbol="现金流量表")
58
- return self._clean_cash_data(raw_df)
73
+ try:
74
+ raw_df = ak.stock_financial_report_sina(
75
+ stock=self.stock, symbol="现金流量表"
76
+ )
77
+ if raw_df is None or raw_df.empty:
78
+ raise ValueError(f"Invalid stock symbol: {self.symbol}")
79
+ return self._clean_cash_data(raw_df)
80
+ except Exception as e:
81
+ raise ValueError(
82
+ f"Failed to get cash flow statement for symbol {self.symbol}: {str(e)}"
83
+ ) from e
59
84
 
60
85
  def _clean_cash_data(self, raw_df: pd.DataFrame) -> pd.DataFrame:
61
86
  """清理和标准化现金流量表数据
@@ -38,7 +38,9 @@ class RealtimeDataFactory:
38
38
 
39
39
  # Extract symbol from kwargs if present
40
40
  symbol = kwargs.get("symbol", "")
41
- if not isinstance(symbol, str):
41
+ if symbol is None:
42
+ symbol = ""
43
+ elif not isinstance(symbol, str):
42
44
  raise ValueError("symbol must be a string")
43
45
 
44
46
  return provider_class(symbol=symbol)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-one
3
- Version: 0.3.11
3
+ Version: 0.3.12
4
4
  Summary: Standardized interface for Chinese financial market data, built on AKShare with unified data formats and simplified APIs
5
5
  Keywords: akshare,financial-data,stock-data,quant
6
6
  License-Expression: MIT
@@ -6,7 +6,7 @@ akshare_one/modules/cache.py,sha256=8otk8cSOV4dxztmWmvCKGOoEPmPCYiw6cqt0T3iN_7k,
6
6
  akshare_one/modules/financial/base.py,sha256=Lmq98sEs-4nz2Bqu8Rlhtt4Z0btqi7r7JUEu-GOTFoo,662
7
7
  akshare_one/modules/financial/eastmoney_direct.py,sha256=3o-MIRifD_yKjwZhC1THgfzCTKvoXieQMs0YsVYDKR8,6642
8
8
  akshare_one/modules/financial/factory.py,sha256=uqDGwWjY78OBCgcKgevqB_mEWKCyTGAS0RMHZ2J6OnU,1462
9
- akshare_one/modules/financial/sina.py,sha256=FiJBAmCcsh63KbeLQ0l4_tE3rAcVpxCCCKZLvH9liK0,12557
9
+ akshare_one/modules/financial/sina.py,sha256=Nm9J-Kkc8KleVVWxowhbuunQfG0SUaBY6Mdow9X8-yQ,13541
10
10
  akshare_one/modules/historical/base.py,sha256=IrbKFco61xAgSBZU2xiU_AKxBohyM1wRo9CcRdp_Elg,1271
11
11
  akshare_one/modules/historical/eastmoney.py,sha256=kd2BIoSU9Ak7oTee38kKbtAyjgA5Y91KWpXmc-TDaXY,8064
12
12
  akshare_one/modules/historical/eastmoney_direct.py,sha256=VGx793X5sE8E7rzZsL3e_Wlnj5A12tj27feca1dAU5c,2881
@@ -29,10 +29,10 @@ akshare_one/modules/news/factory.py,sha256=srq8QBh2cuTdUILamCDx-V_Y98LnlUQySRtw6
29
29
  akshare_one/modules/realtime/base.py,sha256=ayMDLUOh89Lz9CgwWiqEgP67Fqj83BHxWJsvfYrJof0,703
30
30
  akshare_one/modules/realtime/eastmoney.py,sha256=rVXVg3CVO9ZWd94HzIjnykMeKMSVUtBSew1cWjpm948,1542
31
31
  akshare_one/modules/realtime/eastmoney_direct.py,sha256=AFqEmf3uD-jrKXX__Aw0Cs0gWflhim6xEjxp4SX5gnc,1239
32
- akshare_one/modules/realtime/factory.py,sha256=WaFrdptd7FIaFuiO754mlI0CaWgGGWfGc-iuK2TsRV4,1745
32
+ akshare_one/modules/realtime/factory.py,sha256=dezd9vxeKWizlikcl04iR2KqWOh9Jc8jHQoALMvkWZk,1798
33
33
  akshare_one/modules/realtime/xueqiu.py,sha256=6NxCfVNY0TMXKV06z0DQoml_58pniRtP8HSMtas9aYs,2148
34
34
  akshare_one/modules/utils.py,sha256=H4nrGf8m4_ezTiW5-OcNPxpV-neTYfffEfaOLDFLY9Y,323
35
35
  akshare_one/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- akshare_one-0.3.11.dist-info/WHEEL,sha256=Jb20R3Ili4n9P1fcwuLup21eQ5r9WXhs4_qy7VTrgPI,79
37
- akshare_one-0.3.11.dist-info/METADATA,sha256=s7vZ2qyE3pa70E35Z5y3GW_CjjfUKBtNIEyZ1PbmODQ,2156
38
- akshare_one-0.3.11.dist-info/RECORD,,
36
+ akshare_one-0.3.12.dist-info/WHEEL,sha256=Jb20R3Ili4n9P1fcwuLup21eQ5r9WXhs4_qy7VTrgPI,79
37
+ akshare_one-0.3.12.dist-info/METADATA,sha256=G6SRtBk5AELtCsxJrYJ5h2ex61EqBOgreJxdsLD30mM,2156
38
+ akshare_one-0.3.12.dist-info/RECORD,,