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.
- {akshare_one-0.3.0 → akshare_one-0.3.2}/PKG-INFO +3 -3
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/eastmoney/client.py +2 -2
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/sina.py +36 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/insider/xueqiu.py +1 -1
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/PKG-INFO +3 -3
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/requires.txt +1 -1
- {akshare_one-0.3.0 → akshare_one-0.3.2}/pyproject.toml +3 -3
- {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_stock.py +33 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/LICENSE +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/README.md +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/__init__.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/financial.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/indicators.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/insider.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/cache.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/eastmoney/utils.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/financial/base.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/financial/factory.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/financial/sina.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/base.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/eastmoney.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/eastmoney_direct.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/historical/factory.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/__init__.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/base.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/factory.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/simple.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/indicators/talib.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/insider/base.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/insider/factory.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/news/base.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/news/eastmoney.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/news/factory.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/base.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/eastmoney.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/eastmoney_direct.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/factory.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/realtime/xueqiu.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/modules/utils.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/news.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one/stock.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/SOURCES.txt +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/dependency_links.txt +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/akshare_one.egg-info/top_level.txt +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/setup.cfg +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_financial.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_indicators.py +0 -0
- {akshare_one-0.3.0 → akshare_one-0.3.2}/tests/test_insider.py +0 -0
- {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.
|
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.
|
9
|
+
Requires-Python: >=3.10
|
10
10
|
Description-Content-Type: text/markdown
|
11
11
|
License-File: LICENSE
|
12
|
-
Requires-Dist: akshare>=1.17.
|
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
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: akshare-one
|
3
|
-
Version: 0.3.
|
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.
|
9
|
+
Requires-Python: >=3.10
|
10
10
|
Description-Content-Type: text/markdown
|
11
11
|
License-File: LICENSE
|
12
|
-
Requires-Dist: akshare>=1.17.
|
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,11 +1,11 @@
|
|
1
1
|
[project]
|
2
2
|
name = "akshare-one"
|
3
|
-
version = "0.3.
|
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.
|
6
|
+
requires-python = ">=3.10"
|
7
7
|
dependencies = [
|
8
|
-
"akshare>=1.17.
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|