rquote 0.4.8__tar.gz → 0.4.9__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. {rquote-0.4.8 → rquote-0.4.9}/PKG-INFO +2 -2
  2. {rquote-0.4.8 → rquote-0.4.9}/README.md +1 -1
  3. {rquote-0.4.8 → rquote-0.4.9}/pyproject.toml +1 -1
  4. {rquote-0.4.8 → rquote-0.4.9}/rquote/api/lists.py +36 -2
  5. {rquote-0.4.8 → rquote-0.4.9}/rquote.egg-info/PKG-INFO +2 -2
  6. {rquote-0.4.8 → rquote-0.4.9}/rquote/__init__.py +0 -0
  7. {rquote-0.4.8 → rquote-0.4.9}/rquote/api/__init__.py +0 -0
  8. {rquote-0.4.8 → rquote-0.4.9}/rquote/api/price.py +0 -0
  9. {rquote-0.4.8 → rquote-0.4.9}/rquote/api/stock_info.py +0 -0
  10. {rquote-0.4.8 → rquote-0.4.9}/rquote/api/tick.py +0 -0
  11. {rquote-0.4.8 → rquote-0.4.9}/rquote/cache/__init__.py +0 -0
  12. {rquote-0.4.8 → rquote-0.4.9}/rquote/cache/base.py +0 -0
  13. {rquote-0.4.8 → rquote-0.4.9}/rquote/cache/memory.py +0 -0
  14. {rquote-0.4.8 → rquote-0.4.9}/rquote/cache/persistent.py +0 -0
  15. {rquote-0.4.8 → rquote-0.4.9}/rquote/config.py +0 -0
  16. {rquote-0.4.8 → rquote-0.4.9}/rquote/data_sources/__init__.py +0 -0
  17. {rquote-0.4.8 → rquote-0.4.9}/rquote/data_sources/base.py +0 -0
  18. {rquote-0.4.8 → rquote-0.4.9}/rquote/data_sources/sina.py +0 -0
  19. {rquote-0.4.8 → rquote-0.4.9}/rquote/data_sources/tencent.py +0 -0
  20. {rquote-0.4.8 → rquote-0.4.9}/rquote/exceptions.py +0 -0
  21. {rquote-0.4.8 → rquote-0.4.9}/rquote/factors/__init__.py +0 -0
  22. {rquote-0.4.8 → rquote-0.4.9}/rquote/factors/technical.py +0 -0
  23. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/__init__.py +0 -0
  24. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/base.py +0 -0
  25. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/cn_stock.py +0 -0
  26. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/factory.py +0 -0
  27. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/future.py +0 -0
  28. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/hk_stock.py +0 -0
  29. {rquote-0.4.8 → rquote-0.4.9}/rquote/markets/us_stock.py +0 -0
  30. {rquote-0.4.8 → rquote-0.4.9}/rquote/parsers/__init__.py +0 -0
  31. {rquote-0.4.8 → rquote-0.4.9}/rquote/parsers/kline.py +0 -0
  32. {rquote-0.4.8 → rquote-0.4.9}/rquote/plots.py +0 -0
  33. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils/__init__.py +0 -0
  34. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils/date.py +0 -0
  35. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils/helpers.py +0 -0
  36. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils/http.py +0 -0
  37. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils/logging.py +0 -0
  38. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils/web.py +0 -0
  39. {rquote-0.4.8 → rquote-0.4.9}/rquote/utils.py +0 -0
  40. {rquote-0.4.8 → rquote-0.4.9}/rquote.egg-info/SOURCES.txt +0 -0
  41. {rquote-0.4.8 → rquote-0.4.9}/rquote.egg-info/dependency_links.txt +0 -0
  42. {rquote-0.4.8 → rquote-0.4.9}/rquote.egg-info/requires.txt +0 -0
  43. {rquote-0.4.8 → rquote-0.4.9}/rquote.egg-info/top_level.txt +0 -0
  44. {rquote-0.4.8 → rquote-0.4.9}/setup.cfg +0 -0
  45. {rquote-0.4.8 → rquote-0.4.9}/tests/test_api.py +0 -0
  46. {rquote-0.4.8 → rquote-0.4.9}/tests/test_cache.py +0 -0
  47. {rquote-0.4.8 → rquote-0.4.9}/tests/test_config.py +0 -0
  48. {rquote-0.4.8 → rquote-0.4.9}/tests/test_exceptions.py +0 -0
  49. {rquote-0.4.8 → rquote-0.4.9}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rquote
3
- Version: 0.4.8
3
+ Version: 0.4.9
4
4
  Summary: Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch
5
5
  Requires-Python: >=3.9.0
6
6
  Description-Content-Type: text/markdown
@@ -18,7 +18,7 @@ Requires-Dist: duckdb>=0.9.0; extra == "persistent"
18
18
 
19
19
  ## 版本信息
20
20
 
21
- 当前版本:**0.4.8**
21
+ 当前版本:**0.4.9**
22
22
 
23
23
  ## 主要特性
24
24
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 版本信息
6
6
 
7
- 当前版本:**0.4.8**
7
+ 当前版本:**0.4.9**
8
8
 
9
9
  ## 主要特性
10
10
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rquote"
7
- version = "0.4.8"
7
+ version = "0.4.9"
8
8
  description = "Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch"
9
9
  readme = "README.md"
10
10
  # requires-python = ">=3.6.1" # duckdb requires higher python version
@@ -191,8 +191,11 @@ def get_cnindex_stocks(index_type='hs300'):
191
191
  # 指数类型到 TYPE 值的映射
192
192
  index_type_map = {
193
193
  'hs300': '1',
194
+ 'sz50': '2',
194
195
  'zz500': '3',
195
- 'zz1000': '7'
196
+ 'kc500': '4',
197
+ 'zz1000': '7',
198
+ 'zz2000': '13'
196
199
  }
197
200
 
198
201
  if index_type not in index_type_map:
@@ -202,6 +205,10 @@ def get_cnindex_stocks(index_type='hs300'):
202
205
 
203
206
  # 构建 URL
204
207
  base_url = 'https://datacenter-web.eastmoney.com/api/data/v1/get'
208
+ page_size = 500
209
+ all_data = []
210
+
211
+ # 先获取第一页,确定总数
205
212
  params = {
206
213
  'callback': 'jQuery112308471143523381743_1763517709888',
207
214
  'sortColumns': 'SECURITY_CODE',
@@ -232,7 +239,34 @@ def get_cnindex_stocks(index_type='hs300'):
232
239
 
233
240
  # 返回 result.data 中的数据列表
234
241
  if data.get('result') and data['result'].get('data'):
235
- return data['result']['data']
242
+ all_data.extend(data['result']['data'])
243
+ total = int(index_type[2:])
244
+
245
+ # 如果总数超过 page_size,需要分页获取
246
+ if total > page_size:
247
+ total_pages = (total + page_size - 1) // page_size # 向上取整
248
+
249
+ # 从第二页开始获取
250
+ for page_num in range(2, total_pages + 1):
251
+ params['pageNumber'] = str(page_num)
252
+ url = f'{base_url}?{urlencode(params)}'
253
+
254
+ a = hget(url)
255
+ if not a:
256
+ logger.warning(f'Failed to fetch page {page_num} for {index_type}')
257
+ continue
258
+
259
+ json_str = a.text.split('(', 1)[1].rstrip(');')
260
+ page_data = json.loads(json_str)
261
+
262
+ if page_data.get('result') and page_data['result'].get('data'):
263
+ all_data.extend(page_data['result']['data'])
264
+
265
+ # 避免请求过快
266
+ time.sleep(0.1)
267
+
268
+ logger.debug(f'Fetched {len(all_data)} stocks for {index_type} (total: {total})')
269
+ return all_data
236
270
  else:
237
271
  logger.warning(f'No data found in response for {index_type}')
238
272
  return []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rquote
3
- Version: 0.4.8
3
+ Version: 0.4.9
4
4
  Summary: Mostly day quotes of cn/hk/us/fund/future markets, side with quote list fetch
5
5
  Requires-Python: >=3.9.0
6
6
  Description-Content-Type: text/markdown
@@ -18,7 +18,7 @@ Requires-Dist: duckdb>=0.9.0; extra == "persistent"
18
18
 
19
19
  ## 版本信息
20
20
 
21
- 当前版本:**0.4.8**
21
+ 当前版本:**0.4.9**
22
22
 
23
23
  ## 主要特性
24
24
 
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