tushare 1.4.12__py3-none-any.whl → 1.4.14__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/llm.py +34 -40
- tushare/stock/rtq.py +22 -22
- tushare/subs/model/tick.py +128 -128
- tushare/subs/ts_subs/subscribe.py +19 -3
- {tushare-1.4.12.dist-info → tushare-1.4.14.dist-info}/METADATA +6 -1
- {tushare-1.4.12.dist-info → tushare-1.4.14.dist-info}/RECORD +10 -10
- {tushare-1.4.12.dist-info → tushare-1.4.14.dist-info}/WHEEL +1 -1
- {tushare-1.4.12.dist-info → tushare-1.4.14.dist-info}/LICENSE +0 -0
- {tushare-1.4.12.dist-info → tushare-1.4.14.dist-info}/top_level.txt +0 -0
tushare/__init__.py
CHANGED
tushare/pro/llm.py
CHANGED
@@ -10,18 +10,18 @@ except:
|
|
10
10
|
from tushare import get_token
|
11
11
|
|
12
12
|
BASE_URL = "http://api.waditu.com/dataapi"
|
13
|
-
# BASE_URL = "http://
|
13
|
+
# BASE_URL = "http://10.255.255.205:8083/dataapi"
|
14
14
|
API_KEY_PREFIX = "tsgpt-"
|
15
15
|
|
16
16
|
|
17
|
-
class
|
17
|
+
class GPTClient:
|
18
18
|
def __init__(self, token=None, timetout=120):
|
19
19
|
if not token:
|
20
20
|
token = get_token()
|
21
21
|
self.token = token
|
22
22
|
self.timeout = timetout
|
23
23
|
|
24
|
-
def
|
24
|
+
def _request(self, model, messages, temperature=None, max_tokens=None, stream=True, pretty=False) -> requests.Response:
|
25
25
|
"""
|
26
26
|
model string 模型名称, doubao-pro-128k
|
27
27
|
messages list 消息列表
|
@@ -36,76 +36,64 @@ class LlmClient:
|
|
36
36
|
resp = requests.post(
|
37
37
|
f'{BASE_URL}/llm/{model}',
|
38
38
|
json={"params": {
|
39
|
-
"stream":
|
39
|
+
"stream": stream,
|
40
40
|
"messages": messages,
|
41
41
|
"temperature": temperature,
|
42
42
|
"max_tokens": max_tokens
|
43
43
|
}},
|
44
44
|
headers={"Authorization": f"tstoken-{self.token}"},
|
45
|
-
timeout=self.timeout
|
45
|
+
timeout=self.timeout, stream=stream
|
46
46
|
)
|
47
47
|
if resp.status_code != 200:
|
48
48
|
raise Exception(f"请求出现错误,{resp.content}")
|
49
|
+
return resp
|
49
50
|
|
51
|
+
def gpt_query(self, model, messages, temperature=None, max_tokens=None, pretty=False):
|
52
|
+
resp = self._request(model, messages, temperature, max_tokens, False, pretty)
|
50
53
|
resp_data = resp.json()
|
51
54
|
if resp_data.get('code') not in (0, None):
|
52
|
-
raise Exception(resp_data
|
55
|
+
raise Exception(resp_data.get('msg') or resp_data)
|
53
56
|
if pretty:
|
54
57
|
return resp_data['choices'][0]["message"]["content"]
|
55
58
|
else:
|
56
59
|
return resp_data
|
57
60
|
|
58
|
-
def
|
59
|
-
|
60
|
-
model string 模型名称, doubao-pro-128k
|
61
|
-
messages list 消息列表
|
62
|
-
[
|
63
|
-
{
|
64
|
-
"role": "user",
|
65
|
-
"content": "Hello World"
|
66
|
-
}
|
67
|
-
]
|
68
|
-
pretty bool 是否只返回回答内容文本
|
69
|
-
"""
|
70
|
-
resp = requests.post(
|
71
|
-
f'{BASE_URL}/llm/{model}',
|
72
|
-
json={"params": {
|
73
|
-
"stream": True,
|
74
|
-
"messages": messages,
|
75
|
-
"temperature": temperature,
|
76
|
-
"max_tokens": max_tokens
|
77
|
-
}},
|
78
|
-
headers={"Authorization": f"tstoken-{self.token}"},
|
79
|
-
timeout=self.timeout, stream=True
|
80
|
-
)
|
81
|
-
if resp.status_code != 200:
|
82
|
-
raise Exception(f"请求出现错误,{resp.content}")
|
83
|
-
|
61
|
+
def gpt_stream(self, model, messages, temperature=None, max_tokens=None, pretty=False):
|
62
|
+
resp = self._request(model, messages, temperature, max_tokens, True, pretty)
|
84
63
|
for e in sseclient.SSEClient(resp).events():
|
64
|
+
if '[DONE]' in e.data.upper():
|
65
|
+
break
|
85
66
|
e_data = json.loads(e.data)
|
86
67
|
if pretty:
|
87
68
|
yield e_data["choices"][0]["delta"]["content"]
|
88
69
|
else:
|
89
70
|
yield e_data
|
90
71
|
|
72
|
+
def gpt(self, model, query) -> str:
|
73
|
+
messages = [{
|
74
|
+
"role": "user",
|
75
|
+
"content": query
|
76
|
+
}]
|
77
|
+
return self.gpt_query(model, messages, pretty=True)
|
78
|
+
|
91
79
|
|
92
|
-
def
|
93
|
-
c =
|
94
|
-
dd = c.
|
80
|
+
def test_gpt_query():
|
81
|
+
c = GPTClient()
|
82
|
+
dd = c.gpt_query("doubao-pro-128k", [{
|
95
83
|
"role": "user",
|
96
84
|
"content": "你好"
|
97
85
|
}])
|
98
86
|
print(dd)
|
99
|
-
dd = c.
|
87
|
+
dd = c.gpt_query("doubao-pro-128k", [{
|
100
88
|
"role": "user",
|
101
89
|
"content": "你好"
|
102
90
|
}], pretty=True)
|
103
91
|
print(dd)
|
104
92
|
|
105
93
|
|
106
|
-
def
|
107
|
-
c =
|
108
|
-
dd = c.
|
94
|
+
def test_gpt_stream():
|
95
|
+
c = GPTClient()
|
96
|
+
dd = c.gpt_stream("doubao-pro-128k", [
|
109
97
|
{
|
110
98
|
"role": "user",
|
111
99
|
"content": "你好"
|
@@ -114,7 +102,7 @@ def test_chart_stream():
|
|
114
102
|
for d in dd:
|
115
103
|
print(d)
|
116
104
|
|
117
|
-
dd = c.
|
105
|
+
dd = c.gpt_stream("doubao-pro-128k", [
|
118
106
|
{
|
119
107
|
"role": "user",
|
120
108
|
"content": "你好"
|
@@ -122,3 +110,9 @@ def test_chart_stream():
|
|
122
110
|
], pretty=True)
|
123
111
|
for d in dd:
|
124
112
|
print(d)
|
113
|
+
|
114
|
+
|
115
|
+
def test_gpt():
|
116
|
+
c = GPTClient()
|
117
|
+
dd = c.gpt("doubao-pro-128k", "你好")
|
118
|
+
print(dd)
|
tushare/stock/rtq.py
CHANGED
@@ -173,7 +173,7 @@ def realtime_list(src: Optional[str] = None, interval: Optional[int] = 3,
|
|
173
173
|
东方财富:
|
174
174
|
2、代码:TS_CODE
|
175
175
|
3、名称:NAME
|
176
|
-
4、最新价:
|
176
|
+
4、最新价:CLOSE
|
177
177
|
5、涨跌幅:PCT_CHANGE
|
178
178
|
6、涨跌额:CHANGE
|
179
179
|
7、成交量:VOLUME
|
@@ -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、昨收:
|
185
|
+
13、昨收:PRE_CLOSE
|
186
186
|
14、量比:VOL_RATIO
|
187
187
|
15、换手率:TURNOVER_RATE
|
188
188
|
16、市盈率-动态:PE
|
@@ -196,12 +196,12 @@ def realtime_list(src: Optional[str] = None, interval: Optional[int] = 3,
|
|
196
196
|
新浪财经:
|
197
197
|
1、代码:TS_CODE
|
198
198
|
2、名称:NAME
|
199
|
-
3、最新价:
|
199
|
+
3、最新价:CLOSE
|
200
200
|
4、涨跌额:CHANGE
|
201
201
|
5、涨跌幅:PCT_CHANGE
|
202
202
|
6、买入:BUY
|
203
203
|
7、卖出:SALE
|
204
|
-
8、昨收:
|
204
|
+
8、昨收:PRE_CLOSE
|
205
205
|
9、今开:OPEN
|
206
206
|
10、最高:HIGH
|
207
207
|
11、最低:LOW
|
@@ -359,7 +359,7 @@ def get_stock_all_a_dc(page_count: Optional[int] = None,
|
|
359
359
|
# "RANK",
|
360
360
|
"TS_CODE",
|
361
361
|
"NAME",
|
362
|
-
"
|
362
|
+
"CLOSE",
|
363
363
|
"PCT_CHANGE",
|
364
364
|
"CHANGE",
|
365
365
|
"VOLUME",
|
@@ -368,7 +368,7 @@ def get_stock_all_a_dc(page_count: Optional[int] = None,
|
|
368
368
|
"HIGH",
|
369
369
|
"LOW",
|
370
370
|
"OPEN",
|
371
|
-
"
|
371
|
+
"PRE_CLOSE",
|
372
372
|
"VOL_RATIO",
|
373
373
|
"TURNOVER_RATE",
|
374
374
|
"PE",
|
@@ -381,8 +381,8 @@ def get_stock_all_a_dc(page_count: Optional[int] = None,
|
|
381
381
|
"1YEAR",
|
382
382
|
]
|
383
383
|
# 指定要转换为 float 类型的列
|
384
|
-
cols_to_convert = ['
|
385
|
-
'HIGH', "LOW", "OPEN", "
|
384
|
+
cols_to_convert = ['CLOSE', 'PCT_CHANGE', 'CHANGE', "VOLUME", "AMOUNT", "SWING",
|
385
|
+
'HIGH', "LOW", "OPEN", "PRE_CLOSE", "VOL_RATIO", "TURNOVER_RATE", "PE", "PB", "TOTAL_MV", "FLOAT_MV",
|
386
386
|
"RISE", "5MIN", "60DAY", "1YEAR"
|
387
387
|
]
|
388
388
|
# 使用 to_numeric() 方法将指定的列转换为 float 类型,并将非数值类型的数据转换为 NaN
|
@@ -420,12 +420,12 @@ def get_stock_all_a_sina(interval: Optional[int] = 3, page_count: Optional[int]
|
|
420
420
|
:rtype: pandas.DataFrame
|
421
421
|
1、代码:TS_CODE
|
422
422
|
2、名称:NAME
|
423
|
-
3、最新价:
|
423
|
+
3、最新价:CLOSE
|
424
424
|
4、涨跌额:CHANGE
|
425
425
|
5、涨跌幅:PCT_CHANGE
|
426
426
|
6、买入:BUY
|
427
427
|
7、卖出:SALE
|
428
|
-
8、昨收:
|
428
|
+
8、昨收:PRE_CLOSE
|
429
429
|
9、今开:OPEN
|
430
430
|
10、最高:HIGH
|
431
431
|
11、最低:LOW
|
@@ -519,12 +519,12 @@ def get_stock_all_a_sina(interval: Optional[int] = 3, page_count: Optional[int]
|
|
519
519
|
big_df.columns = [
|
520
520
|
"TS_CODE",
|
521
521
|
"NAME",
|
522
|
-
"
|
522
|
+
"CLOSE",
|
523
523
|
"CHANGE",
|
524
524
|
"PCT_CHANGE",
|
525
525
|
"BUY",
|
526
526
|
"SALE",
|
527
|
-
"
|
527
|
+
"PRE_CLOSE",
|
528
528
|
"OPEN",
|
529
529
|
"HIGH",
|
530
530
|
"LOW",
|
@@ -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
|
-
|
640
|
-
# print(df)
|
641
|
-
ts_code = '399005.SZ'
|
642
|
-
ts_code = '000001.SZ'
|
643
|
-
# ts_code = '836149.BJ'
|
644
|
-
# ts_code = '600000.SH'
|
645
|
-
# ts_code = '000001.SH'
|
646
|
-
# ts_code = '000010.SH'
|
647
|
-
ts_code = '688111.SH'
|
648
|
-
df = realtime_quote(src="dc", ts_code=ts_code)
|
639
|
+
df = realtime_list(src="sina", page_count=1)
|
649
640
|
print(df)
|
641
|
+
# ts_code = '399005.SZ'
|
642
|
+
# ts_code = '000001.SZ'
|
643
|
+
# # ts_code = '836149.BJ'
|
644
|
+
# # ts_code = '600000.SH'
|
645
|
+
# # ts_code = '000001.SH'
|
646
|
+
# # ts_code = '000010.SH'
|
647
|
+
# ts_code = '688111.SH'
|
648
|
+
# df = realtime_quote(src="dc", ts_code=ts_code)
|
649
|
+
# print(df)
|
650
650
|
|
651
651
|
|
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]
|
@@ -176,11 +176,27 @@ class TsSubscribe(object):
|
|
176
176
|
p.start()
|
177
177
|
|
178
178
|
|
179
|
-
def
|
179
|
+
def test_min():
|
180
|
+
app = TsSubscribe("xxx")
|
181
|
+
|
182
|
+
# code 可以包含 * (通配符)
|
183
|
+
@app.register(topic='HQ_STK_MIN', codes=["1MIN:*.SH"])
|
184
|
+
def print_message(record):
|
185
|
+
"""
|
186
|
+
订阅主题topic,并指定codes列表,在接收到topic的推送消息时,符合code条件,就会执行回调
|
187
|
+
:param record:
|
188
|
+
:return:
|
189
|
+
"""
|
190
|
+
print('用户定义业务代码输出 print_message(%s)' % str(record))
|
191
|
+
|
192
|
+
app.run()
|
193
|
+
|
194
|
+
|
195
|
+
def test_tick():
|
180
196
|
app = TsSubscribe(token='xxx')
|
181
197
|
|
182
198
|
# code 可以包含 * (通配符)
|
183
|
-
@app.register(topic='
|
199
|
+
@app.register(topic='HQ_STK_TICK', codes=["*.SH"])
|
184
200
|
def print_message(record):
|
185
201
|
"""
|
186
202
|
订阅主题topic,并指定codes列表,在接收到topic的推送消息时,符合code条件,就会执行回调
|
@@ -193,4 +209,4 @@ def test():
|
|
193
209
|
|
194
210
|
|
195
211
|
if __name__ == '__main__':
|
196
|
-
|
212
|
+
test_min()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: tushare
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.14
|
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,11 @@ return::
|
|
80
80
|
|
81
81
|
Log
|
82
82
|
--------------
|
83
|
+
1.4.14
|
84
|
+
-------
|
85
|
+
- 修复 realtime_list (爬虫版)
|
86
|
+
- 修复dc CLOSE和PRE_CLOSE收盘和昨收 字段命名问题
|
87
|
+
-------
|
83
88
|
1.4.6
|
84
89
|
-------
|
85
90
|
- 修复 realtime_quote 实时盘口TICK快照(爬虫版)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
tushare/__init__.py,sha256=
|
1
|
+
tushare/__init__.py,sha256=qwKDSMvh3WbshnQP2JjgCyIzZZb874LlAvhB9VAYlm4,4765
|
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
|
@@ -19,7 +19,7 @@ tushare/internet/indexes.py,sha256=oteQCv0k2X0pbhXRHwMSviD1AowJWE6xRjKkqr5RNCo,3
|
|
19
19
|
tushare/pro/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
tushare/pro/client.py,sha256=w7LfXtlmSd4Aiq7Bz5-tPFfkfjrPS_7jroUiRs7BUWw,1388
|
21
21
|
tushare/pro/data_pro.py,sha256=SOHbK-j9CmZguuv0CLIT-Z3hUynEy96mbvvhrGN6y9I,10883
|
22
|
-
tushare/pro/llm.py,sha256=
|
22
|
+
tushare/pro/llm.py,sha256=Zdb81mhr9lQKX6p-JDml7THSbmBm8NmFQT54B8FkgvI,3444
|
23
23
|
tushare/stock/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
tushare/stock/billboard.py,sha256=vCrbN7-NGXSpXMc8jq7NcjjHyu9pTcr4uXp559iA1wA,12833
|
25
25
|
tushare/stock/classifying.py,sha256=3yWqlLhgj2irk-9ksKWFFS5HY-SnjfEr5erwJxBidG8,10539
|
@@ -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=
|
38
|
+
tushare/stock/rtq.py,sha256=28HBzyrJ2VwP93_9edkLBWgllezgrUJoS_WZc6RYFgA,23161
|
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
|
@@ -45,13 +45,13 @@ tushare/subs/ht_subs/covert.py,sha256=d25f86D_4CHjrX3IGh8JtTSb7VI2Da506FHwlhOhk1
|
|
45
45
|
tushare/subs/ht_subs/subscribe.py,sha256=yYnPeg7c0OHbIJhEf4bXFMLbQ4H1bHhApDPrHeTimuw,8340
|
46
46
|
tushare/subs/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
47
47
|
tushare/subs/model/min.py,sha256=-AYBGOM1U8IB7Q6SPHS0tpoWN3qz1hngCw7k5x2HhUU,375
|
48
|
-
tushare/subs/model/tick.py,sha256=
|
48
|
+
tushare/subs/model/tick.py,sha256=yaYMJY42_IPjViY4v0aMyNahXfpBE_m2dcz3obm8Y94,4339
|
49
49
|
tushare/subs/tgw_subs/__init__.py,sha256=30AFeIgTci0HLNyZTNpr1wRChrVdvpD2dHNKS4Q-fS0,69
|
50
50
|
tushare/subs/tgw_subs/convert.py,sha256=VWsDOv_rmz3a9YjQ-ZThXerc1HqcWPlBYAOF6A9SqjQ,5474
|
51
51
|
tushare/subs/tgw_subs/login.py,sha256=z7laiscTx50LzOB0cM2hypv5E78DvWx-2Ip5kDE7uNk,903
|
52
52
|
tushare/subs/tgw_subs/subscribe.py,sha256=OwLKcSTN2xrge33hBkio_S188viMeGuicDj_x0VaR2A,3336
|
53
53
|
tushare/subs/ts_subs/__init__.py,sha256=AyX957j8DDjdpIYcNR7dyRaMfxusa6d2VeunMEB6RAc,107
|
54
|
-
tushare/subs/ts_subs/subscribe.py,sha256=
|
54
|
+
tushare/subs/ts_subs/subscribe.py,sha256=3akQj5IDANatYOBFYSKotigKviAf5N8SNO_ZVx8pBR0,6701
|
55
55
|
tushare/trader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
56
56
|
tushare/trader/trader.py,sha256=O2WJkIKGuUFK_hiQj83N5j971VW-TNAgKaCE0O4oFwg,11360
|
57
57
|
tushare/trader/utils.py,sha256=CG-TCyeu5WqYjnBARxft2lEnLD3xvhHLU40hPSL_CCw,752
|
@@ -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.
|
76
|
-
tushare-1.4.
|
77
|
-
tushare-1.4.
|
78
|
-
tushare-1.4.
|
79
|
-
tushare-1.4.
|
75
|
+
tushare-1.4.14.dist-info/LICENSE,sha256=C2j55UI0Ul-1-wA1-rn7OaY6b3vGl4YukiyvYzHsU9o,1503
|
76
|
+
tushare-1.4.14.dist-info/METADATA,sha256=PGllEt0zdEDeMGkUIYJjbbdq4rhfDrkfiMQGyPdbg84,2965
|
77
|
+
tushare-1.4.14.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
78
|
+
tushare-1.4.14.dist-info/top_level.txt,sha256=HHOxMuqc31KuAIcxpE0t5dAPMKbaiRtjsjTMFd7FlXI,8
|
79
|
+
tushare-1.4.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|