tushare 1.4.6__tar.gz → 1.4.8__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.
- {tushare-1.4.6/tushare.egg-info → tushare-1.4.8}/PKG-INFO +1 -4
- {tushare-1.4.6 → tushare-1.4.8}/setup.py +2 -2
- {tushare-1.4.6 → tushare-1.4.8}/tushare/__init__.py +1 -1
- {tushare-1.4.6 → tushare-1.4.8}/tushare/pro/data_pro.py +18 -10
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/model/tick.py +128 -128
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/tgw_subs/convert.py +20 -20
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/ts_subs/subscribe.py +1 -1
- {tushare-1.4.6 → tushare-1.4.8/tushare.egg-info}/PKG-INFO +1 -4
- {tushare-1.4.6 → tushare-1.4.8}/tushare.egg-info/SOURCES.txt +0 -6
- {tushare-1.4.6 → tushare-1.4.8}/tushare.egg-info/requires.txt +1 -1
- {tushare-1.4.6 → tushare-1.4.8}/tushare.egg-info/top_level.txt +0 -1
- tushare-1.4.6/baks/demo.py +0 -184
- tushare-1.4.6/baks/rtqc.py +0 -612
- tushare-1.4.6/baks/setup.py +0 -15
- tushare-1.4.6/baks/sss.py +0 -56
- tushare-1.4.6/tushare/stock/rtqc.pyd +0 -0
- tushare-1.4.6/tushare/util/protobuf/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/LICENSE +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/README.md +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/setup.cfg +0 -0
- {tushare-1.4.6/baks → tushare-1.4.8/tushare/bond}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/bond/bonds.py +0 -0
- {tushare-1.4.6/tushare/bond → tushare-1.4.8/tushare/coins}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/coins/market.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/data/__init__.py +0 -0
- {tushare-1.4.6/tushare/coins → tushare-1.4.8/tushare/fund}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/fund/cons.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/fund/nav.py +0 -0
- {tushare-1.4.6/tushare/fund → tushare-1.4.8/tushare/futures}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/futures/cons.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/futures/domestic.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/futures/domestic_cons.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/futures/intlfutures.py +0 -0
- {tushare-1.4.6/tushare/futures → tushare-1.4.8/tushare/internet}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/internet/boxoffice.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/internet/caixinnews.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/internet/indexes.py +0 -0
- {tushare-1.4.6/tushare/internet → tushare-1.4.8/tushare/pro}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/pro/client.py +0 -0
- {tushare-1.4.6/tushare/pro → tushare-1.4.8/tushare/stock}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/billboard.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/classifying.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/cons.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/fundamental.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/globals.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/histroy_divide.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/indictor.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/macro.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/macro_vars.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/minsdata.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/news_vars.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/newsevent.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/ref_vars.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/reference.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/rtq.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/rtq_vars.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/shibor.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/stock/trading.py +0 -0
- {tushare-1.4.6/tushare/stock → tushare-1.4.8/tushare/subs}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/ht_subs/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/ht_subs/covert.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/ht_subs/subscribe.py +0 -0
- {tushare-1.4.6/tushare/subs → tushare-1.4.8/tushare/subs/model}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/model/min.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/tgw_subs/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/tgw_subs/login.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/tgw_subs/subscribe.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/subs/ts_subs/__init__.py +0 -0
- {tushare-1.4.6/tushare/subs/model → tushare-1.4.8/tushare/trader}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/trader/trader.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/trader/utils.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/trader/vars.py +0 -0
- {tushare-1.4.6/tushare/trader → tushare-1.4.8/tushare/util}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/common.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/conns.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/dateu.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/form_date.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/format_stock_code.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/formula.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/mailmerge.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/netbase.py +0 -0
- {tushare-1.4.6/tushare/util → tushare-1.4.8/tushare/util/protobuf}/__init__.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/protobuf/funcs.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/protobuf/response_pb2.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/store.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/upass.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/vars.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare/util/verify_token.py +0 -0
- {tushare-1.4.6 → tushare-1.4.8}/tushare.egg-info/dependency_links.txt +0 -0
@@ -1,13 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tushare
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.8
|
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
|
7
7
|
Author-email: waditu@163.com
|
8
8
|
License: BSD
|
9
9
|
Keywords: Global Financial Data
|
10
|
-
Platform: UNKNOWN
|
11
10
|
Classifier: Development Status :: 4 - Beta
|
12
11
|
Classifier: Programming Language :: Python :: 3.6
|
13
12
|
Classifier: Programming Language :: Python :: 3.7
|
@@ -90,5 +89,3 @@ Log
|
|
90
89
|
-------
|
91
90
|
- 支持华泰实时数据15SECOND
|
92
91
|
|
93
|
-
|
94
|
-
|
@@ -89,7 +89,7 @@ def read_install_requires():
|
|
89
89
|
'lxml',
|
90
90
|
'simplejson',
|
91
91
|
'bs4',
|
92
|
-
'websocket-client
|
92
|
+
'websocket-client>=0.57.0',
|
93
93
|
'tqdm'
|
94
94
|
]
|
95
95
|
return reqs
|
@@ -97,7 +97,7 @@ def read_install_requires():
|
|
97
97
|
|
98
98
|
setup(
|
99
99
|
name='tushare',
|
100
|
-
version='1.4.
|
100
|
+
version='1.4.8',
|
101
101
|
description='A utility for crawling historical and Real-time Quotes data of China stocks',
|
102
102
|
# long_description=read("README.rst"),
|
103
103
|
long_description=long_desc,
|
@@ -3,7 +3,7 @@
|
|
3
3
|
pro init
|
4
4
|
Created on 2018/07/01
|
5
5
|
@author: Jimmy Liu
|
6
|
-
@group : https://
|
6
|
+
@group : https://tushare.pro
|
7
7
|
@contact: jimmysoa@sina.cn
|
8
8
|
"""
|
9
9
|
from __future__ import division
|
@@ -12,8 +12,8 @@ from tushare.pro import client
|
|
12
12
|
from tushare.util import upass
|
13
13
|
from tushare.util.formula import MA
|
14
14
|
|
15
|
-
PRICE_COLS = ['open', 'close', 'high', 'low']
|
16
|
-
FORMAT = lambda x: '%.
|
15
|
+
PRICE_COLS = ['open', 'close', 'high', 'low', 'pre_close']
|
16
|
+
FORMAT = lambda x: '%.2f' % x
|
17
17
|
FREQS = {'D': '1DAY',
|
18
18
|
'W': '1WEEK',
|
19
19
|
'Y': '1YEAR',
|
@@ -48,6 +48,7 @@ def pro_bar(ts_code='', api=None, start_date='', end_date='', freq='D', asset='E
|
|
48
48
|
adjfactor = False,
|
49
49
|
offset = None,
|
50
50
|
limit = None,
|
51
|
+
fields = '',
|
51
52
|
contract_type = '',
|
52
53
|
retry_count = 3):
|
53
54
|
"""
|
@@ -143,6 +144,11 @@ def pro_bar(ts_code='', api=None, start_date='', end_date='', freq='D', asset='E
|
|
143
144
|
data['pct_chg'] = data['pct_chg'].map(lambda x: FORMAT(x)).astype(float)
|
144
145
|
else:
|
145
146
|
data = data.drop(['trade_date', 'pre_close'], axis=1)
|
147
|
+
else:
|
148
|
+
data['pre_close'] = data['close'].shift(-1)
|
149
|
+
data['change'] = data['close'] - data['pre_close']
|
150
|
+
data['pct_chg'] = data['change'] / data['pre_close'] * 100
|
151
|
+
data['pct_chg'] = data['pct_chg'].map(lambda x: FORMAT(x)).astype(float)
|
146
152
|
elif asset == 'I':
|
147
153
|
if freq == 'D':
|
148
154
|
data = api.index_daily(ts_code=ts_code, start_date=start_date, end_date=end_date, offset=offset, limit=limit)
|
@@ -161,7 +167,7 @@ def pro_bar(ts_code='', api=None, start_date='', end_date='', freq='D', asset='E
|
|
161
167
|
if freq == 'D':
|
162
168
|
data = api.opt_daily(ts_code=ts_code, start_date=start_date, end_date=end_date, exchange=exchange, offset=offset, limit=limit)
|
163
169
|
if 'min' in freq:
|
164
|
-
data = api.
|
170
|
+
data = api.opt_mins(ts_code=ts_code, start_date=start_date, end_date=end_date, freq=freq, offset=offset, limit=limit)
|
165
171
|
elif asset == 'CB':
|
166
172
|
if freq == 'D':
|
167
173
|
data = api.cb_daily(ts_code=ts_code, start_date=start_date, end_date=end_date, offset=offset, limit=limit)
|
@@ -175,11 +181,8 @@ def pro_bar(ts_code='', api=None, start_date='', end_date='', freq='D', asset='E
|
|
175
181
|
freq = 'daily'
|
176
182
|
elif freq == 'w':
|
177
183
|
freq = 'week'
|
178
|
-
data = api.coinbar(
|
179
|
-
|
180
|
-
start_dae=start_date, end_date=end_date,
|
181
|
-
contract_type=contract_type
|
182
|
-
)
|
184
|
+
data = api.coinbar(exchange=exchange, symbol=ts_code, freq=freq, start_dae=start_date, end_date=end_date,
|
185
|
+
contract_type=contract_type)
|
183
186
|
if ma is not None and len(ma) > 0:
|
184
187
|
for a in ma:
|
185
188
|
if isinstance(a, int):
|
@@ -191,6 +194,9 @@ def pro_bar(ts_code='', api=None, start_date='', end_date='', freq='D', asset='E
|
|
191
194
|
except Exception as e:
|
192
195
|
print(e)
|
193
196
|
else:
|
197
|
+
if fields is not None and fields != '':
|
198
|
+
f_list = [col.strip() for col in fields.split(',')]
|
199
|
+
data = data[f_list]
|
194
200
|
return data
|
195
201
|
raise IOError('ERROR.')
|
196
202
|
|
@@ -211,5 +217,7 @@ def ht_subs(username, password):
|
|
211
217
|
|
212
218
|
|
213
219
|
if __name__ == '__main__':
|
214
|
-
|
220
|
+
# upass.set_token('')
|
215
221
|
pro = pro_api()
|
222
|
+
df = pro_bar(ts_code='688539.SH', adj='qfq')
|
223
|
+
print(df)
|
@@ -1,128 +1,128 @@
|
|
1
|
-
from datetime import datetime
|
2
|
-
from typing import Optional
|
3
|
-
|
4
|
-
from pydantic import BaseModel
|
5
|
-
|
6
|
-
|
7
|
-
class TsTick(BaseModel):
|
8
|
-
ts_code: str
|
9
|
-
name: Optional[str]
|
10
|
-
trade_time: Optional[datetime]
|
11
|
-
pre_close_price: Optional[float]
|
12
|
-
last_price: Optional[float]
|
13
|
-
open_price: Optional[float]
|
14
|
-
high_price: Optional[float]
|
15
|
-
low_price: Optional[float]
|
16
|
-
close_price: Optional[float]
|
17
|
-
volume: Optional[int] # 成交量
|
18
|
-
amount: Optional[int] # 成交金额
|
19
|
-
count: Optional[int] # 交易数量
|
20
|
-
ask_price1: Optional[float] # 申卖价, 委托档位卖1档价格
|
21
|
-
ask_volume1: Optional[int] # 申卖量
|
22
|
-
bid_price1: Optional[float] # 申买价, 委托档位买1档价格
|
23
|
-
bid_volume1: Optional[int] # 申买量
|
24
|
-
ask_price2: Optional[float]
|
25
|
-
ask_volume2: Optional[int]
|
26
|
-
bid_price2: Optional[float]
|
27
|
-
bid_volume2: Optional[int]
|
28
|
-
ask_price3: Optional[float]
|
29
|
-
ask_volume3: Optional[int]
|
30
|
-
bid_price3: Optional[float]
|
31
|
-
bid_volume3: Optional[int]
|
32
|
-
ask_price4: Optional[float]
|
33
|
-
ask_volume4: Optional[int]
|
34
|
-
bid_price4: Optional[float]
|
35
|
-
bid_volume4: Optional[int]
|
36
|
-
ask_price5: Optional[float]
|
37
|
-
ask_volume5: Optional[int]
|
38
|
-
bid_price5: Optional[float]
|
39
|
-
bid_volume5: Optional[int]
|
40
|
-
ask_price6: Optional[float]
|
41
|
-
ask_volume6: Optional[int]
|
42
|
-
bid_price6: Optional[float]
|
43
|
-
bid_volume6: Optional[int]
|
44
|
-
ask_price7: Optional[float]
|
45
|
-
ask_volume7: Optional[int]
|
46
|
-
bid_price7: Optional[float]
|
47
|
-
bid_volume7: Optional[int]
|
48
|
-
ask_price8: Optional[float]
|
49
|
-
ask_volume8: Optional[int]
|
50
|
-
bid_price8: Optional[float]
|
51
|
-
bid_volume8: Optional[int]
|
52
|
-
ask_price9: Optional[float]
|
53
|
-
ask_volume9: Optional[int]
|
54
|
-
bid_price9: Optional[float]
|
55
|
-
bid_volume9: Optional[int]
|
56
|
-
ask_price10: Optional[float]
|
57
|
-
ask_volume10: Optional[int]
|
58
|
-
bid_price10: Optional[float]
|
59
|
-
bid_volume10: Optional[int]
|
60
|
-
|
61
|
-
|
62
|
-
class TsTickIdx(BaseModel):
|
63
|
-
ts_code: str
|
64
|
-
name: Optional[str]
|
65
|
-
trade_time: Optional[datetime]
|
66
|
-
last_price: Optional[float] # last_price
|
67
|
-
pre_close_price: Optional[float] # pre_close_price
|
68
|
-
high_price: Optional[float] # high_price
|
69
|
-
open_price: Optional[float] # open_price
|
70
|
-
low_price: Optional[float] # low_price
|
71
|
-
close_price: Optional[float] # close_price
|
72
|
-
volume: Optional[int] # volume, 成交总量
|
73
|
-
amount: Optional[float] # amount, 成交总金额
|
74
|
-
|
75
|
-
|
76
|
-
class TsTickOpt(BaseModel):
|
77
|
-
ts_code: str
|
78
|
-
instrument_id: str
|
79
|
-
trade_time: Optional[datetime]
|
80
|
-
pre_price: Optional[float]
|
81
|
-
price: Optional[float]
|
82
|
-
open: Optional[float]
|
83
|
-
high: Optional[float]
|
84
|
-
low: Optional[float]
|
85
|
-
close: Optional[float]
|
86
|
-
open_int: Optional[int]
|
87
|
-
vol: Optional[float]
|
88
|
-
amount: Optional[float]
|
89
|
-
num: Optional[int]
|
90
|
-
ask_price1: Optional[float]
|
91
|
-
ask_volume1: Optional[int]
|
92
|
-
bid_price1: Optional[float]
|
93
|
-
bid_volume1: Optional[int]
|
94
|
-
pre_delta: Optional[float] # 昨虚实度,暂未提供
|
95
|
-
dif_price1: Optional[float]
|
96
|
-
dif_price2: Optional[float]
|
97
|
-
high_limit_price: Optional[float]
|
98
|
-
low_limit_price: Optional[float]
|
99
|
-
refer_price: Optional[float] # 参考价,港股使用
|
100
|
-
|
101
|
-
|
102
|
-
class TsTickFuture(BaseModel):
|
103
|
-
ts_code: str
|
104
|
-
instrument_id: Optional[str]
|
105
|
-
trade_time: Optional[datetime]
|
106
|
-
pre_price: Optional[float]
|
107
|
-
price: Optional[float]
|
108
|
-
open: Optional[float]
|
109
|
-
high: Optional[float]
|
110
|
-
low: Optional[float]
|
111
|
-
close: Optional[float]
|
112
|
-
open_int: Optional[int]
|
113
|
-
vol: Optional[int]
|
114
|
-
amount: Optional[int] # 单数量
|
115
|
-
num: Optional[int]
|
116
|
-
ask_price1: Optional[float]
|
117
|
-
ask_volume1: Optional[int]
|
118
|
-
bid_price1: Optional[float]
|
119
|
-
bid_volume1: Optional[int]
|
120
|
-
pre_delta: Optional[float]
|
121
|
-
curr_delta: Optional[float]
|
122
|
-
dif_price1: Optional[float]
|
123
|
-
dif_price2: Optional[float]
|
124
|
-
high_limit_price: Optional[float]
|
125
|
-
low_limit_price: Optional[float]
|
126
|
-
refer_price: Optional[float]
|
127
|
-
pre_settle_price: Optional[float]
|
128
|
-
settle_price: Optional[float]
|
1
|
+
from datetime import datetime
|
2
|
+
from typing import Optional
|
3
|
+
|
4
|
+
from pydantic import BaseModel
|
5
|
+
|
6
|
+
|
7
|
+
class TsTick(BaseModel):
|
8
|
+
ts_code: str
|
9
|
+
name: Optional[str]
|
10
|
+
trade_time: Optional[datetime]
|
11
|
+
pre_close_price: Optional[float]
|
12
|
+
last_price: Optional[float]
|
13
|
+
open_price: Optional[float]
|
14
|
+
high_price: Optional[float]
|
15
|
+
low_price: Optional[float]
|
16
|
+
close_price: Optional[float]
|
17
|
+
volume: Optional[int] # 成交量
|
18
|
+
amount: Optional[int] # 成交金额
|
19
|
+
count: Optional[int] # 交易数量
|
20
|
+
ask_price1: Optional[float] # 申卖价, 委托档位卖1档价格
|
21
|
+
ask_volume1: Optional[int] # 申卖量
|
22
|
+
bid_price1: Optional[float] # 申买价, 委托档位买1档价格
|
23
|
+
bid_volume1: Optional[int] # 申买量
|
24
|
+
ask_price2: Optional[float]
|
25
|
+
ask_volume2: Optional[int]
|
26
|
+
bid_price2: Optional[float]
|
27
|
+
bid_volume2: Optional[int]
|
28
|
+
ask_price3: Optional[float]
|
29
|
+
ask_volume3: Optional[int]
|
30
|
+
bid_price3: Optional[float]
|
31
|
+
bid_volume3: Optional[int]
|
32
|
+
ask_price4: Optional[float]
|
33
|
+
ask_volume4: Optional[int]
|
34
|
+
bid_price4: Optional[float]
|
35
|
+
bid_volume4: Optional[int]
|
36
|
+
ask_price5: Optional[float]
|
37
|
+
ask_volume5: Optional[int]
|
38
|
+
bid_price5: Optional[float]
|
39
|
+
bid_volume5: Optional[int]
|
40
|
+
ask_price6: Optional[float]
|
41
|
+
ask_volume6: Optional[int]
|
42
|
+
bid_price6: Optional[float]
|
43
|
+
bid_volume6: Optional[int]
|
44
|
+
ask_price7: Optional[float]
|
45
|
+
ask_volume7: Optional[int]
|
46
|
+
bid_price7: Optional[float]
|
47
|
+
bid_volume7: Optional[int]
|
48
|
+
ask_price8: Optional[float]
|
49
|
+
ask_volume8: Optional[int]
|
50
|
+
bid_price8: Optional[float]
|
51
|
+
bid_volume8: Optional[int]
|
52
|
+
ask_price9: Optional[float]
|
53
|
+
ask_volume9: Optional[int]
|
54
|
+
bid_price9: Optional[float]
|
55
|
+
bid_volume9: Optional[int]
|
56
|
+
ask_price10: Optional[float]
|
57
|
+
ask_volume10: Optional[int]
|
58
|
+
bid_price10: Optional[float]
|
59
|
+
bid_volume10: Optional[int]
|
60
|
+
|
61
|
+
|
62
|
+
class TsTickIdx(BaseModel):
|
63
|
+
ts_code: str
|
64
|
+
name: Optional[str]
|
65
|
+
trade_time: Optional[datetime]
|
66
|
+
last_price: Optional[float] # last_price 单位元
|
67
|
+
pre_close_price: Optional[float] # pre_close_price
|
68
|
+
high_price: Optional[float] # high_price
|
69
|
+
open_price: Optional[float] # open_price
|
70
|
+
low_price: Optional[float] # low_price
|
71
|
+
close_price: Optional[float] # close_price
|
72
|
+
volume: Optional[int] # volume, 成交总量
|
73
|
+
amount: Optional[float] # amount, 成交总金额
|
74
|
+
|
75
|
+
|
76
|
+
class TsTickOpt(BaseModel):
|
77
|
+
ts_code: str
|
78
|
+
instrument_id: str
|
79
|
+
trade_time: Optional[datetime]
|
80
|
+
pre_price: Optional[float] # 单位元
|
81
|
+
price: Optional[float]
|
82
|
+
open: Optional[float]
|
83
|
+
high: Optional[float]
|
84
|
+
low: Optional[float]
|
85
|
+
close: Optional[float]
|
86
|
+
open_int: Optional[int]
|
87
|
+
vol: Optional[float]
|
88
|
+
amount: Optional[float]
|
89
|
+
num: Optional[int]
|
90
|
+
ask_price1: Optional[float]
|
91
|
+
ask_volume1: Optional[int]
|
92
|
+
bid_price1: Optional[float]
|
93
|
+
bid_volume1: Optional[int]
|
94
|
+
pre_delta: Optional[float] # 昨虚实度,暂未提供
|
95
|
+
dif_price1: Optional[float]
|
96
|
+
dif_price2: Optional[float]
|
97
|
+
high_limit_price: Optional[float]
|
98
|
+
low_limit_price: Optional[float]
|
99
|
+
refer_price: Optional[float] # 参考价,港股使用
|
100
|
+
|
101
|
+
|
102
|
+
class TsTickFuture(BaseModel):
|
103
|
+
ts_code: str
|
104
|
+
instrument_id: Optional[str]
|
105
|
+
trade_time: Optional[datetime]
|
106
|
+
pre_price: Optional[float]
|
107
|
+
price: Optional[float]
|
108
|
+
open: Optional[float]
|
109
|
+
high: Optional[float]
|
110
|
+
low: Optional[float]
|
111
|
+
close: Optional[float]
|
112
|
+
open_int: Optional[int]
|
113
|
+
vol: Optional[int]
|
114
|
+
amount: Optional[int] # 单数量
|
115
|
+
num: Optional[int]
|
116
|
+
ask_price1: Optional[float]
|
117
|
+
ask_volume1: Optional[int]
|
118
|
+
bid_price1: Optional[float]
|
119
|
+
bid_volume1: Optional[int]
|
120
|
+
pre_delta: Optional[float]
|
121
|
+
curr_delta: Optional[float]
|
122
|
+
dif_price1: Optional[float]
|
123
|
+
dif_price2: Optional[float]
|
124
|
+
high_limit_price: Optional[float]
|
125
|
+
low_limit_price: Optional[float]
|
126
|
+
refer_price: Optional[float]
|
127
|
+
pre_settle_price: Optional[float]
|
128
|
+
settle_price: Optional[float]
|
@@ -62,14 +62,14 @@ def convert_tick_index(tgw_data: dict) -> TsTickIdx:
|
|
62
62
|
ts_code=get_ts_code(tgw_data.get("market_type"), tgw_data.get("security_code")),
|
63
63
|
name=None,
|
64
64
|
trade_time=datetime.strptime(str(tgw_data.get('orig_time'))[:-3], '%Y%m%d%H%M%S'),
|
65
|
-
last_price=tgw_data.get('last_index'),
|
66
|
-
pre_close_price=tgw_data.get('pre_close_index'),
|
67
|
-
open_price=tgw_data.get('open_index'),
|
68
|
-
high_price=tgw_data.get('high_index'),
|
69
|
-
low_price=tgw_data.get('low_index'),
|
70
|
-
close_price=tgw_data.get('close_index'),
|
71
|
-
volume=tgw_data.get('total_volume_trade'),
|
72
|
-
amount=tgw_data.get('total_value_trade'),
|
65
|
+
last_price=tgw_data.get('last_index')/1000000,
|
66
|
+
pre_close_price=tgw_data.get('pre_close_index')/1000000,
|
67
|
+
open_price=tgw_data.get('open_index')/1000000,
|
68
|
+
high_price=tgw_data.get('high_index')/1000000,
|
69
|
+
low_price=tgw_data.get('low_index')/1000000,
|
70
|
+
close_price=tgw_data.get('close_index')/1000000,
|
71
|
+
volume=tgw_data.get('total_volume_trade')/100,
|
72
|
+
amount=tgw_data.get('total_value_trade')/100000,
|
73
73
|
)
|
74
74
|
return item
|
75
75
|
|
@@ -138,22 +138,22 @@ def convert_tick_stock(tgw_data: dict) -> TsTick:
|
|
138
138
|
"""
|
139
139
|
extra = {}
|
140
140
|
for i in range(1, 11):
|
141
|
-
extra[f'ask_price{i}'] = tgw_data.get(f'offer_price{i}')
|
142
|
-
extra[f'ask_volume{i}'] = tgw_data.get(f'offer_volume{i}')
|
143
|
-
extra[f'bid_price{i}'] = tgw_data.get(f'bid_price{i}')
|
144
|
-
extra[f'bid_volume{i}'] = tgw_data.get(f'bid_volume{i}')
|
141
|
+
extra[f'ask_price{i}'] = tgw_data.get(f'offer_price{i}')/1000000
|
142
|
+
extra[f'ask_volume{i}'] = tgw_data.get(f'offer_volume{i}')/100
|
143
|
+
extra[f'bid_price{i}'] = tgw_data.get(f'bid_price{i}')/1000000
|
144
|
+
extra[f'bid_volume{i}'] = tgw_data.get(f'bid_volume{i}')/100
|
145
145
|
item = TsTick(
|
146
146
|
ts_code=get_ts_code(tgw_data.get("market_type"), tgw_data.get("security_code")),
|
147
147
|
name=None,
|
148
148
|
trade_time=datetime.strptime(str(tgw_data.get('orig_time'))[:-3], '%Y%m%d%H%M%S'),
|
149
|
-
pre_close_price=tgw_data.get("pre_close_price"),
|
150
|
-
last_price=tgw_data.get("last_price"),
|
151
|
-
open_price=tgw_data.get("open_price"),
|
152
|
-
high_price=tgw_data.get("high_price"),
|
153
|
-
low_price=tgw_data.get("low_price"),
|
154
|
-
close_price=tgw_data.get("close_price"),
|
155
|
-
volume=tgw_data.get("total_volume_trade"),
|
156
|
-
amount=tgw_data.get("total_value_trade"),
|
149
|
+
pre_close_price=tgw_data.get("pre_close_price")/1000000,
|
150
|
+
last_price=tgw_data.get("last_price")/1000000,
|
151
|
+
open_price=tgw_data.get("open_price")/1000000,
|
152
|
+
high_price=tgw_data.get("high_price")/1000000,
|
153
|
+
low_price=tgw_data.get("low_price")/1000000,
|
154
|
+
close_price=tgw_data.get("close_price")/1000000,
|
155
|
+
volume=tgw_data.get("total_volume_trade")/100,
|
156
|
+
amount=tgw_data.get("total_value_trade")/1000000,
|
157
157
|
count=tgw_data.get("num_trades"),
|
158
158
|
**extra
|
159
159
|
)
|
@@ -176,7 +176,7 @@ def test():
|
|
176
176
|
app = TsSubscribe(token='')
|
177
177
|
|
178
178
|
# code 可以包含 * (通配符)
|
179
|
-
@app.register(topic='HQ_STK_TICK', codes=["
|
179
|
+
@app.register(topic='HQ_STK_TICK', codes=["600000.SH"])
|
180
180
|
def print_message(record):
|
181
181
|
"""
|
182
182
|
订阅主题topic,并指定codes列表,在接收到topic的推送消息时,符合code条件,就会执行回调
|
@@ -1,13 +1,12 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tushare
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.8
|
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
|
7
7
|
Author-email: waditu@163.com
|
8
8
|
License: BSD
|
9
9
|
Keywords: Global Financial Data
|
10
|
-
Platform: UNKNOWN
|
11
10
|
Classifier: Development Status :: 4 - Beta
|
12
11
|
Classifier: Programming Language :: Python :: 3.6
|
13
12
|
Classifier: Programming Language :: Python :: 3.7
|
@@ -90,5 +89,3 @@ Log
|
|
90
89
|
-------
|
91
90
|
- 支持华泰实时数据15SECOND
|
92
91
|
|
93
|
-
|
94
|
-
|
@@ -1,11 +1,6 @@
|
|
1
1
|
LICENSE
|
2
2
|
README.md
|
3
3
|
setup.py
|
4
|
-
baks/__init__.py
|
5
|
-
baks/demo.py
|
6
|
-
baks/rtqc.py
|
7
|
-
baks/setup.py
|
8
|
-
baks/sss.py
|
9
4
|
tushare/__init__.py
|
10
5
|
tushare.egg-info/PKG-INFO
|
11
6
|
tushare.egg-info/SOURCES.txt
|
@@ -49,7 +44,6 @@ tushare/stock/ref_vars.py
|
|
49
44
|
tushare/stock/reference.py
|
50
45
|
tushare/stock/rtq.py
|
51
46
|
tushare/stock/rtq_vars.py
|
52
|
-
tushare/stock/rtqc.pyd
|
53
47
|
tushare/stock/shibor.py
|
54
48
|
tushare/stock/trading.py
|
55
49
|
tushare/subs/__init__.py
|