tushare 1.4.16__tar.gz → 1.4.18__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 (84) hide show
  1. {tushare-1.4.16 → tushare-1.4.18}/PKG-INFO +5 -1
  2. {tushare-1.4.16 → tushare-1.4.18}/setup.py +5 -1
  3. {tushare-1.4.16 → tushare-1.4.18}/tushare/__init__.py +1 -1
  4. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/rtq.py +5 -5
  5. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/format_stock_code.py +19 -19
  6. {tushare-1.4.16 → tushare-1.4.18}/tushare.egg-info/PKG-INFO +5 -1
  7. {tushare-1.4.16 → tushare-1.4.18}/LICENSE +0 -0
  8. {tushare-1.4.16 → tushare-1.4.18}/README.md +0 -0
  9. {tushare-1.4.16 → tushare-1.4.18}/setup.cfg +0 -0
  10. {tushare-1.4.16 → tushare-1.4.18}/tushare/bond/__init__.py +0 -0
  11. {tushare-1.4.16 → tushare-1.4.18}/tushare/bond/bonds.py +0 -0
  12. {tushare-1.4.16 → tushare-1.4.18}/tushare/coins/__init__.py +0 -0
  13. {tushare-1.4.16 → tushare-1.4.18}/tushare/coins/market.py +0 -0
  14. {tushare-1.4.16 → tushare-1.4.18}/tushare/data/__init__.py +0 -0
  15. {tushare-1.4.16 → tushare-1.4.18}/tushare/fund/__init__.py +0 -0
  16. {tushare-1.4.16 → tushare-1.4.18}/tushare/fund/cons.py +0 -0
  17. {tushare-1.4.16 → tushare-1.4.18}/tushare/fund/nav.py +0 -0
  18. {tushare-1.4.16 → tushare-1.4.18}/tushare/futures/__init__.py +0 -0
  19. {tushare-1.4.16 → tushare-1.4.18}/tushare/futures/cons.py +0 -0
  20. {tushare-1.4.16 → tushare-1.4.18}/tushare/futures/domestic.py +0 -0
  21. {tushare-1.4.16 → tushare-1.4.18}/tushare/futures/domestic_cons.py +0 -0
  22. {tushare-1.4.16 → tushare-1.4.18}/tushare/futures/intlfutures.py +0 -0
  23. {tushare-1.4.16 → tushare-1.4.18}/tushare/internet/__init__.py +0 -0
  24. {tushare-1.4.16 → tushare-1.4.18}/tushare/internet/boxoffice.py +0 -0
  25. {tushare-1.4.16 → tushare-1.4.18}/tushare/internet/caixinnews.py +0 -0
  26. {tushare-1.4.16 → tushare-1.4.18}/tushare/internet/indexes.py +0 -0
  27. {tushare-1.4.16 → tushare-1.4.18}/tushare/pro/__init__.py +0 -0
  28. {tushare-1.4.16 → tushare-1.4.18}/tushare/pro/client.py +0 -0
  29. {tushare-1.4.16 → tushare-1.4.18}/tushare/pro/data_pro.py +0 -0
  30. {tushare-1.4.16 → tushare-1.4.18}/tushare/pro/llm.py +0 -0
  31. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/__init__.py +0 -0
  32. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/billboard.py +0 -0
  33. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/classifying.py +0 -0
  34. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/cons.py +0 -0
  35. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/fundamental.py +0 -0
  36. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/globals.py +0 -0
  37. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/histroy_divide.py +0 -0
  38. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/indictor.py +0 -0
  39. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/macro.py +0 -0
  40. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/macro_vars.py +0 -0
  41. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/minsdata.py +0 -0
  42. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/news_vars.py +0 -0
  43. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/newsevent.py +0 -0
  44. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/ref_vars.py +0 -0
  45. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/reference.py +0 -0
  46. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/rtq_vars.py +0 -0
  47. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/shibor.py +0 -0
  48. {tushare-1.4.16 → tushare-1.4.18}/tushare/stock/trading.py +0 -0
  49. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/__init__.py +0 -0
  50. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/ht_subs/__init__.py +0 -0
  51. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/ht_subs/covert.py +0 -0
  52. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/ht_subs/subscribe.py +0 -0
  53. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/model/__init__.py +0 -0
  54. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/model/min.py +0 -0
  55. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/model/tick.py +0 -0
  56. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/tgw_subs/__init__.py +0 -0
  57. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/tgw_subs/convert.py +0 -0
  58. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/tgw_subs/login.py +0 -0
  59. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/tgw_subs/subscribe.py +0 -0
  60. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/ts_subs/__init__.py +0 -0
  61. {tushare-1.4.16 → tushare-1.4.18}/tushare/subs/ts_subs/subscribe.py +0 -0
  62. {tushare-1.4.16 → tushare-1.4.18}/tushare/trader/__init__.py +0 -0
  63. {tushare-1.4.16 → tushare-1.4.18}/tushare/trader/trader.py +0 -0
  64. {tushare-1.4.16 → tushare-1.4.18}/tushare/trader/utils.py +0 -0
  65. {tushare-1.4.16 → tushare-1.4.18}/tushare/trader/vars.py +0 -0
  66. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/__init__.py +0 -0
  67. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/common.py +0 -0
  68. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/conns.py +0 -0
  69. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/dateu.py +0 -0
  70. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/form_date.py +0 -0
  71. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/formula.py +0 -0
  72. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/mailmerge.py +0 -0
  73. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/netbase.py +0 -0
  74. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/protobuf/__init__.py +0 -0
  75. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/protobuf/funcs.py +0 -0
  76. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/protobuf/response_pb2.py +0 -0
  77. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/store.py +0 -0
  78. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/upass.py +0 -0
  79. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/vars.py +0 -0
  80. {tushare-1.4.16 → tushare-1.4.18}/tushare/util/verify_token.py +0 -0
  81. {tushare-1.4.16 → tushare-1.4.18}/tushare.egg-info/SOURCES.txt +0 -0
  82. {tushare-1.4.16 → tushare-1.4.18}/tushare.egg-info/dependency_links.txt +0 -0
  83. {tushare-1.4.16 → tushare-1.4.18}/tushare.egg-info/requires.txt +0 -0
  84. {tushare-1.4.16 → tushare-1.4.18}/tushare.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tushare
3
- Version: 1.4.16
3
+ Version: 1.4.18
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,10 @@ return::
80
80
 
81
81
  Log
82
82
  --------------
83
+ 1.4.17
84
+ -------
85
+ - 修复 920 开头更改是北交所
86
+ -------
83
87
  1.4.14
84
88
  -------
85
89
  - 修复 realtime_list (爬虫版)
@@ -64,6 +64,10 @@ return::
64
64
 
65
65
  Log
66
66
  --------------
67
+ 1.4.17
68
+ -------
69
+ - 修复 920 开头更改是北交所
70
+ -------
67
71
  1.4.14
68
72
  -------
69
73
  - 修复 realtime_list (爬虫版)
@@ -103,7 +107,7 @@ def read_install_requires():
103
107
 
104
108
  setup(
105
109
  name='tushare',
106
- version='1.4.16',
110
+ version='1.4.18',
107
111
  description='A utility for crawling historical and Real-time Quotes data of China stocks',
108
112
  # long_description=read("README.rst"),
109
113
  long_description=long_desc,
@@ -2,7 +2,7 @@
2
2
  import codecs
3
3
  import os
4
4
 
5
- __version__ = '1.4.16'
5
+ __version__ = '1.4.18'
6
6
  __author__ = 'Jimmy Liu'
7
7
 
8
8
  """
@@ -636,16 +636,16 @@ def format_str_to_float(x):
636
636
 
637
637
  if __name__ == '__main__':
638
638
  # df = realtime_quote(ts_code="000688.SH,000010.SH,000012.SH,399005.SZ", src="sina")
639
- df = realtime_list(src="sina", page_count=1)
640
- print(df)
639
+ # df = realtime_list(src="sina", page_count=1)
640
+ # print(df)
641
641
  # ts_code = '399005.SZ'
642
642
  # ts_code = '000001.SZ'
643
643
  # # ts_code = '836149.BJ'
644
644
  # # ts_code = '600000.SH'
645
645
  # # ts_code = '000001.SH'
646
646
  # # ts_code = '000010.SH'
647
- # ts_code = '688111.SH'
648
- # df = realtime_quote(src="dc", ts_code=ts_code)
649
- # print(df)
647
+ ts_code = '600148.SH'
648
+ df = realtime_quote(src="dc", ts_code=ts_code)
649
+ print(df)
650
650
 
651
651
 
@@ -16,50 +16,47 @@ def format_stock_code(x, special=""):
16
16
  @param special:
17
17
  @return:
18
18
  """
19
+ x = str(x)
20
+ stock_len = 6
21
+ hk_stock_len = 5
19
22
  if special:
20
23
  x = str(x)
21
24
  if "行业" in special or "概念" in special:
22
- x = x.zfill(5) if len(x) < 5 else x
25
+ x = x.zfill(stock_len) if len(x) < stock_len else x
23
26
  return '%s.TI' % x
24
- elif "港股" in special:
27
+ elif special == "港股":
25
28
  r = re.search(r"(\d+)", str(x), re.S | re.M)
26
29
  if not r:
27
30
  return x
28
31
  else:
29
32
  x = r.group(1)
30
- x = x.zfill(5) if len(x) < 5 else x
33
+ x = x.zfill(hk_stock_len) if len(x) < hk_stock_len else x
31
34
  return '%s.HK' % x
32
35
  elif special == "场外基金" or special == "热基":
33
- x = x.zfill(5) if len(x) < 5 else x
36
+ x = x.zfill(stock_len) if len(x) < stock_len else x
34
37
  return '%s.OF' % x
35
38
  elif special == "可转债":
36
39
  if str(x).startswith('11'):
37
- x = x.zfill(5) if len(x) < 5 else x
40
+ x = x.zfill(stock_len) if len(x) < stock_len else x
38
41
  return '%s.SH' % x
39
42
  elif str(x).startswith('12'):
40
- x = x.zfill(5) if len(x) < 5 else x
43
+ x = x.zfill(stock_len) if len(x) < stock_len else x
41
44
  return '%s.SZ' % x
42
-
43
- if not x[0].isdigit():
44
- r = re.search(r"(\d+)", str(x), re.S | re.M)
45
- if not r:
46
- return x.upper()
47
- else:
48
- x = r.group(1) # # return f"{r.group(1)}.{str(x).split(r.group(1))[0]}"
49
-
50
45
  if not x[0].isdigit():
51
46
  return x.upper()
47
+ if str(x[0:3]) in ['920']:
48
+ x = x.zfill(stock_len) if len(x) < stock_len else x
49
+ return '%s.BJ' % x
52
50
  if str(x[0]) in ['5', '6', '9']:
53
- x = x.zfill(5) if len(x) < 5 else x
51
+ x = x.zfill(stock_len) if len(x) < stock_len else x
54
52
  return '%s.SH' % x
55
53
  elif str(x[0]) in ['8', '4']:
56
- x = x.zfill(5) if len(x) < 5 else x
54
+ x = x.zfill(stock_len) if len(x) < stock_len else x
57
55
  return '%s.BJ' % x
58
56
  else:
59
- x = x.zfill(5) if len(x) < 5 else x
57
+ x = x.zfill(stock_len) if len(x) < stock_len else x
60
58
  return '%s.SZ' % x
61
59
 
62
-
63
60
  def a_symbol_verify(x):
64
61
  l = str(x).upper().split(".")
65
62
  if not x[-1].isdigit():
@@ -107,6 +104,8 @@ def verify_stock_or_index(x):
107
104
  return True
108
105
  elif x.startswith('4') and x.endswith('BJ'):
109
106
  return True
107
+ elif x.startswith('920') and x.endswith('BJ'):
108
+ return True
110
109
  elif x.startswith('9') and x.endswith('CSI'):
111
110
  return False
112
111
  else:
@@ -119,5 +118,6 @@ if __name__ == '__main__':
119
118
  # s = symbol_verify("sz000001")
120
119
  # s = symbol_verify("000001.SZ")
121
120
  # s = symbols_f("000001", special="港股")
122
- s = verify_stock_or_index(x="399005.SZ")
121
+ # s = verify_stock_or_index(x="399005.SZ")
122
+ s = format_stock_code(x="92052")
123
123
  print(s)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tushare
3
- Version: 1.4.16
3
+ Version: 1.4.18
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,10 @@ return::
80
80
 
81
81
  Log
82
82
  --------------
83
+ 1.4.17
84
+ -------
85
+ - 修复 920 开头更改是北交所
86
+ -------
83
87
  1.4.14
84
88
  -------
85
89
  - 修复 realtime_list (爬虫版)
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