akshare 1.16.62__py3-none-any.whl → 1.16.63__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.
- akshare/__init__.py +2 -1
- akshare/stock_feature/stock_board_concept_ths.py +44 -2
- akshare/stock_fundamental/stock_finance_us_em.py +44 -10
- {akshare-1.16.62.dist-info → akshare-1.16.63.dist-info}/METADATA +1 -1
- {akshare-1.16.62.dist-info → akshare-1.16.63.dist-info}/RECORD +8 -8
- {akshare-1.16.62.dist-info → akshare-1.16.63.dist-info}/WHEEL +0 -0
- {akshare-1.16.62.dist-info → akshare-1.16.63.dist-info}/licenses/LICENSE +0 -0
- {akshare-1.16.62.dist-info → akshare-1.16.63.dist-info}/top_level.txt +0 -0
akshare/__init__.py
CHANGED
@@ -3071,9 +3071,10 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
|
|
3071
3071
|
1.16.60 fix: fix stock_individual_fund_flow_rank interface
|
3072
3072
|
1.16.61 fix: fix stock_board_concept_index_ths interface
|
3073
3073
|
1.16.62 fix: fix stock_gdfx_free_holding_change_em interface
|
3074
|
+
1.16.63 fix: fix stock_board_concept_name_ths interface
|
3074
3075
|
"""
|
3075
3076
|
|
3076
|
-
__version__ = "1.16.
|
3077
|
+
__version__ = "1.16.63"
|
3077
3078
|
__author__ = "AKFamily"
|
3078
3079
|
|
3079
3080
|
import sys
|
@@ -1,11 +1,12 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
2
|
# -*- coding:utf-8 -*-
|
3
3
|
"""
|
4
|
-
Date: 2025/
|
4
|
+
Date: 2025/3/27 14:20
|
5
5
|
Desc: 同花顺-板块-概念板块
|
6
6
|
https://q.10jqka.com.cn/thshy/
|
7
7
|
"""
|
8
8
|
|
9
|
+
from typing import Dict
|
9
10
|
from datetime import datetime
|
10
11
|
from functools import lru_cache
|
11
12
|
from io import StringIO
|
@@ -62,6 +63,8 @@ def _get_stock_board_concept_name_ths() -> dict:
|
|
62
63
|
for item in soup.find(name="div", attrs={"class": "cate_inner"}).find_all("a")
|
63
64
|
]
|
64
65
|
name_code_map = dict(zip(name_list, code_list))
|
66
|
+
temp_dict = __stock_board_concept_summary_ths()
|
67
|
+
name_code_map.update(temp_dict)
|
65
68
|
return name_code_map
|
66
69
|
|
67
70
|
|
@@ -228,6 +231,45 @@ def stock_board_concept_index_ths(
|
|
228
231
|
return big_df
|
229
232
|
|
230
233
|
|
234
|
+
@lru_cache()
|
235
|
+
def __stock_board_concept_summary_ths() -> Dict:
|
236
|
+
"""
|
237
|
+
同花顺-数据中心-概念板块-概念时间表-辅助函数
|
238
|
+
https://q.10jqka.com.cn/gn/
|
239
|
+
:return: 概念时间表
|
240
|
+
:rtype: dict
|
241
|
+
"""
|
242
|
+
js_code = py_mini_racer.MiniRacer()
|
243
|
+
js_content = _get_file_content_ths("ths.js")
|
244
|
+
js_code.eval(js_content)
|
245
|
+
v_code = js_code.call("v")
|
246
|
+
headers = {
|
247
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
248
|
+
"Chrome/89.0.4389.90 Safari/537.36",
|
249
|
+
"Cookie": f"v={v_code}",
|
250
|
+
}
|
251
|
+
url = "http://q.10jqka.com.cn/gn/index/field/addtime/order/desc/page/1/ajax/1/"
|
252
|
+
r = requests.get(url, headers=headers)
|
253
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
254
|
+
page_num = soup.find(name="span", attrs={"class": "page_info"}).text.split("/")[1]
|
255
|
+
big_dict = dict()
|
256
|
+
tqdm = get_tqdm()
|
257
|
+
for page in tqdm(range(1, int(page_num) + 1), leave=False):
|
258
|
+
url = f"http://q.10jqka.com.cn/gn/index/field/addtime/order/desc/page/{page}/ajax/1/"
|
259
|
+
r = requests.get(url, headers=headers)
|
260
|
+
try:
|
261
|
+
soup = BeautifulSoup(r.text, features="lxml")
|
262
|
+
temp_dict = {
|
263
|
+
item.get_text(): item["href"].rsplit("/")[-2]
|
264
|
+
for item in soup.find_all(name="a")
|
265
|
+
if "detail" in item["href"]
|
266
|
+
}
|
267
|
+
big_dict.update(temp_dict)
|
268
|
+
except ValueError:
|
269
|
+
break
|
270
|
+
return big_dict
|
271
|
+
|
272
|
+
|
231
273
|
def stock_board_concept_summary_ths() -> pd.DataFrame:
|
232
274
|
"""
|
233
275
|
同花顺-数据中心-概念板块-概念时间表
|
@@ -273,7 +315,7 @@ if __name__ == "__main__":
|
|
273
315
|
print(stock_board_concept_info_ths_df)
|
274
316
|
|
275
317
|
stock_board_concept_index_ths_df = stock_board_concept_index_ths(
|
276
|
-
symbol="
|
318
|
+
symbol="DeepSeek概念", start_date="20200101", end_date="20250321"
|
277
319
|
)
|
278
320
|
print(stock_board_concept_index_ths_df)
|
279
321
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env python
|
2
2
|
# -*- coding:utf-8 -*-
|
3
3
|
"""
|
4
|
-
Date: 2025/3/
|
4
|
+
Date: 2025/3/27 14:00
|
5
5
|
Desc: 美股-基本面数据
|
6
6
|
https://emweb.eastmoney.com/PC_USF10/pages/index.html?code=TSLA&type=web&color=w#/cwfx
|
7
7
|
"""
|
@@ -12,12 +12,43 @@ import requests
|
|
12
12
|
from akshare.utils.cons import headers
|
13
13
|
|
14
14
|
|
15
|
+
def __stock_financial_us_report_query_market_em(symbol: str = "TSLA") -> str:
|
16
|
+
"""
|
17
|
+
东方财富-美股-财务分析-三大报表-查询市场
|
18
|
+
https://emweb.eastmoney.com/PC_USF10/pages/index.html?code=TSLA&type=web&color=w#/cwfx
|
19
|
+
:param symbol: choice of {"资产负债表", "综合损益表", "现金流量表"}
|
20
|
+
:type symbol: str
|
21
|
+
:return: 查询市场
|
22
|
+
:rtype: str
|
23
|
+
"""
|
24
|
+
url = "https://datacenter.eastmoney.com/securities/api/data/v1/get"
|
25
|
+
params = {
|
26
|
+
"reportName": "RPT_USF10_INFO_ORGPROFILE",
|
27
|
+
"columns": "SECUCODE,SECURITY_CODE,ORG_CODE,SECURITY_INNER_CODE,ORG_NAME,ORG_EN_ABBR,BELONG_INDUSTRY,"
|
28
|
+
"FOUND_DATE,CHAIRMAN,REG_PLACE,ADDRESS,EMP_NUM,ORG_TEL,ORG_FAX,ORG_EMAIL,ORG_WEB,ORG_PROFILE",
|
29
|
+
"quoteColumns": "",
|
30
|
+
"filter": f'(SECURITY_CODE="{symbol}")',
|
31
|
+
"pageNumber": "1",
|
32
|
+
"pageSize": "200",
|
33
|
+
"sortTypes": "",
|
34
|
+
"sortColumns": "",
|
35
|
+
"source": "SECURITIES",
|
36
|
+
"client": "PC",
|
37
|
+
"v": "04406064331266868",
|
38
|
+
}
|
39
|
+
|
40
|
+
r = requests.get(url, params=params)
|
41
|
+
data_json = r.json()
|
42
|
+
stock_code = data_json["result"]["data"][0]["SECUCODE"]
|
43
|
+
return stock_code
|
44
|
+
|
45
|
+
|
15
46
|
def __stock_financial_us_report_em(
|
16
47
|
stock: str = "TSLA", symbol: str = "综合损益表", indicator: str = "年报"
|
17
48
|
) -> str:
|
18
49
|
"""
|
19
50
|
东方财富-美股-财务分析-三大报表
|
20
|
-
https://emweb.
|
51
|
+
https://emweb.eastmoney.com/PC_USF10/pages/index.html?code=TSLA&type=web&color=w#/cwfx
|
21
52
|
:param stock: 股票代码
|
22
53
|
:type stock: str
|
23
54
|
:param symbol: choice of {"资产负债表", "综合损益表", "现金流量表"}
|
@@ -28,6 +59,7 @@ def __stock_financial_us_report_em(
|
|
28
59
|
:rtype: str
|
29
60
|
"""
|
30
61
|
url = "https://datacenter.eastmoney.com/securities/api/data/v1/get"
|
62
|
+
stock = __stock_financial_us_report_query_market_em(stock)
|
31
63
|
if symbol == "资产负债表":
|
32
64
|
report_name = "RPT_USF10_FN_BALANCE"
|
33
65
|
elif symbol == "综合损益表":
|
@@ -41,7 +73,7 @@ def __stock_financial_us_report_em(
|
|
41
73
|
"columns": "SECUCODE,SECURITY_CODE,SECURITY_NAME_ABBR,REPORT,REPORT_DATE,FISCAL_YEAR,CURRENCY,"
|
42
74
|
"ACCOUNT_STANDARD,REPORT_TYPE,DATE_TYPE_CODE",
|
43
75
|
"quoteColumns": "",
|
44
|
-
"filter": f'(SECUCODE="{stock}
|
76
|
+
"filter": f'(SECUCODE="{stock}")',
|
45
77
|
"pageNumber": "",
|
46
78
|
"pageSize": "",
|
47
79
|
"sortTypes": "-1",
|
@@ -77,7 +109,7 @@ def stock_financial_us_report_em(
|
|
77
109
|
) -> pd.DataFrame:
|
78
110
|
"""
|
79
111
|
东方财富-美股-财务分析-三大报表
|
80
|
-
https://emweb.
|
112
|
+
https://emweb.eastmoney.com/PC_USF10/pages/index.html?code=TSLA&type=web&color=w#/cwfx
|
81
113
|
:param stock: 股票代码
|
82
114
|
:type stock: str
|
83
115
|
:param symbol: choice of {"资产负债表", "综合损益表", "现金流量表"}
|
@@ -91,6 +123,7 @@ def stock_financial_us_report_em(
|
|
91
123
|
date_str = __stock_financial_us_report_em(
|
92
124
|
stock=stock, symbol=symbol, indicator=indicator
|
93
125
|
)
|
126
|
+
stock = __stock_financial_us_report_query_market_em(stock)
|
94
127
|
if symbol == "资产负债表":
|
95
128
|
report_name = "RPT_USF10_FN_BALANCE"
|
96
129
|
elif symbol == "综合损益表":
|
@@ -104,7 +137,7 @@ def stock_financial_us_report_em(
|
|
104
137
|
"columns": "SECUCODE,SECURITY_CODE,SECURITY_NAME_ABBR,REPORT_DATE,REPORT_TYPE,REPORT,"
|
105
138
|
"STD_ITEM_CODE,AMOUNT,ITEM_NAME",
|
106
139
|
"quoteColumns": "",
|
107
|
-
"filter": f'(SECUCODE="{stock}
|
140
|
+
"filter": f'(SECUCODE="{stock}")(REPORT in ' + date_str + ")",
|
108
141
|
"pageNumber": "",
|
109
142
|
"pageSize": "",
|
110
143
|
"sortTypes": "1,-1",
|
@@ -124,7 +157,7 @@ def stock_financial_us_analysis_indicator_em(
|
|
124
157
|
) -> pd.DataFrame:
|
125
158
|
"""
|
126
159
|
东方财富-美股-财务分析-主要指标
|
127
|
-
https://emweb.eastmoney.com/PC_USF10/pages/index.html?code=TSLA&type=web&color=w#/cwfx
|
160
|
+
https://emweb.eastmoney.com/PC_USF10/pages/index.html?code=TSLA&type=web&color=w#/cwfx
|
128
161
|
:param symbol: 股票代码
|
129
162
|
:type symbol: str
|
130
163
|
:param indicator: choice of {"年报", "单季报", "累计季报"}
|
@@ -133,6 +166,7 @@ def stock_financial_us_analysis_indicator_em(
|
|
133
166
|
:rtype: pandas.DataFrame
|
134
167
|
"""
|
135
168
|
url = "https://datacenter.eastmoney.com/securities/api/data/v1/get"
|
169
|
+
symbol = __stock_financial_us_report_query_market_em(symbol)
|
136
170
|
params = {
|
137
171
|
"reportName": "RPT_USF10_FN_GMAININDICATOR",
|
138
172
|
"columns": "USF10_FN_GMAININDICATOR",
|
@@ -146,16 +180,16 @@ def stock_financial_us_analysis_indicator_em(
|
|
146
180
|
"v": "01975982096513973",
|
147
181
|
}
|
148
182
|
if indicator == "年报":
|
149
|
-
params.update({"filter": f"""(SECUCODE="{symbol}
|
183
|
+
params.update({"filter": f"""(SECUCODE="{symbol}")(DATE_TYPE_CODE="001")"""})
|
150
184
|
elif indicator == "单季报":
|
151
185
|
params.update(
|
152
186
|
{
|
153
|
-
"filter": f"""(SECUCODE="{symbol}
|
187
|
+
"filter": f"""(SECUCODE="{symbol}")(DATE_TYPE_CODE in ("003","006","007","008"))"""
|
154
188
|
}
|
155
189
|
)
|
156
190
|
elif indicator == "累计季报":
|
157
191
|
params.update(
|
158
|
-
{"filter": f"""(SECUCODE="{symbol}
|
192
|
+
{"filter": f"""(SECUCODE="{symbol}")(DATE_TYPE_CODE in ("002","004"))"""}
|
159
193
|
)
|
160
194
|
else:
|
161
195
|
raise ValueError("请输入正确的 indicator 参数")
|
@@ -182,7 +216,7 @@ if __name__ == "__main__":
|
|
182
216
|
print(stock_financial_us_analysis_indicator_em_df)
|
183
217
|
|
184
218
|
stock_financial_us_report_em_df = stock_financial_us_report_em(
|
185
|
-
stock="
|
219
|
+
stock="BABA", symbol="资产负债表", indicator="年报"
|
186
220
|
)
|
187
221
|
print(stock_financial_us_report_em_df)
|
188
222
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
akshare/__init__.py,sha256=
|
1
|
+
akshare/__init__.py,sha256=ou7Fk2F4vfpfFYRCsSJ_s-Ylk9-ivvkr5YwKXDqvOL0,192265
|
2
2
|
akshare/datasets.py,sha256=rKuRNZrqi6IMsZ9nyvO3Rx02js0tH3zMLjz8HQNAoPQ,963
|
3
3
|
akshare/exceptions.py,sha256=WEJjIhSmJ_xXNW6grwV4nufE_cfmmyuhmueVGiN1VAg,878
|
4
4
|
akshare/request.py,sha256=HtFFf9MhfEibR-ETWe-1Tts6ELU4VKSqA-ghaXjegQM,4252
|
@@ -301,7 +301,7 @@ akshare/stock_feature/stock_a_pe_and_pb.py,sha256=9HfjTSL_DTlAVvv7o3--pOdZiFwhRz
|
|
301
301
|
akshare/stock_feature/stock_account_em.py,sha256=PA-531xnv5uerFrYGc40mk8q8O0DGciHC_XVlE9udis,3342
|
302
302
|
akshare/stock_feature/stock_all_pb.py,sha256=2yQLq03qXNbTB5AtJ-Q8uJldOluElH5zTjYneY3aaZ0,1194
|
303
303
|
akshare/stock_feature/stock_analyst_em.py,sha256=Md3_G-Px0O1lk4dx5dCEKl8Vjgwt79Sh-FSh_sW1Elo,9508
|
304
|
-
akshare/stock_feature/stock_board_concept_ths.py,sha256=
|
304
|
+
akshare/stock_feature/stock_board_concept_ths.py,sha256=SsJ_kPbs4v9Tge25GLe3LA-meN-c_E_nAGHF3Hfi0IY,11265
|
305
305
|
akshare/stock_feature/stock_board_industry_ths.py,sha256=c22JP9MJGncLaqvBmkAxHUz3HKNMCKf58Rug9n2vlAU,15102
|
306
306
|
akshare/stock_feature/stock_buffett_index_lg.py,sha256=NpNccHmGjtqLz6aUladB6InPzO2pjoImbgCgmNEYUuM,2027
|
307
307
|
akshare/stock_feature/stock_classify_sina.py,sha256=Lg7ROG5W9HioFRplJI2rZ6tAAHM09N3g9qF6kReIQYI,3210
|
@@ -367,7 +367,7 @@ akshare/stock_fundamental/stock_basic_info_xq.py,sha256=PJveGTe3NG5F5owYdLFbpC6e
|
|
367
367
|
akshare/stock_fundamental/stock_finance_hk_em.py,sha256=cCiaWX6ZyKe4W2H9qe-ttpMeVMWp6tHdvnjhRuYQhl8,7017
|
368
368
|
akshare/stock_fundamental/stock_finance_sina.py,sha256=432EjGHWFtG0L32PNSC_HWpVLDntabNt9koyUtNG77E,30718
|
369
369
|
akshare/stock_fundamental/stock_finance_ths.py,sha256=nS9bt_hzklzh7pBTCH1PjOa69OUcNZ41Z_zSHiz9Y1U,11527
|
370
|
-
akshare/stock_fundamental/stock_finance_us_em.py,sha256=
|
370
|
+
akshare/stock_fundamental/stock_finance_us_em.py,sha256=thRKe9OIfZFQ0q_kAM2kJXCKXGhyPFjHKiiGEK95K2g,9799
|
371
371
|
akshare/stock_fundamental/stock_hold.py,sha256=h8V5v_0YOi3FJPc1w95WBaO0v3n87lcufcUlu-i6XXk,5394
|
372
372
|
akshare/stock_fundamental/stock_ipo_declare.py,sha256=18j2542TT2nCJ1HWBcT6-HupRbXvesA30qqejknn-kM,1809
|
373
373
|
akshare/stock_fundamental/stock_kcb_detail_sse.py,sha256=MBanq3sDvb0OTbUl_gg7avDUQg_3Ugzqr43cB43fp60,940
|
@@ -392,10 +392,10 @@ akshare/utils/func.py,sha256=4cwmXFztU86yJNONJ40KJLvsIEQHBbct4iMm3zT2v30,2315
|
|
392
392
|
akshare/utils/multi_decrypt.py,sha256=aWoL2iEPeuXHJg8-n7OtMKixLnIhfzepACgxfrfmQB4,1657
|
393
393
|
akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOeQ,666
|
394
394
|
akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
|
395
|
-
akshare-1.16.
|
395
|
+
akshare-1.16.63.dist-info/licenses/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
|
396
396
|
tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
|
397
397
|
tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
|
398
|
-
akshare-1.16.
|
399
|
-
akshare-1.16.
|
400
|
-
akshare-1.16.
|
401
|
-
akshare-1.16.
|
398
|
+
akshare-1.16.63.dist-info/METADATA,sha256=orbPq4oAuVnI83DaiTTyzMfCRFRBIc2SFFV5FZ2mfSs,13767
|
399
|
+
akshare-1.16.63.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
400
|
+
akshare-1.16.63.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
|
401
|
+
akshare-1.16.63.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|