tushare 1.4.6__py3-none-any.whl → 1.4.7__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 +1 -1
- tushare/pro/data_pro.py +18 -10
- tushare/subs/model/tick.py +128 -128
- tushare/subs/tgw_subs/convert.py +20 -20
- {tushare-1.4.6.dist-info → tushare-1.4.7.dist-info}/METADATA +98 -101
- {tushare-1.4.6.dist-info → tushare-1.4.7.dist-info}/RECORD +9 -46
- {tushare-1.4.6.dist-info → tushare-1.4.7.dist-info}/WHEEL +1 -1
- {tushare-1.4.6.dist-info → tushare-1.4.7.dist-info}/top_level.txt +0 -1
- baks/__init__.py +0 -0
- baks/demo.py +0 -184
- baks/rtqc.py +0 -612
- baks/setup.py +0 -15
- baks/sss.py +0 -56
- test/__init__.py +0 -0
- test/bar_test.py +0 -23
- test/billboard_test.py +0 -35
- test/build_pyd/__init__.py +0 -8
- test/build_pyd/rtqc.py +0 -612
- test/build_pyd/setup.py +0 -15
- test/build_pyd//321/206/320/231/320/243/321/205/320/234/320/225pyd/321/205/320/241/342/225/234/321/204/342/225/227/320/264.txt +0 -1
- test/classifying_test.py +0 -50
- test/dateu_test.py +0 -19
- test/fund_test.py +0 -43
- test/indictor_test.py +0 -23
- test/macro_test.py +0 -50
- test/nav_test.py +0 -104
- test/news_test.py +0 -38
- test/pro_test.py +0 -11
- test/ref_test.py +0 -57
- test/shibor_test.py +0 -33
- test/storing_test.py +0 -61
- test/test_query.py +0 -16
- test/test_realtime.py +0 -24
- test/test_realtime_quote.py +0 -13
- test/test_sdk_event.py +0 -21
- test/test_stk_mins.py +0 -16
- test/test_stock_basic.py +0 -16
- test/test_tgw_subscribe.py +0 -28
- test/test_ts_subscribe.py +0 -22
- test/test_websocket.py +0 -52
- test/trading_test.py +0 -43
- tushare/stock/rtqc.pyd +0 -0
- tushare/subs/ht_subs/service/__init__.py +0 -0
- tushare/subs/ht_subs/service/covert.py +0 -189
- tushare/subs/ts_subs.py +0 -192
- {tushare-1.4.6.dist-info → tushare-1.4.7.dist-info}/LICENSE +0 -0
tushare/__init__.py
CHANGED
tushare/pro/data_pro.py
CHANGED
@@ -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)
|
tushare/subs/model/tick.py
CHANGED
@@ -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]
|
tushare/subs/tgw_subs/convert.py
CHANGED
@@ -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
|
)
|
@@ -1,101 +1,98 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: tushare
|
3
|
-
Version: 1.4.
|
4
|
-
Summary: A utility for crawling historical and Real-time Quotes data of China stocks
|
5
|
-
Home-page: https://tushare.pro
|
6
|
-
Author: Jimmy Liu
|
7
|
-
Author-email: waditu@163.com
|
8
|
-
License: BSD
|
9
|
-
Keywords: Global Financial Data
|
10
|
-
|
11
|
-
Classifier:
|
12
|
-
Classifier: Programming Language :: Python :: 3.
|
13
|
-
Classifier: Programming Language :: Python :: 3.
|
14
|
-
Classifier: Programming Language :: Python :: 3.
|
15
|
-
Classifier: Programming Language :: Python :: 3.
|
16
|
-
Classifier:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Requires-Dist:
|
21
|
-
Requires-Dist:
|
22
|
-
Requires-Dist:
|
23
|
-
Requires-Dist:
|
24
|
-
Requires-Dist:
|
25
|
-
Requires-Dist:
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
*
|
39
|
-
* can be
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
* financial
|
46
|
-
*
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
2012-01-
|
73
|
-
2012-01-
|
74
|
-
2012-01-
|
75
|
-
2012-01-
|
76
|
-
2012-01-
|
77
|
-
2012-01-
|
78
|
-
2012-01-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
- 修复
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: tushare
|
3
|
+
Version: 1.4.7
|
4
|
+
Summary: A utility for crawling historical and Real-time Quotes data of China stocks
|
5
|
+
Home-page: https://tushare.pro
|
6
|
+
Author: Jimmy Liu
|
7
|
+
Author-email: waditu@163.com
|
8
|
+
License: BSD
|
9
|
+
Keywords: Global Financial Data
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
11
|
+
Classifier: Programming Language :: Python :: 3.6
|
12
|
+
Classifier: Programming Language :: Python :: 3.7
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
16
|
+
Classifier: License :: OSI Approved :: BSD License
|
17
|
+
Description-Content-Type: text/plain
|
18
|
+
License-File: LICENSE
|
19
|
+
Requires-Dist: pandas
|
20
|
+
Requires-Dist: requests
|
21
|
+
Requires-Dist: lxml
|
22
|
+
Requires-Dist: simplejson
|
23
|
+
Requires-Dist: bs4
|
24
|
+
Requires-Dist: websocket-client ==0.57.0
|
25
|
+
Requires-Dist: tqdm
|
26
|
+
|
27
|
+
|
28
|
+
TuShare
|
29
|
+
===============
|
30
|
+
|
31
|
+
.. image:: https://api.travis-ci.org/waditu/tushare.png?branch=master
|
32
|
+
:target: https://travis-ci.org/waditu/tushare
|
33
|
+
|
34
|
+
.. image:: https://badge.fury.io/py/tushare.png
|
35
|
+
:target: http://badge.fury.io/py/tushare
|
36
|
+
|
37
|
+
* easy to use as most of the data returned are pandas DataFrame objects
|
38
|
+
* can be easily saved as csv, excel or json files
|
39
|
+
* can be inserted into MySQL or Mongodb
|
40
|
+
|
41
|
+
Target Users
|
42
|
+
--------------
|
43
|
+
|
44
|
+
* financial market analyst of China
|
45
|
+
* learners of financial data analysis with pandas/NumPy
|
46
|
+
* people who are interested in China financial data
|
47
|
+
|
48
|
+
Installation
|
49
|
+
--------------
|
50
|
+
|
51
|
+
pip install tushare
|
52
|
+
|
53
|
+
Upgrade
|
54
|
+
---------------
|
55
|
+
|
56
|
+
pip install tushare --upgrade
|
57
|
+
|
58
|
+
Quick Start
|
59
|
+
--------------
|
60
|
+
|
61
|
+
::
|
62
|
+
|
63
|
+
import tushare as ts
|
64
|
+
|
65
|
+
ts.get_hist_data('600848')
|
66
|
+
|
67
|
+
return::
|
68
|
+
|
69
|
+
open high close low volume p_change ma5
|
70
|
+
date
|
71
|
+
2012-01-11 6.880 7.380 7.060 6.880 14129.96 2.62 7.060
|
72
|
+
2012-01-12 7.050 7.100 6.980 6.900 7895.19 -1.13 7.020
|
73
|
+
2012-01-13 6.950 7.000 6.700 6.690 6611.87 -4.01 6.913
|
74
|
+
2012-01-16 6.680 6.750 6.510 6.480 2941.63 -2.84 6.813
|
75
|
+
2012-01-17 6.660 6.880 6.860 6.460 8642.57 5.38 6.822
|
76
|
+
2012-01-18 7.000 7.300 6.890 6.880 13075.40 0.44 6.788
|
77
|
+
2012-01-19 6.690 6.950 6.890 6.680 6117.32 0.00 6.770
|
78
|
+
2012-01-20 6.870 7.080 7.010 6.870 6813.09 1.74 6.832
|
79
|
+
|
80
|
+
|
81
|
+
Log
|
82
|
+
--------------
|
83
|
+
1.4.6
|
84
|
+
-------
|
85
|
+
- 修复 realtime_quote 实时盘口TICK快照(爬虫版)
|
86
|
+
- 修复dc OPEN和LOW 值相反问题
|
87
|
+
1.4.0
|
88
|
+
-------
|
89
|
+
- 增加 银河证券实时行情数据入口
|
90
|
+
1.3.9
|
91
|
+
-------
|
92
|
+
- realtime_quote 实时盘口TICK快照(爬虫版)
|
93
|
+
- 修复dc 指数和股票数据抓取问题
|
94
|
+
- 将数字类型统一转换成 float类型
|
95
|
+
1.2.73
|
96
|
+
-------
|
97
|
+
- 支持华泰实时数据15SECOND
|
98
|
+
|