akshare 1.17.72__py3-none-any.whl → 1.17.74__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.
Potentially problematic release.
This version of akshare might be problematic. Click here for more details.
- akshare/__init__.py +3 -1
- akshare/futures/cot.py +11 -30
- akshare/futures/futures_warehouse_receipt.py +2 -0
- akshare/futures/receipt.py +22 -20
- akshare/stock/cons.py +2 -2
- {akshare-1.17.72.dist-info → akshare-1.17.74.dist-info}/METADATA +1 -1
- {akshare-1.17.72.dist-info → akshare-1.17.74.dist-info}/RECORD +10 -10
- {akshare-1.17.72.dist-info → akshare-1.17.74.dist-info}/WHEEL +0 -0
- {akshare-1.17.72.dist-info → akshare-1.17.74.dist-info}/licenses/LICENSE +0 -0
- {akshare-1.17.72.dist-info → akshare-1.17.74.dist-info}/top_level.txt +0 -0
akshare/__init__.py
CHANGED
|
@@ -3179,9 +3179,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
|
|
|
3179
3179
|
1.17.70 fix: fix macro_stock_finance interface
|
|
3180
3180
|
1.17.71 fix: fix futures_inventory_99 interface
|
|
3181
3181
|
1.17.72 fix: fix futures_warehouse_receipt_dce interface
|
|
3182
|
+
1.17.73 fix: fix get_receipt interface
|
|
3183
|
+
1.17.74 fix: fix futures_dce_position_rank interface
|
|
3182
3184
|
"""
|
|
3183
3185
|
|
|
3184
|
-
__version__ = "1.17.
|
|
3186
|
+
__version__ = "1.17.74"
|
|
3185
3187
|
__author__ = "AKFamily"
|
|
3186
3188
|
|
|
3187
3189
|
import sys
|
akshare/futures/cot.py
CHANGED
|
@@ -99,7 +99,7 @@ def get_rank_sum_daily(
|
|
|
99
99
|
f"{start_day.strftime('%Y-%m-%d')}日交易所数据连接失败,已超过20次,您的地址被网站墙了,请保存好返回数据,稍后从该日期起重试"
|
|
100
100
|
)
|
|
101
101
|
return records.reset_index(drop=True)
|
|
102
|
-
records = pd.concat([records, data], ignore_index=True)
|
|
102
|
+
records = pd.concat(objs=[records, data], ignore_index=True)
|
|
103
103
|
else:
|
|
104
104
|
warnings.warn(f"{start_day.strftime('%Y%m%d')}非交易日")
|
|
105
105
|
start_day += datetime.timedelta(days=1)
|
|
@@ -826,40 +826,21 @@ def futures_dce_position_rank(
|
|
|
826
826
|
if date.strftime("%Y%m%d") not in calendar:
|
|
827
827
|
warnings.warn("%s非交易日" % date.strftime("%Y%m%d"))
|
|
828
828
|
return {}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;"
|
|
832
|
-
"q=0.8,application/signed-exchange;v=b3;q=0.9",
|
|
833
|
-
"Accept-Encoding": "gzip, deflate",
|
|
834
|
-
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
|
|
835
|
-
"Cache-Control": "no-cache",
|
|
836
|
-
"Connection": "keep-alive",
|
|
837
|
-
"Content-Length": "160",
|
|
838
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
839
|
-
"Host": "www.dce.com.cn",
|
|
840
|
-
"Origin": "http://portal.dce.com.cn",
|
|
841
|
-
"Pragma": "no-cache",
|
|
842
|
-
"Referer": "http://portal.dce.com.cn/publicweb/quotesdata/memberDealPosiQuotes.html",
|
|
843
|
-
"Upgrade-Insecure-Requests": "1",
|
|
844
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
845
|
-
"Chrome/81.0.4044.138 Safari/537.36",
|
|
846
|
-
}
|
|
829
|
+
date_str = date.strftime("%Y%m%d")
|
|
830
|
+
url = "http://www.dce.com.cn/dcereport/publicweb/dailystat/memberDealPosi/batchDownload"
|
|
847
831
|
payload = {
|
|
848
|
-
"
|
|
849
|
-
"
|
|
850
|
-
"
|
|
851
|
-
"
|
|
852
|
-
"
|
|
853
|
-
"month": date.month - 1,
|
|
854
|
-
"day": str(date.day).zfill(2),
|
|
855
|
-
"batchExportFlag": "batch",
|
|
832
|
+
"tradeDate": date_str,
|
|
833
|
+
"varietyId": "a",
|
|
834
|
+
"contractId": "a2601",
|
|
835
|
+
"tradeType": "1",
|
|
836
|
+
"lang": "zh",
|
|
856
837
|
}
|
|
857
|
-
r = requests.post(url, payload
|
|
838
|
+
r = requests.post(url, json=payload)
|
|
858
839
|
big_dict = dict()
|
|
859
840
|
with zipfile.ZipFile(BytesIO(r.content), mode="r") as z:
|
|
860
841
|
for i in z.namelist():
|
|
861
|
-
file_name = i
|
|
862
|
-
if not file_name.startswith(
|
|
842
|
+
file_name = i
|
|
843
|
+
if not file_name.startswith(date_str):
|
|
863
844
|
continue
|
|
864
845
|
try:
|
|
865
846
|
data = pd.read_table(z.open(i), header=None, sep="\t")
|
|
@@ -29,6 +29,8 @@ def futures_czce_warehouse_receipt(date: str = "20200702") -> dict:
|
|
|
29
29
|
:return: 指定日期的仓单日报数据
|
|
30
30
|
:rtype: dict
|
|
31
31
|
"""
|
|
32
|
+
import urllib3
|
|
33
|
+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
32
34
|
url = f"http://www.czce.com.cn/cn/DFSStaticFiles/Future/{date[:4]}/{date}/FutureDataWhsheet.xls"
|
|
33
35
|
headers = {
|
|
34
36
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
akshare/futures/receipt.py
CHANGED
|
@@ -37,7 +37,7 @@ shfe_20101029 = pd.DataFrame(
|
|
|
37
37
|
def get_dce_receipt(date: str = None, vars_list: List = cons.contract_symbols):
|
|
38
38
|
"""
|
|
39
39
|
大连商品交易所-注册仓单数据
|
|
40
|
-
|
|
40
|
+
http://www.dce.com.cn/dce/channel/list/187.html
|
|
41
41
|
:param date: 开始日期: YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象, 为空时为当天
|
|
42
42
|
:type date: str
|
|
43
43
|
:param vars_list: 合约品种如 RB, AL等列表, 为空时为所有商品数据从 20060106开始,每周五更新仓单数据。直到20090407起,每交易日都更新仓单数据
|
|
@@ -51,24 +51,23 @@ def get_dce_receipt(date: str = None, vars_list: List = cons.contract_symbols):
|
|
|
51
51
|
if date.strftime("%Y%m%d") not in calendar:
|
|
52
52
|
warnings.warn(f"{date.strftime('%Y%m%d')}非交易日")
|
|
53
53
|
return None
|
|
54
|
+
url = "http://www.dce.com.cn/dcereport/publicweb/dailystat/wbillWeeklyQuotes"
|
|
54
55
|
payload = {
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"month": date.month - 1, # 网站月份描述少 1 个月, 属于网站问题
|
|
58
|
-
"day": date.day,
|
|
56
|
+
"tradeDate": date.strftime("%Y%m%d"),
|
|
57
|
+
"varietyId": "all",
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
r = requests.post(url, json=payload)
|
|
60
|
+
data_json = r.json()
|
|
61
|
+
temp_df = pd.DataFrame(data_json['data']['entityList'])
|
|
63
62
|
records = pd.DataFrame()
|
|
64
|
-
for x in
|
|
65
|
-
if isinstance(x["
|
|
66
|
-
if x["
|
|
67
|
-
var = x["
|
|
63
|
+
for x in temp_df.to_dict(orient="records"):
|
|
64
|
+
if isinstance(x["variety"], str):
|
|
65
|
+
if x["variety"][-2:] == "小计":
|
|
66
|
+
var = x["variety"][:-2]
|
|
68
67
|
temp_data = {
|
|
69
68
|
"var": chinese_to_english(var),
|
|
70
|
-
"receipt": int(x["
|
|
71
|
-
"receipt_chg": int(x["
|
|
69
|
+
"receipt": int(x["wbillQty"]),
|
|
70
|
+
"receipt_chg": int(x["diff"]),
|
|
72
71
|
"date": date.strftime("%Y%m%d"),
|
|
73
72
|
}
|
|
74
73
|
records = pd.concat([records, pd.DataFrame(temp_data, index=[0])])
|
|
@@ -110,7 +109,8 @@ def get_shfe_receipt_1(
|
|
|
110
109
|
shfe_20101029["date"] = date
|
|
111
110
|
return shfe_20101029
|
|
112
111
|
elif date in ["20100416", "20130821"]:
|
|
113
|
-
|
|
112
|
+
print("20100416、20130821交易所数据丢失")
|
|
113
|
+
return pd.DataFrame()
|
|
114
114
|
else:
|
|
115
115
|
var_list = [
|
|
116
116
|
"天然橡胶",
|
|
@@ -245,10 +245,10 @@ def get_czce_receipt_1(date: str = None, vars_list: List = cons.contract_symbols
|
|
|
245
245
|
ends = [x for x in data.index if "总计" in str(data[0].tolist()[x])]
|
|
246
246
|
for i in list(range(len(indexes))):
|
|
247
247
|
if i != len(indexes) - 1:
|
|
248
|
-
data_cut = data.loc[indexes[i]
|
|
248
|
+
data_cut = data.loc[indexes[i]: ends[i], :]
|
|
249
249
|
data_cut = data_cut.fillna(method="pad")
|
|
250
250
|
else:
|
|
251
|
-
data_cut = data.loc[indexes[i]
|
|
251
|
+
data_cut = data.loc[indexes[i]:, :]
|
|
252
252
|
data_cut = data_cut.fillna(method="pad")
|
|
253
253
|
if "PTA" in data_cut[0].tolist()[0]:
|
|
254
254
|
var = "TA"
|
|
@@ -347,7 +347,8 @@ def get_czce_receipt_3(
|
|
|
347
347
|
:rtype: pandas.DataFrame
|
|
348
348
|
"""
|
|
349
349
|
if not isinstance(vars_list, list):
|
|
350
|
-
|
|
350
|
+
print("vars_list: 必须是列表")
|
|
351
|
+
return pd.DataFrame()
|
|
351
352
|
date = (
|
|
352
353
|
cons.convert_date(date).strftime("%Y%m%d")
|
|
353
354
|
if date is not None
|
|
@@ -355,7 +356,7 @@ def get_czce_receipt_3(
|
|
|
355
356
|
)
|
|
356
357
|
if date not in calendar:
|
|
357
358
|
warnings.warn("%s非交易日" % date.strftime("%Y%m%d"))
|
|
358
|
-
return
|
|
359
|
+
return pd.DataFrame()
|
|
359
360
|
url = f"http://www.czce.com.cn/cn/DFSStaticFiles/Future/{date[:4]}/{date}/FutureDataWhsheet.xls"
|
|
360
361
|
r = requests_link(url, encoding="utf-8", headers=cons.shfe_headers)
|
|
361
362
|
temp_df = pd.read_excel(BytesIO(r.content))
|
|
@@ -389,6 +390,7 @@ def get_czce_receipt_3(
|
|
|
389
390
|
symbol_list = []
|
|
390
391
|
receipt_list = []
|
|
391
392
|
receipt_chg_list = []
|
|
393
|
+
records = pd.DataFrame()
|
|
392
394
|
for page in range(len(range_list_one)):
|
|
393
395
|
inner_df = temp_df[range_list_one[page] : range_list_two[page]]
|
|
394
396
|
reg = re.compile(r"[A-Z]+")
|
|
@@ -600,5 +602,5 @@ def get_receipt(
|
|
|
600
602
|
|
|
601
603
|
|
|
602
604
|
if __name__ == "__main__":
|
|
603
|
-
get_receipt_df = get_receipt(start_date="
|
|
605
|
+
get_receipt_df = get_receipt(start_date="20251027", end_date="20251027")
|
|
604
606
|
print(get_receipt_df)
|
akshare/stock/cons.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date: 2025/10/
|
|
4
|
+
Date: 2025/10/28 15:00
|
|
5
5
|
Desc: 股票配置文件
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
xq_a_token = "
|
|
8
|
+
xq_a_token = "144a75f00fac53d1ebae9a21261446d57d4443d1"
|
|
9
9
|
|
|
10
10
|
# zh-sina-kcb
|
|
11
11
|
zh_sina_kcb_stock_url = ("http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
akshare/__init__.py,sha256=
|
|
1
|
+
akshare/__init__.py,sha256=E3jj9C33zHR4bfOq31f7rh6kQhAgoAX2avtdtqzi7N8,199680
|
|
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
|
|
@@ -109,7 +109,7 @@ akshare/fund/fund_scale_sina.py,sha256=A0qIzWBQdE3IGS9-cxO9_FNpuH-BAG5HhPk5KzTFT
|
|
|
109
109
|
akshare/fund/fund_xq.py,sha256=AxMZB-940bNY7-BatVLZiseHNxiWA17hQzTfuxGibPU,11306
|
|
110
110
|
akshare/futures/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
|
|
111
111
|
akshare/futures/cons.py,sha256=2cqWdaPbuGHtkhbrDWnhHnIBxUzelRJjJ5oCmMKodFo,17976
|
|
112
|
-
akshare/futures/cot.py,sha256=
|
|
112
|
+
akshare/futures/cot.py,sha256=hY27LMsSmRvme4ITJdcWAc8N4a7vwNo6M2Gh8jcxz74,57848
|
|
113
113
|
akshare/futures/futures_basis.py,sha256=YB-fOUTCanNZqHNcJXJdFqpCBi9_NYbrTlzx2st5AS0,15710
|
|
114
114
|
akshare/futures/futures_comex_em.py,sha256=NPwOCD6lZUDL4wlGxvbmmJIFkQlW427ERO0vTux13WU,3172
|
|
115
115
|
akshare/futures/futures_comm_ctp.py,sha256=IyVRCUvhLTFzmcUVvlIaYZ1e38ll7AF8ExhgtXKuzrI,1003
|
|
@@ -131,9 +131,9 @@ akshare/futures/futures_settlement_price_sgx.py,sha256=SJxAGNuNxNEGDk7EF2odRPrWK
|
|
|
131
131
|
akshare/futures/futures_spot_stock_em.py,sha256=43CPkAouDu691M6aCMdO1SGKglTak2aba2Np7ftkAdg,3523
|
|
132
132
|
akshare/futures/futures_stock_js.py,sha256=sAao7ZcqBovdEo4wrVt2K6kXK2rf1_kT_StQdzhm9og,1635
|
|
133
133
|
akshare/futures/futures_to_spot.py,sha256=fDsnmwUDUWQSF11MBvGEKn_c69fJmaGnRigWzvQMaZc,12898
|
|
134
|
-
akshare/futures/futures_warehouse_receipt.py,sha256=
|
|
134
|
+
akshare/futures/futures_warehouse_receipt.py,sha256=yY_6feZN3V3kAa-3b_G-Twmxc1BnHGukJ4MvpHhH8Nc,8880
|
|
135
135
|
akshare/futures/futures_zh_sina.py,sha256=wFFiPdud7a6HUHxohlQmN0FsnrvsadTYhbq0cZT4dpo,26191
|
|
136
|
-
akshare/futures/receipt.py,sha256=
|
|
136
|
+
akshare/futures/receipt.py,sha256=Yi8zpEQUcrgbOLcz5S3uT5hnOMwwcdyf8c-iUjJ4064,23682
|
|
137
137
|
akshare/futures/requests_fun.py,sha256=w4inzqYjrAiRx_E3oszbcJwrRJR3MKpm5Rkropdusoo,2893
|
|
138
138
|
akshare/futures/symbol_var.py,sha256=dlDxz6K6_sn1B1xalCGR9Inc_apbQP-F3tJ_ZuKH1rQ,5857
|
|
139
139
|
akshare/futures_derivative/__init__.py,sha256=COFyP01gIUhWs4EBr6hwL73B7IWePIzg7vP7oEY3G3I,82
|
|
@@ -238,7 +238,7 @@ akshare/spot/spot_hog_soozhu.py,sha256=IEt7zrDs0ptAKgMA7QRIk45jcMLcA_LGq6Y3lKLFT
|
|
|
238
238
|
akshare/spot/spot_price_qh.py,sha256=rRv09vR8K0U_x6x8AiLgGluxytIXkLatFNVkFbIh8eQ,3756
|
|
239
239
|
akshare/spot/spot_sge.py,sha256=fXy6I9GchX2rfdPDD2wSN8K-hcDdS3ABzLDLdH-9t4Y,8696
|
|
240
240
|
akshare/stock/__init__.py,sha256=jSa9260d6aNZajaW68chI2mpPkDSXLOgi3eXrqo4MQ8,82
|
|
241
|
-
akshare/stock/cons.py,sha256=
|
|
241
|
+
akshare/stock/cons.py,sha256=UfWofeh75Jo8lifeoONVtNuyjwCxngtsJ9Az3nNuXHA,43668
|
|
242
242
|
akshare/stock/stock_allotment_cninfo.py,sha256=OVjVdWp2XVRNbJvVgtgVVoBmPBJgBB4RyIIgA_9QHM8,6066
|
|
243
243
|
akshare/stock/stock_ask_bid_em.py,sha256=bo7VNkp1PmK4Z-GPZuVn_I-IAdzeW8cs3W_75KodxCg,3368
|
|
244
244
|
akshare/stock/stock_board_concept_em.py,sha256=C13AHQueLFDDqL39MEkIKWFJVgMql5T79N1Hruppn9o,17785
|
|
@@ -399,10 +399,10 @@ akshare/utils/func.py,sha256=4cwmXFztU86yJNONJ40KJLvsIEQHBbct4iMm3zT2v30,2315
|
|
|
399
399
|
akshare/utils/multi_decrypt.py,sha256=aWoL2iEPeuXHJg8-n7OtMKixLnIhfzepACgxfrfmQB4,1657
|
|
400
400
|
akshare/utils/token_process.py,sha256=nGtgnZGRprXJkhLXH8mcUH4TgIFwzsTOb0EaEPa0Euo,667
|
|
401
401
|
akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
|
|
402
|
-
akshare-1.17.
|
|
402
|
+
akshare-1.17.74.dist-info/licenses/LICENSE,sha256=s18q7gS2g1F9-Cnk5eqrJG4OGWSwSxVEMzIuT6HyYNY,1073
|
|
403
403
|
tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
|
|
404
404
|
tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
|
|
405
|
-
akshare-1.17.
|
|
406
|
-
akshare-1.17.
|
|
407
|
-
akshare-1.17.
|
|
408
|
-
akshare-1.17.
|
|
405
|
+
akshare-1.17.74.dist-info/METADATA,sha256=7KUnp0TMPeVBk1QyGfUHkqbNIZVo742waTW5SROVtck,12593
|
|
406
|
+
akshare-1.17.74.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
407
|
+
akshare-1.17.74.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
|
|
408
|
+
akshare-1.17.74.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|