chinadata 0.2.2__py3-none-any.whl → 0.2.3__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.
- chinadata/ca_data.py +9 -8
- chinadata/example.py +3 -11
- {chinadata-0.2.2.dist-info → chinadata-0.2.3.dist-info}/METADATA +1 -2
- chinadata-0.2.3.dist-info/RECORD +7 -0
- {chinadata-0.2.2.dist-info → chinadata-0.2.3.dist-info}/WHEEL +1 -1
- chinadata-0.2.2.dist-info/RECORD +0 -7
- {chinadata-0.2.2.dist-info → chinadata-0.2.3.dist-info}/top_level.txt +0 -0
chinadata/ca_data.py
CHANGED
|
@@ -41,7 +41,7 @@ class pro_api:
|
|
|
41
41
|
pd.DataFrame: A DataFrame containing the fetched stock data.
|
|
42
42
|
"""
|
|
43
43
|
# url="http://127.0.0.1:9002/tq"
|
|
44
|
-
url = "http://
|
|
44
|
+
url = "http://120.53.122.167:9002/tq"
|
|
45
45
|
|
|
46
46
|
params = {
|
|
47
47
|
'token': get_token(),
|
|
@@ -52,8 +52,8 @@ class pro_api:
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
response = requests.post(url, json=params)
|
|
56
55
|
|
|
56
|
+
response = requests.post(url, json=params)
|
|
57
57
|
|
|
58
58
|
if response.status_code == 200:
|
|
59
59
|
try:
|
|
@@ -69,6 +69,8 @@ class pro_api:
|
|
|
69
69
|
raise ValueError("数据获取错误",e)
|
|
70
70
|
|
|
71
71
|
else:
|
|
72
|
+
# print(f"Failed to fetch data. Status code: {response.status_code}")
|
|
73
|
+
# print(response.text)
|
|
72
74
|
raise ValueError("数据获取错误",response.status_code,response.text)
|
|
73
75
|
|
|
74
76
|
|
|
@@ -441,10 +443,11 @@ class pro_api:
|
|
|
441
443
|
|
|
442
444
|
def index_global(self, api_name='index_global', **kwargs):
|
|
443
445
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
446
|
+
|
|
444
447
|
def idx_factor_pro(self, api_name='idx_factor_pro', **kwargs):
|
|
445
448
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
446
|
-
|
|
447
|
-
|
|
449
|
+
def fund_factor_pro(self, api_name='fund_factor_pro', **kwargs):
|
|
450
|
+
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
448
451
|
|
|
449
452
|
def ncov_global(self, api_name='ncov_global', **kwargs):
|
|
450
453
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
@@ -613,6 +616,7 @@ class pro_api:
|
|
|
613
616
|
def ft_mins(self, api_name='ft_mins', **kwargs):
|
|
614
617
|
return '此接口为单独权限,和积分没有关系,需要单独购买'
|
|
615
618
|
|
|
619
|
+
|
|
616
620
|
def realtime_quote(self, api_name='realtime_quote', **kwargs):
|
|
617
621
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
618
622
|
|
|
@@ -712,13 +716,10 @@ class pro_api:
|
|
|
712
716
|
|
|
713
717
|
def stk_auction_c(self, api_name='stk_auction_c', **kwargs):
|
|
714
718
|
return '此接口为单独权限,和积分没有关系,需要单独购买'
|
|
715
|
-
|
|
716
719
|
def stk_auction(self, api_name='stk_auction', **kwargs):
|
|
717
720
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
718
|
-
|
|
719
721
|
def ft_limit(self, api_name='ft_limit', **kwargs):
|
|
720
722
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
721
|
-
|
|
722
723
|
def irm_qa_sh(self, api_name='irm_qa_sh', **kwargs):
|
|
723
724
|
return self.query(token=self.token, api_name=api_name, **kwargs)
|
|
724
725
|
|
|
@@ -790,7 +791,7 @@ def pro_bar(ts_code='', api=None, start_date='', end_date='', freq='D', asset='E
|
|
|
790
791
|
|
|
791
792
|
"""
|
|
792
793
|
# url = "http://127.0.0.1:9002/tp"
|
|
793
|
-
url = "http://
|
|
794
|
+
url = "http://120.53.122.167:9002/tp"
|
|
794
795
|
|
|
795
796
|
params = {
|
|
796
797
|
'token':get_token(),
|
chinadata/example.py
CHANGED
|
@@ -4,30 +4,22 @@
|
|
|
4
4
|
pip install chinadata
|
|
5
5
|
|
|
6
6
|
"""
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
#2、
|
|
10
8
|
import chinadata.ca_data as ts
|
|
11
9
|
|
|
12
10
|
|
|
13
|
-
ts.set_token('
|
|
14
|
-
pro=ts.pro_api('
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# 你要测量的代码块
|
|
11
|
+
ts.set_token('5821074c7482c04e8d39da5c8313')
|
|
12
|
+
pro=ts.pro_api('d55821074c7482c04e8d39da5c8313')
|
|
19
13
|
|
|
20
14
|
# #查询当前所有正常上市交易的股票列表
|
|
21
15
|
data = pro.stock_basic(exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date')
|
|
22
16
|
print(data)
|
|
23
|
-
|
|
17
|
+
#
|
|
24
18
|
#
|
|
25
19
|
df = ts.pro_bar(ts_code='000007.SZ', start_date='20240817', end_date='20241215')
|
|
26
20
|
print(df)
|
|
27
21
|
|
|
28
|
-
|
|
29
22
|
df = pro.daily(ts_code='000001.SZ', start_date='20000701', end_date='20180718')
|
|
30
23
|
print(df)
|
|
31
24
|
|
|
32
25
|
|
|
33
|
-
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
chinadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
chinadata/ca_data.py,sha256=bvP7Pw_fJwiWwPsLqqJ-GYOJosuBHDoA78MSmAGoowI,35425
|
|
3
|
+
chinadata/example.py,sha256=eKj2Hl5KVq9EJGWVY2ZoRJOqZ-p4yiSoFI-xVzdf8LA,575
|
|
4
|
+
chinadata-0.2.3.dist-info/METADATA,sha256=7fLH7XCtZHPU04RZ6SUOf_jPsIQYx28NUDrxb5IFBUM,161
|
|
5
|
+
chinadata-0.2.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
6
|
+
chinadata-0.2.3.dist-info/top_level.txt,sha256=Ptxvu9uzRHP4kVGRf413KuwSvsY2mk_KgQJ6ssWwisU,10
|
|
7
|
+
chinadata-0.2.3.dist-info/RECORD,,
|
chinadata-0.2.2.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
chinadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
chinadata/ca_data.py,sha256=HtARq1khasWxCU0C73Q0UFEMwbYgjd7h1Ih_RTHRa-c,35166
|
|
3
|
-
chinadata/example.py,sha256=x2veHR97H3ym1ekSc7Kfi1v4RrH7M-d1mm2oqXWEM08,613
|
|
4
|
-
chinadata-0.2.2.dist-info/METADATA,sha256=RXn8Yngx_--dHM4WUQgqbae8YZ-9QFSACxC736CJ6uE,163
|
|
5
|
-
chinadata-0.2.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
6
|
-
chinadata-0.2.2.dist-info/top_level.txt,sha256=Ptxvu9uzRHP4kVGRf413KuwSvsY2mk_KgQJ6ssWwisU,10
|
|
7
|
-
chinadata-0.2.2.dist-info/RECORD,,
|
|
File without changes
|