akshare 1.15.64__py3-none-any.whl → 1.15.66__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 +9 -1
- akshare/fund/fund_etf_sina.py +46 -2
- akshare/fund/fund_fee_em.py +98 -0
- akshare/option/option_commodity.py +8 -2
- {akshare-1.15.64.dist-info → akshare-1.15.66.dist-info}/METADATA +1 -1
- {akshare-1.15.64.dist-info → akshare-1.15.66.dist-info}/RECORD +9 -8
- {akshare-1.15.64.dist-info → akshare-1.15.66.dist-info}/LICENSE +0 -0
- {akshare-1.15.64.dist-info → akshare-1.15.66.dist-info}/WHEEL +0 -0
- {akshare-1.15.64.dist-info → akshare-1.15.66.dist-info}/top_level.txt +0 -0
akshare/__init__.py
CHANGED
|
@@ -2974,9 +2974,11 @@ amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚
|
|
|
2974
2974
|
1.15.62 fix: fix stock_zt_pool_sub_new_em interface
|
|
2975
2975
|
1.15.63 fix: fix stock_financial_abstract interface
|
|
2976
2976
|
1.15.64 fix: fix stock_zh_index_value_csindex interface
|
|
2977
|
+
1.15.65 fix: fix option_czce_daily interface
|
|
2978
|
+
1.15.66 fix: fix fund_etf_dividend_sina interface
|
|
2977
2979
|
"""
|
|
2978
2980
|
|
|
2979
|
-
__version__ = "1.15.
|
|
2981
|
+
__version__ = "1.15.66"
|
|
2980
2982
|
__author__ = "AKFamily"
|
|
2981
2983
|
|
|
2982
2984
|
import sys
|
|
@@ -2998,6 +3000,11 @@ if sys.version_info < (3, 9):
|
|
|
2998
3000
|
|
|
2999
3001
|
del sys
|
|
3000
3002
|
|
|
3003
|
+
"""
|
|
3004
|
+
基金费率
|
|
3005
|
+
"""
|
|
3006
|
+
from akshare.fund.fund_fee_em import fund_fee_em
|
|
3007
|
+
|
|
3001
3008
|
"""
|
|
3002
3009
|
东方财富网-数据中心-估值分析-每日互动-每日互动-估值分析
|
|
3003
3010
|
"""
|
|
@@ -4479,6 +4486,7 @@ from akshare.stock_feature.stock_yjyg_cninfo import stock_report_disclosure
|
|
|
4479
4486
|
from akshare.fund.fund_etf_sina import (
|
|
4480
4487
|
fund_etf_hist_sina,
|
|
4481
4488
|
fund_etf_category_sina,
|
|
4489
|
+
fund_etf_dividend_sina,
|
|
4482
4490
|
)
|
|
4483
4491
|
|
|
4484
4492
|
"""
|
akshare/fund/fund_etf_sina.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2025/1/5 19:00
|
|
5
5
|
Desc: 新浪财经-基金行情
|
|
6
6
|
https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf
|
|
7
7
|
"""
|
|
@@ -132,15 +132,56 @@ def fund_etf_hist_sina(symbol: str = "sh510050") -> pd.DataFrame:
|
|
|
132
132
|
temp_df = pd.DataFrame(dict_list)
|
|
133
133
|
if temp_df.empty: # 处理获取数据为空的问题
|
|
134
134
|
return pd.DataFrame()
|
|
135
|
-
temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.
|
|
135
|
+
temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.tz_localize(
|
|
136
|
+
None
|
|
137
|
+
)
|
|
136
138
|
temp_df["open"] = pd.to_numeric(temp_df["open"], errors="coerce")
|
|
137
139
|
temp_df["high"] = pd.to_numeric(temp_df["high"], errors="coerce")
|
|
138
140
|
temp_df["low"] = pd.to_numeric(temp_df["low"], errors="coerce")
|
|
139
141
|
temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce")
|
|
140
142
|
temp_df["volume"] = pd.to_numeric(temp_df["volume"], errors="coerce")
|
|
143
|
+
|
|
144
|
+
# 转换日期列为日期类型
|
|
145
|
+
temp_df["date"] = temp_df["date"].dt.date
|
|
146
|
+
temp_df = temp_df.sort_values(by="date", ascending=True)
|
|
141
147
|
return temp_df
|
|
142
148
|
|
|
143
149
|
|
|
150
|
+
def fund_etf_dividend_sina(symbol: str = "sh510050") -> pd.DataFrame:
|
|
151
|
+
"""
|
|
152
|
+
新浪财经-基金-ETF 基金-累计分红
|
|
153
|
+
https://finance.sina.com.cn/fund/quotes/510050/bc.shtml
|
|
154
|
+
:param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取
|
|
155
|
+
:type symbol: str
|
|
156
|
+
:return: 累计分红
|
|
157
|
+
:rtype: pandas.DataFrame
|
|
158
|
+
"""
|
|
159
|
+
# 构建复权数据URL
|
|
160
|
+
factor_url = f"https://finance.sina.com.cn/realstock/company/{symbol}/hfq.js"
|
|
161
|
+
r = requests.get(factor_url)
|
|
162
|
+
text = r.text
|
|
163
|
+
if text.startswith("var"):
|
|
164
|
+
json_str = text.split("=")[1].strip().rsplit("}", maxsplit=1)[0].strip()
|
|
165
|
+
data = eval(json_str + "}") # 这里使用eval而不是json.loads因为数据格式特殊
|
|
166
|
+
|
|
167
|
+
if isinstance(data, dict) and "data" in data:
|
|
168
|
+
df = pd.DataFrame(data["data"])
|
|
169
|
+
# 重命名列
|
|
170
|
+
df.columns = ["date", "f", "s", "u"] if len(df.columns) == 4 else df.columns
|
|
171
|
+
# 移除1900-01-01的数据
|
|
172
|
+
df = df[df["date"] != "1900-01-01"]
|
|
173
|
+
# 转换日期
|
|
174
|
+
df["date"] = pd.to_datetime(df["date"])
|
|
175
|
+
# 转换数值类型
|
|
176
|
+
df[["f", "s", "u"]] = df[["f", "s", "u"]].astype(float)
|
|
177
|
+
# 按日期排序
|
|
178
|
+
df = df.sort_values("date", ascending=True, ignore_index=True)
|
|
179
|
+
temp_df = df[["date", "u"]].copy()
|
|
180
|
+
temp_df.columns = ["日期", "累计分红"]
|
|
181
|
+
temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
|
|
182
|
+
return temp_df
|
|
183
|
+
|
|
184
|
+
|
|
144
185
|
if __name__ == "__main__":
|
|
145
186
|
fund_etf_category_sina_df = fund_etf_category_sina(symbol="封闭式基金")
|
|
146
187
|
print(fund_etf_category_sina_df)
|
|
@@ -156,3 +197,6 @@ if __name__ == "__main__":
|
|
|
156
197
|
|
|
157
198
|
fund_etf_hist_sina_df = fund_etf_hist_sina(symbol="sh510300")
|
|
158
199
|
print(fund_etf_hist_sina_df)
|
|
200
|
+
|
|
201
|
+
fund_etf_dividend_sina_df = fund_etf_dividend_sina(symbol="sh510050")
|
|
202
|
+
print(fund_etf_dividend_sina_df)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding:utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Date: 2025/1/4 17:00
|
|
5
|
+
Desc: 天天基金-基金档案
|
|
6
|
+
https://fundf10.eastmoney.com/jjfl_015641.html
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import requests
|
|
10
|
+
import pandas as pd
|
|
11
|
+
from io import StringIO
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def fund_fee_em(symbol: str = "015641", indicator: str = "认购费率") -> pd.DataFrame:
|
|
15
|
+
"""
|
|
16
|
+
天天基金-基金档案-购买信息
|
|
17
|
+
https://fundf10.eastmoney.com/jjfl_015641.html
|
|
18
|
+
:param symbol: 基金代码
|
|
19
|
+
:type symbol: str
|
|
20
|
+
:param indicator: choice of {"交易状态", "申购与赎回金额", "交易确认日", "运作费用", "认购费率", "申购费率", "赎回费率"}
|
|
21
|
+
:type indicator: str
|
|
22
|
+
:return: 交易规则
|
|
23
|
+
:rtype: pandas.DataFrame
|
|
24
|
+
"""
|
|
25
|
+
url = f"https://fundf10.eastmoney.com/jjfl_{symbol}.html"
|
|
26
|
+
r = requests.get(url)
|
|
27
|
+
|
|
28
|
+
if indicator == "交易状态":
|
|
29
|
+
temp_df = pd.read_html(StringIO(r.text))[1]
|
|
30
|
+
elif indicator == "申购与赎回金额":
|
|
31
|
+
temp_df_1 = pd.read_html(StringIO(r.text))[2]
|
|
32
|
+
temp_df_2 = pd.read_html(StringIO(r.text))[3]
|
|
33
|
+
temp_df = pd.concat(objs=[temp_df_1, temp_df_2], ignore_index=True)
|
|
34
|
+
elif indicator == "交易确认日":
|
|
35
|
+
temp_df = pd.read_html(StringIO(r.text))[4]
|
|
36
|
+
elif indicator == "运作费用":
|
|
37
|
+
temp_df = pd.read_html(StringIO(r.text))[5]
|
|
38
|
+
elif indicator == "认购费率":
|
|
39
|
+
temp_df = pd.read_html(StringIO(r.text))[6]
|
|
40
|
+
temp_df["原费率"] = temp_df["原费率|天天基金优惠费率"].str.split(
|
|
41
|
+
"|", expand=True
|
|
42
|
+
)[0]
|
|
43
|
+
temp_df["天天基金优惠费率"] = temp_df["原费率|天天基金优惠费率"].str.split(
|
|
44
|
+
"|", expand=True
|
|
45
|
+
)[1]
|
|
46
|
+
del temp_df["原费率|天天基金优惠费率"]
|
|
47
|
+
temp_df.loc[3, "天天基金优惠费率"] = temp_df.loc[3, "原费率"]
|
|
48
|
+
temp_df["原费率"] = temp_df["原费率"].str.strip()
|
|
49
|
+
temp_df["天天基金优惠费率"] = temp_df["天天基金优惠费率"].str.strip()
|
|
50
|
+
elif indicator == "申购费率":
|
|
51
|
+
temp_df = pd.read_html(StringIO(r.text))[7]
|
|
52
|
+
temp_df["原费率"] = temp_df[
|
|
53
|
+
"原费率|天天基金优惠费率 银行卡购买|活期宝购买"
|
|
54
|
+
].str.split("|", expand=True)[0]
|
|
55
|
+
temp_df["天天基金优惠费率-银行卡购买"] = temp_df[
|
|
56
|
+
"原费率|天天基金优惠费率 银行卡购买|活期宝购买"
|
|
57
|
+
].str.split("|", expand=True)[1]
|
|
58
|
+
temp_df["天天基金优惠费率-活期宝购买"] = temp_df[
|
|
59
|
+
"原费率|天天基金优惠费率 银行卡购买|活期宝购买"
|
|
60
|
+
].str.split("|", expand=True)[2]
|
|
61
|
+
del temp_df["原费率|天天基金优惠费率 银行卡购买|活期宝购买"]
|
|
62
|
+
temp_df.loc[3, "天天基金优惠费率-银行卡购买"] = temp_df.loc[3, "原费率"]
|
|
63
|
+
temp_df.loc[3, "天天基金优惠费率-活期宝购买"] = temp_df.loc[3, "原费率"]
|
|
64
|
+
temp_df["原费率"] = temp_df["原费率"].str.strip()
|
|
65
|
+
temp_df["天天基金优惠费率-银行卡购买"] = temp_df[
|
|
66
|
+
"天天基金优惠费率-银行卡购买"
|
|
67
|
+
].str.strip()
|
|
68
|
+
temp_df["天天基金优惠费率-活期宝购买"] = temp_df[
|
|
69
|
+
"天天基金优惠费率-活期宝购买"
|
|
70
|
+
].str.strip()
|
|
71
|
+
elif indicator == "赎回费率":
|
|
72
|
+
temp_df = pd.read_html(StringIO(r.text))[8]
|
|
73
|
+
else:
|
|
74
|
+
temp_df = pd.DataFrame([])
|
|
75
|
+
return temp_df
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="交易状态")
|
|
80
|
+
print(fund_fee_em_df)
|
|
81
|
+
|
|
82
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="申购与赎回金额")
|
|
83
|
+
print(fund_fee_em_df)
|
|
84
|
+
|
|
85
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="交易确认日")
|
|
86
|
+
print(fund_fee_em_df)
|
|
87
|
+
|
|
88
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="运作费用")
|
|
89
|
+
print(fund_fee_em_df)
|
|
90
|
+
|
|
91
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="认购费率")
|
|
92
|
+
print(fund_fee_em_df)
|
|
93
|
+
|
|
94
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="申购费率")
|
|
95
|
+
print(fund_fee_em_df)
|
|
96
|
+
|
|
97
|
+
fund_fee_em_df = fund_fee_em(symbol="015641", indicator="赎回费率")
|
|
98
|
+
print(fund_fee_em_df)
|
|
@@ -210,7 +210,7 @@ def option_czce_daily(
|
|
|
210
210
|
:type trade_date: str
|
|
211
211
|
:param symbol: choice of {"白糖期权", "棉花期权", "甲醇期权", "PTA期权", "菜籽粕期权", "动力煤期权", "短纤期权",
|
|
212
212
|
"菜籽油期权", "花生期权", "纯碱期权", "锰硅期权", "硅铁期权", "尿素期权", "对二甲苯期权", "苹果期权", "红枣期权"
|
|
213
|
-
"烧碱期权", "玻璃期权"}
|
|
213
|
+
"烧碱期权", "玻璃期权", "瓶片期权"}
|
|
214
214
|
:type symbol: str
|
|
215
215
|
:return: 日频行情数据
|
|
216
216
|
:rtype: pandas.DataFrame
|
|
@@ -334,6 +334,12 @@ def option_czce_daily(
|
|
|
334
334
|
temp_df = temp_df.iloc[:-1, :].copy()
|
|
335
335
|
new_df = __option_czce_daily_convert_numeric_columns(temp_df)
|
|
336
336
|
return new_df
|
|
337
|
+
elif symbol == "瓶片期权":
|
|
338
|
+
temp_df = table_df[table_df.iloc[:, 0].str.contains("FG")]
|
|
339
|
+
temp_df.reset_index(inplace=True, drop=True)
|
|
340
|
+
temp_df = temp_df.iloc[:-1, :].copy()
|
|
341
|
+
new_df = __option_czce_daily_convert_numeric_columns(temp_df)
|
|
342
|
+
return new_df
|
|
337
343
|
except: # noqa: E722
|
|
338
344
|
return pd.DataFrame()
|
|
339
345
|
|
|
@@ -635,5 +641,5 @@ if __name__ == "__main__":
|
|
|
635
641
|
)
|
|
636
642
|
print(option_gfex_vol_daily_df)
|
|
637
643
|
|
|
638
|
-
option_czce_daily_df = option_czce_daily(symbol="
|
|
644
|
+
option_czce_daily_df = option_czce_daily(symbol="瓶片期权", trade_date="20250103")
|
|
639
645
|
print(option_czce_daily_df)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
akshare/__init__.py,sha256=
|
|
1
|
+
akshare/__init__.py,sha256=W-0PqOedEFTzY7utCqr6lS4ENUQq4SA6SaYtQtJ9-5o,185637
|
|
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
|
|
@@ -87,8 +87,9 @@ akshare/fund/fund_announcement.py,sha256=g5rcIC9vQ4HapZd0b7cDbFYzHu9V6bOKhwxRHVf
|
|
|
87
87
|
akshare/fund/fund_aum_em.py,sha256=dy1R1-0X48H8S-LPiuggNA5M-6MvQ08fnp5bytvCGPQ,3518
|
|
88
88
|
akshare/fund/fund_em.py,sha256=nX0VA5JeiF-zRr1J10X-U9-pJj5KFDUAbovN1DWjvTo,40450
|
|
89
89
|
akshare/fund/fund_etf_em.py,sha256=oEPVCg-CQvOfLS7bt69yshqPiUPbxDpWa-FnMF7GqIQ,17386
|
|
90
|
-
akshare/fund/fund_etf_sina.py,sha256=
|
|
90
|
+
akshare/fund/fund_etf_sina.py,sha256=YV2KrqKMF_h8kgrywvWvRJx2oy62lhgizvHFk40E4Rk,7042
|
|
91
91
|
akshare/fund/fund_etf_ths.py,sha256=vb_jy0h2-Kz2dNWUrwBYxPB0MAotv0KZgnFhE98ohSM,3432
|
|
92
|
+
akshare/fund/fund_fee_em.py,sha256=rkA2qVEhuWBUTFlvEP-zY_4Fw7_vL9cDx9hR-P38yDk,4157
|
|
92
93
|
akshare/fund/fund_fhsp_em.py,sha256=-zSwwveiCB4HHRxwAuaLDTQHmNe3FxwxxeoPeiG8JbM,5546
|
|
93
94
|
akshare/fund/fund_init_em.py,sha256=4kOhsOkEs50B-RAxz-fTyWxNC1J4jNBDoKGJlFUpIjQ,2210
|
|
94
95
|
akshare/fund/fund_lof_em.py,sha256=eWpIlHzUYbscyxvz8awiDERxd7gTucHcGcrBPTCCFno,12473
|
|
@@ -187,7 +188,7 @@ akshare/nlp/nlp_interface.py,sha256=PyZjT3PkuTbloop-JwLwZ2kNi22zdO-r_pRUWQ5SmgM,
|
|
|
187
188
|
akshare/option/__init__.py,sha256=RMTf1bT5EOE3ttWpn3hGu1LtUmsVxDoa0W7W0gXHOy8,81
|
|
188
189
|
akshare/option/cons.py,sha256=zTRZ62RFwOcAKfmso-7nZJtT3a8Dt1nQbNnEjSqgjpI,4811
|
|
189
190
|
akshare/option/option_comm_qihuo.py,sha256=kjbdp-94KJJJi1ex5U03abtlgviqwP0Aahb6FwddPkk,3128
|
|
190
|
-
akshare/option/option_commodity.py,sha256=
|
|
191
|
+
akshare/option/option_commodity.py,sha256=1b5d0pCwuaUtjlM4qyjiTRMx62fKKAq02mc-ira5d5I,25711
|
|
191
192
|
akshare/option/option_commodity_sina.py,sha256=r6qK_K7w3A6Uqp5ZtBb4pW7vH04oMyeCEZLLGqi0jpA,7776
|
|
192
193
|
akshare/option/option_czce.py,sha256=L4i7TVKcOns5ZKoqq-mrSykdx3SGwu6OL4eI77-A_lc,1812
|
|
193
194
|
akshare/option/option_daily_stats_sse_szse.py,sha256=Ip_vE81qbEGt4ocbtWfUT7XGu0HWU0zKkzauZeq9RJA,4962
|
|
@@ -377,8 +378,8 @@ akshare/utils/token_process.py,sha256=K4rGXjh_tgugbRcyOK2h2x0jP3PT65IIK7nxhUKhOe
|
|
|
377
378
|
akshare/utils/tqdm.py,sha256=MuPNwcswkOGjwWQOMWXi9ZvQ_RmW4obCWRj2i7HM7FE,847
|
|
378
379
|
tests/__init__.py,sha256=gNzhlO0UPjFq6Ieb38kaVIODXv4cTDByrdohAZnDYt4,82
|
|
379
380
|
tests/test_func.py,sha256=j1MGYbZI2if2j_LY1S4FLsf4qfq4NwVqD5wmRlv5Log,832
|
|
380
|
-
akshare-1.15.
|
|
381
|
-
akshare-1.15.
|
|
382
|
-
akshare-1.15.
|
|
383
|
-
akshare-1.15.
|
|
384
|
-
akshare-1.15.
|
|
381
|
+
akshare-1.15.66.dist-info/LICENSE,sha256=mmSZCPgfHiVw34LXuFArd-SUgQtBJ_QsIlh-kWlDHfs,1073
|
|
382
|
+
akshare-1.15.66.dist-info/METADATA,sha256=_KY49PPY1WCkGJIqVLl35Brda6xP5cSjQmQZGvcTlY8,13423
|
|
383
|
+
akshare-1.15.66.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
384
|
+
akshare-1.15.66.dist-info/top_level.txt,sha256=jsf9ZzZPmHaISTVumQPsAw7vv7Yv-PdEVW70SMEelQQ,14
|
|
385
|
+
akshare-1.15.66.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|