akshare-one 0.3.0__tar.gz → 0.3.2__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 (49) hide show
  1. {akshare_one-0.3.0 → akshare_one-0.3.2}/PKG-INFO +3 -3
  2. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/eastmoney/client.py +2 -2
  3. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/sina.py +36 -0
  4. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/insider/xueqiu.py +1 -1
  5. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/PKG-INFO +3 -3
  6. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/requires.txt +1 -1
  7. {akshare_one-0.3.0 → akshare_one-0.3.2}/pyproject.toml +3 -3
  8. {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_stock.py +33 -0
  9. {akshare_one-0.3.0 → akshare_one-0.3.2}/LICENSE +0 -0
  10. {akshare_one-0.3.0 → akshare_one-0.3.2}/README.md +0 -0
  11. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/__init__.py +0 -0
  12. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/financial.py +0 -0
  13. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/indicators.py +0 -0
  14. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/insider.py +0 -0
  15. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/cache.py +0 -0
  16. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/eastmoney/utils.py +0 -0
  17. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/financial/base.py +0 -0
  18. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/financial/factory.py +0 -0
  19. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/financial/sina.py +0 -0
  20. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/base.py +0 -0
  21. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/eastmoney.py +0 -0
  22. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/eastmoney_direct.py +0 -0
  23. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/factory.py +0 -0
  24. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/__init__.py +0 -0
  25. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/base.py +0 -0
  26. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/factory.py +0 -0
  27. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/simple.py +0 -0
  28. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/talib.py +0 -0
  29. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/insider/base.py +0 -0
  30. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/insider/factory.py +0 -0
  31. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/news/base.py +0 -0
  32. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/news/eastmoney.py +0 -0
  33. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/news/factory.py +0 -0
  34. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/base.py +0 -0
  35. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/eastmoney.py +0 -0
  36. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/eastmoney_direct.py +0 -0
  37. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/factory.py +0 -0
  38. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/xueqiu.py +0 -0
  39. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/utils.py +0 -0
  40. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/news.py +0 -0
  41. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/stock.py +0 -0
  42. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/SOURCES.txt +0 -0
  43. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/dependency_links.txt +0 -0
  44. {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/top_level.txt +0 -0
  45. {akshare_one-0.3.0 → akshare_one-0.3.2}/setup.cfg +0 -0
  46. {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_financial.py +0 -0
  47. {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_indicators.py +0 -0
  48. {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_insider.py +0 -0
  49. {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_news.py +0 -0
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-one
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Standardized interface for Chinese financial market data, built on AKShare with unified data formats and simplified APIs
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/zwldarren/akshare-one
7
7
  Project-URL: Repository, https://github.com/zwldarren/akshare-one.git
8
8
  Keywords: akshare,financial-data,stock-data,quant
9
- Requires-Python: >=3.12
9
+ Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
- Requires-Dist: akshare>=1.17.8
12
+ Requires-Dist: akshare>=1.17.15
13
13
  Requires-Dist: cachetools>=6.1.0
14
14
  Provides-Extra: talib
15
15
  Requires-Dist: ta-lib>=0.6.4; extra == "talib"
@@ -35,9 +35,9 @@ class EastMoneyClient:
35
35
  market = "116"
36
36
  code = symbol[2:]
37
37
  elif len(symbol) == 6:
38
- if symbol.startswith(("000", "001", "002", "003", "300")):
38
+ if symbol.startswith(("000", "001", "002", "003", "300", "200")):
39
39
  market = "0"
40
- elif symbol.startswith(("600", "601", "603", "605", "688")):
40
+ elif symbol.startswith(("600", "601", "603", "605", "688", "900")):
41
41
  market = "1"
42
42
  else:
43
43
  market = "0" # Default to SZ for ambiguity
@@ -98,8 +98,44 @@ class SinaHistorical(HistoricalDataProvider):
98
98
  )
99
99
  return self._clean_minute_data(raw_df)
100
100
 
101
+ def _get_b_share_data(self, stock: str) -> pd.DataFrame:
102
+ """Fetches B-share historical data"""
103
+ start_date = self._convert_date_format(self.start_date)
104
+ end_date = self._convert_date_format(self.end_date)
105
+
106
+ if self.interval in ["minute", "hour"]:
107
+ period = "1" if self.interval == "minute" else "60"
108
+ raw_df = ak.stock_zh_b_minute(
109
+ symbol=stock,
110
+ period=period,
111
+ adjust=self._map_adjust_param(self.adjust),
112
+ )
113
+ # Rename 'day' to 'date' for consistency
114
+ raw_df = raw_df.rename(columns={"day": "date"})
115
+
116
+ if self.interval_multiplier > 1:
117
+ freq = f"{self.interval_multiplier}{'min' if self.interval == 'minute' else 'h'}"
118
+ raw_df = self._resample_intraday_data(raw_df, freq)
119
+ else:
120
+ raw_df = ak.stock_zh_b_daily(
121
+ symbol=stock,
122
+ start_date=start_date,
123
+ end_date=end_date,
124
+ adjust=self._map_adjust_param(self.adjust),
125
+ )
126
+ if self.interval_multiplier > 1:
127
+ raw_df = self._resample_data(
128
+ raw_df, self.interval, self.interval_multiplier
129
+ )
130
+
131
+ return self._clean_data(raw_df)
132
+
101
133
  def _get_daily_plus_data(self, stock: str) -> pd.DataFrame:
102
134
  """Fetches daily and higher-level data (day/week/month/year)"""
135
+ # Check if it's a B-share symbol
136
+ if stock.startswith(("sh9", "sz2")):
137
+ return self._get_b_share_data(stock)
138
+
103
139
  start_date = self._convert_date_format(self.start_date)
104
140
  end_date = self._convert_date_format(self.end_date)
105
141
 
@@ -112,4 +112,4 @@ class XueQiuInsider(InsiderDataProvider):
112
112
  if col in df.columns:
113
113
  df[col] = pd.to_numeric(df[col], errors="coerce")
114
114
 
115
- return df
115
+ return df.reset_index(drop=True)
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akshare-one
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Standardized interface for Chinese financial market data, built on AKShare with unified data formats and simplified APIs
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/zwldarren/akshare-one
7
7
  Project-URL: Repository, https://github.com/zwldarren/akshare-one.git
8
8
  Keywords: akshare,financial-data,stock-data,quant
9
- Requires-Python: >=3.12
9
+ Requires-Python: >=3.10
10
10
  Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
- Requires-Dist: akshare>=1.17.8
12
+ Requires-Dist: akshare>=1.17.15
13
13
  Requires-Dist: cachetools>=6.1.0
14
14
  Provides-Extra: talib
15
15
  Requires-Dist: ta-lib>=0.6.4; extra == "talib"
@@ -1,4 +1,4 @@
1
- akshare>=1.17.8
1
+ akshare>=1.17.15
2
2
  cachetools>=6.1.0
3
3
 
4
4
  [talib]
@@ -1,11 +1,11 @@
1
1
  [project]
2
2
  name = "akshare-one"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "Standardized interface for Chinese financial market data, built on AKShare with unified data formats and simplified APIs"
5
5
  readme = "README.md"
6
- requires-python = ">=3.12"
6
+ requires-python = ">=3.10"
7
7
  dependencies = [
8
- "akshare>=1.17.8",
8
+ "akshare>=1.17.15",
9
9
  "cachetools>=6.1.0",
10
10
  ]
11
11
  license = "MIT"
@@ -157,6 +157,39 @@ class TestRealtimeData:
157
157
  with pytest.raises(Exception):
158
158
  get_realtime_data(symbol="600000", source="invalid")
159
159
 
160
+ def test_b_share_daily_data(self):
161
+ """测试B股日线数据"""
162
+ df = get_hist_data(
163
+ symbol="sh900901",
164
+ interval="day",
165
+ start_date="2024-01-01",
166
+ end_date="2024-01-31",
167
+ source="sina",
168
+ )
169
+ assert not df.empty
170
+ assert set(df.columns) == {
171
+ "timestamp",
172
+ "open",
173
+ "high",
174
+ "low",
175
+ "close",
176
+ "volume",
177
+ }
178
+ assert len(df) > 0
179
+
180
+ def test_b_share_minute_data(self):
181
+ """测试B股分钟数据"""
182
+ df = get_hist_data(
183
+ symbol="sh900901",
184
+ interval="minute",
185
+ interval_multiplier=5,
186
+ start_date="2024-01-01",
187
+ end_date="2024-01-31",
188
+ source="sina",
189
+ )
190
+ assert not df.empty
191
+ assert len(df) > 0
192
+
160
193
  def test_api_error_handling(self):
161
194
  """测试API错误处理"""
162
195
  with patch(
File without changes
File without changes
File without changes