tushare 1.4.19__py3-none-any.whl → 1.4.21__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.
tushare/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
  import codecs
3
3
  import os
4
4
 
5
- __version__ = '1.4.19'
5
+ __version__ = '1.4.21'
6
6
  __author__ = 'Jimmy Liu'
7
7
 
8
8
  """
tushare/stock/rtq.py CHANGED
@@ -182,7 +182,7 @@ def realtime_list(src: Optional[str] = None, interval: Optional[int] = 3,
182
182
  10、最高:HIGH
183
183
  11、最低:LOW
184
184
  12、今开:OPEN
185
- 13、昨收:PRE_CLOSE
185
+ 13、昨收:PRICE
186
186
  14、量比:VOL_RATIO
187
187
  15、换手率:TURNOVER_RATE
188
188
  16、市盈率-动态:PE
@@ -201,7 +201,7 @@ def realtime_list(src: Optional[str] = None, interval: Optional[int] = 3,
201
201
  5、涨跌幅:PCT_CHANGE
202
202
  6、买入:BUY
203
203
  7、卖出:SALE
204
- 8、昨收:PRE_CLOSE
204
+ 8、昨收:CLOSE
205
205
  9、今开:OPEN
206
206
  10、最高:HIGH
207
207
  11、最低:LOW
@@ -362,7 +362,7 @@ def get_stock_all_a_dc(page_count: Optional[int] = None,
362
362
  # "RANK",
363
363
  "TS_CODE",
364
364
  "NAME",
365
- "CLOSE",
365
+ "PRICE",
366
366
  "PCT_CHANGE",
367
367
  "CHANGE",
368
368
  "VOLUME",
@@ -371,7 +371,7 @@ def get_stock_all_a_dc(page_count: Optional[int] = None,
371
371
  "HIGH",
372
372
  "LOW",
373
373
  "OPEN",
374
- "PRE_CLOSE",
374
+ "CLOSE",
375
375
  "VOL_RATIO",
376
376
  "TURNOVER_RATE",
377
377
  "PE",
@@ -384,8 +384,8 @@ def get_stock_all_a_dc(page_count: Optional[int] = None,
384
384
  "1YEAR",
385
385
  ]
386
386
  # 指定要转换为 float 类型的列
387
- cols_to_convert = ['CLOSE', 'PCT_CHANGE', 'CHANGE', "VOLUME", "AMOUNT", "SWING",
388
- 'HIGH', "LOW", "OPEN", "PRE_CLOSE", "VOL_RATIO", "TURNOVER_RATE", "PE", "PB", "TOTAL_MV", "FLOAT_MV",
387
+ cols_to_convert = ['PRICE', 'PCT_CHANGE', 'CHANGE', "VOLUME", "AMOUNT", "SWING",
388
+ 'HIGH', "LOW", "OPEN", "CLOSE", "VOL_RATIO", "TURNOVER_RATE", "PE", "PB", "TOTAL_MV", "FLOAT_MV",
389
389
  "RISE", "5MIN", "60DAY", "1YEAR"
390
390
  ]
391
391
  # 使用 to_numeric() 方法将指定的列转换为 float 类型,并将非数值类型的数据转换为 NaN
@@ -429,12 +429,12 @@ def get_stock_all_a_sina(interval: Optional[int] = 3, page_count: Optional[int]
429
429
  :rtype: pandas.DataFrame
430
430
  1、代码:TS_CODE
431
431
  2、名称:NAME
432
- 3、最新价:CLOSE
432
+ 3、最新价:PRICE
433
433
  4、涨跌额:CHANGE
434
434
  5、涨跌幅:PCT_CHANGE
435
435
  6、买入:BUY
436
436
  7、卖出:SALE
437
- 8、昨收:PRE_CLOSE
437
+ 8、昨收:CLOSE
438
438
  9、今开:OPEN
439
439
  10、最高:HIGH
440
440
  11、最低:LOW
@@ -528,12 +528,12 @@ def get_stock_all_a_sina(interval: Optional[int] = 3, page_count: Optional[int]
528
528
  big_df.columns = [
529
529
  "TS_CODE",
530
530
  "NAME",
531
- "CLOSE",
531
+ "PRICE",
532
532
  "CHANGE",
533
533
  "PCT_CHANGE",
534
534
  "BUY",
535
535
  "SALE",
536
- "PRE_CLOSE",
536
+ "CLOSE",
537
537
  "OPEN",
538
538
  "HIGH",
539
539
  "LOW",
@@ -646,7 +646,7 @@ def format_str_to_float(x):
646
646
  if __name__ == '__main__':
647
647
  # df = realtime_quote(ts_code="000688.SH,000010.SH,000012.SH,399005.SZ", src="sina")
648
648
  # df = realtime_list(src="dc", page_count=1)
649
- df = realtime_list(src="dc")
649
+ df = realtime_list(src="sina")
650
650
  print(df)
651
651
  # ts_code = '399005.SZ'
652
652
  # ts_code = '000001.SZ'
@@ -17,6 +17,8 @@ def format_stock_code(x, special=""):
17
17
  @return:
18
18
  """
19
19
  x = str(x)
20
+ x = "".join(filter(str.isdigit, x))
21
+
20
22
  stock_len = 6
21
23
  hk_stock_len = 5
22
24
  if special:
@@ -44,15 +46,12 @@ def format_stock_code(x, special=""):
44
46
  return '%s.SZ' % x
45
47
  if not x[0].isdigit():
46
48
  return x.upper()
47
- if str(x[0:3]) in ['920']:
49
+ if str(x[0:3]) in ['920'] or str(x[0]) in ['8', '4']:
48
50
  x = x.zfill(stock_len) if len(x) < stock_len else x
49
51
  return '%s.BJ' % x
50
- if str(x[0]) in ['5', '6', '9']:
52
+ if str(x[0]) in ['5', '6'] or str(x[0:3]) in ['900']:
51
53
  x = x.zfill(stock_len) if len(x) < stock_len else x
52
54
  return '%s.SH' % x
53
- elif str(x[0]) in ['8', '4']:
54
- x = x.zfill(stock_len) if len(x) < stock_len else x
55
- return '%s.BJ' % x
56
55
  else:
57
56
  x = x.zfill(stock_len) if len(x) < stock_len else x
58
57
  return '%s.SZ' % x
@@ -119,5 +118,5 @@ if __name__ == '__main__':
119
118
  # s = symbol_verify("000001.SZ")
120
119
  # s = symbols_f("000001", special="港股")
121
120
  # s = verify_stock_or_index(x="399005.SZ")
122
- s = format_stock_code(x="92052")
121
+ s = format_stock_code(x="sz92052")
123
122
  print(s)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tushare
3
- Version: 1.4.19
3
+ Version: 1.4.21
4
4
  Summary: A utility for crawling historical and Real-time Quotes data of China stocks
5
5
  Home-page: https://tushare.pro
6
6
  Author: Jimmy Liu
@@ -80,6 +80,15 @@ return::
80
80
 
81
81
  Log
82
82
  --------------
83
+ 1.4.21
84
+ -------
85
+ - 修复 realtime_list ts_code 格式化
86
+ --------------
87
+ --------------
88
+ 1.4.20
89
+ -------
90
+ - 修复 realtime_list 数值对应问题 close->price pre_close->close
91
+ --------------
83
92
  1.4.19
84
93
  -------
85
94
  - 修复 realtime_list 返回数据不全的问题
@@ -1,4 +1,4 @@
1
- tushare/__init__.py,sha256=1SENOQgZRlssTEGodSX6PtPoZJR3i6UOPwCegihtvRA,4778
1
+ tushare/__init__.py,sha256=GBACL2TAwkfzq9fVqhrz0iL8RSK6UrzSG9MUusofUOY,4778
2
2
  tushare/bond/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  tushare/bond/bonds.py,sha256=PJM0xDiWZDpOPwDtbEU9PdP0M_Gu0c599YuB1rbZ3r8,232
4
4
  tushare/coins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -35,7 +35,7 @@ tushare/stock/news_vars.py,sha256=CQ18hvyoeScelBCqKgF_rgAufoEALAUT8y_LERvZKHk,45
35
35
  tushare/stock/newsevent.py,sha256=STR7C8MjtZlaXTCG0QNaojBuK4-oxP_8hT7ZIvRpbiI,6944
36
36
  tushare/stock/ref_vars.py,sha256=MIxor-2rISl65I32vUzC-z7ZC_QFzG4sxOKDyjLWuU4,4449
37
37
  tushare/stock/reference.py,sha256=x_HZlrP58T-5OTZ7SLdf2Dh9THj1h7cT4wcIp42IHFI,38227
38
- tushare/stock/rtq.py,sha256=EPzVDbF0R6ojVrR17neEieR8-q5-ywcargLH0bFip1U,23949
38
+ tushare/stock/rtq.py,sha256=xCCFfxG_iNKdCoETeekmTy3EvvFy5eFggimyDpQAocM,23927
39
39
  tushare/stock/rtq_vars.py,sha256=V6LeJkSP76z8veRfP_mGiQ63V5YBHoTMaqUA5hSBWh4,4200
40
40
  tushare/stock/shibor.py,sha256=Fx9OUZ429kz6l7ZdaYSD6p_X79ud69PDM9EZogm8xCY,6422
41
41
  tushare/stock/trading.py,sha256=3bvM4pexEYW-uGGEL7g6Vkte4sqGC1iYO6dC8mGLSdM,55619
@@ -61,7 +61,7 @@ tushare/util/common.py,sha256=KG86VdlhfnOf0j6SE2bBeowC_7Z54RqWpVnudS6KvEU,2581
61
61
  tushare/util/conns.py,sha256=mkcxGGD7-13GXMlrwmo4LMecmgWdm63I8KDpvcW53cI,1456
62
62
  tushare/util/dateu.py,sha256=YSvPvOlMY0qvT2IDwFNOHxTLBrPQ9ULGO7ljfu9tK3s,2931
63
63
  tushare/util/form_date.py,sha256=4nnjp6xo40FftsRP9YY1FJoPErxaWVCkjIp_3O1Qy7M,1119
64
- tushare/util/format_stock_code.py,sha256=5uQngRIqN6pzEHtI-AX_oBdHxRdOVpAvA_S41mCUY5I,3639
64
+ tushare/util/format_stock_code.py,sha256=Te_1ZA2_0ivAV2kSKlalawlieJ6KQB77bA057baNcl0,3608
65
65
  tushare/util/formula.py,sha256=XZVK1NTF8BTrCo78EHLzjAM_wLAjxybrN7Q-6HCHmCo,6863
66
66
  tushare/util/mailmerge.py,sha256=y_QkfHvH8nQ7peC8wQs5idB6xW9PYzzrBynzxgo924M,8980
67
67
  tushare/util/netbase.py,sha256=URvOTLJSgO7e6uCmHHD9EeQ2TRvjpxIEF-wQaWx5cKE,942
@@ -72,8 +72,8 @@ tushare/util/verify_token.py,sha256=cuV3RErWbOC318NANCYL6K1LKZ3wSAL2yMwZHA7tD3s,
72
72
  tushare/util/protobuf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  tushare/util/protobuf/funcs.py,sha256=UCdK8FxTyjPZsNzoEeXqYzqrQXUmRMvW5hua6GPA66A,779
74
74
  tushare/util/protobuf/response_pb2.py,sha256=vJH9ONkDuJlg6y-q1PvuDZoviKrK7hzNtMieQHK45DI,11347
75
- tushare-1.4.19.dist-info/LICENSE,sha256=C2j55UI0Ul-1-wA1-rn7OaY6b3vGl4YukiyvYzHsU9o,1503
76
- tushare-1.4.19.dist-info/METADATA,sha256=po7Jtf-7liUnFFassvlJQCrQalR5s-cLnKAjxwxWHpc,3108
77
- tushare-1.4.19.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
78
- tushare-1.4.19.dist-info/top_level.txt,sha256=HHOxMuqc31KuAIcxpE0t5dAPMKbaiRtjsjTMFd7FlXI,8
79
- tushare-1.4.19.dist-info/RECORD,,
75
+ tushare-1.4.21.dist-info/LICENSE,sha256=C2j55UI0Ul-1-wA1-rn7OaY6b3vGl4YukiyvYzHsU9o,1503
76
+ tushare-1.4.21.dist-info/METADATA,sha256=Rw2lmLRj7yJylVm6n2qq8pY4trC1eUnKUnl87vjxfv4,3307
77
+ tushare-1.4.21.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
78
+ tushare-1.4.21.dist-info/top_level.txt,sha256=HHOxMuqc31KuAIcxpE0t5dAPMKbaiRtjsjTMFd7FlXI,8
79
+ tushare-1.4.21.dist-info/RECORD,,