diff --git a/akshare/__init__.py b/akshare/__init__.py index 321b312b25b..d4cf7ba0359 100644 --- a/akshare/__init__.py +++ b/akshare/__init__.py @@ -2576,9 +2576,10 @@ 1.11.60 fix: fix bond_china_close_return interface 1.11.61 fix: fix fund_manager_em interface 1.11.62 fix: fix stock_zt_pool_dtgc_em interface +1.11.63 fix: fix fund_scale_open_sina interface """ -__version__ = "1.11.62" +__version__ = "1.11.63" __author__ = "AKFamily" import sys diff --git a/akshare/fund/fund_init_em.py b/akshare/fund/fund_init_em.py index 914580173c4..8e399593d26 100644 --- a/akshare/fund/fund_init_em.py +++ b/akshare/fund/fund_init_em.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding:utf-8 -*- """ -Date: 2022/3/22 14:30 +Date: 2023/11/7 18:30 Desc: 基金数据-新发基金-新成立基金 https://fund.eastmoney.com/data/xinfound.html """ @@ -14,11 +14,11 @@ def fund_new_found_em() -> pd.DataFrame: """ 基金数据-新发基金-新成立基金 - http://fund.eastmoney.com/data/xinfound.html + https://fund.eastmoney.com/data/xinfound.html :return: 新成立基金 :rtype: pandas.DataFrame """ - url = "http://fund.eastmoney.com/data/FundNewIssue.aspx" + url = "https://fund.eastmoney.com/data/FundNewIssue.aspx" params = { "t": "xcln", "sort": "jzrgq,desc", @@ -67,13 +67,11 @@ def fund_new_found_em() -> pd.DataFrame: "优惠费率", ] ] - - temp_df['募集份额'] = pd.to_numeric(temp_df['募集份额']) - temp_df['成立日期'] = pd.to_datetime(temp_df['成立日期']).dt.date - temp_df['成立来涨幅'] = pd.to_numeric(temp_df['成立来涨幅'].str.replace(',', '')) + temp_df['募集份额'] = pd.to_numeric(temp_df['募集份额'], errors="coerce") + temp_df['成立日期'] = pd.to_datetime(temp_df['成立日期'], errors="coerce").dt.date + temp_df['成立来涨幅'] = pd.to_numeric(temp_df['成立来涨幅'].str.replace(',', ''), errors="coerce") temp_df['优惠费率'] = temp_df['优惠费率'].str.strip("%") - temp_df['优惠费率'] = pd.to_numeric(temp_df['优惠费率']) - + temp_df['优惠费率'] = pd.to_numeric(temp_df['优惠费率'], errors="coerce") return temp_df diff --git a/akshare/fund/fund_scale_sina.py b/akshare/fund/fund_scale_sina.py index 9c9c743a3fd..dff2e8aaf1e 100644 --- a/akshare/fund/fund_scale_sina.py +++ b/akshare/fund/fund_scale_sina.py @@ -1,9 +1,9 @@ # -*- coding:utf-8 -*- # !/usr/bin/env python """ -Date: 2021/10/17 16:33 +Date: 2023/11/7 18:30 Desc: 新浪财经-基金规模 -http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjgmall +https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjgmall """ import pandas as pd import requests @@ -14,7 +14,7 @@ def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame: """ 新浪财经-基金数据中心-基金规模-开放式基金 - http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf + https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf :param symbol: choice of {"股票型基金", "混合型基金", "债券型基金", "货币型基金", "QDII基金"} :type symbol: str :return: 基金规模 @@ -39,7 +39,7 @@ def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame: } r = requests.get(url, params=params) data_text = r.text - data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2]) + data_json = demjson.decode(data_text[data_text.find("({") + 1: -2]) temp_df = pd.DataFrame(data_json["data"]) temp_df.reset_index(inplace=True) temp_df["index"] = range(1, len(temp_df) + 1) @@ -80,8 +80,8 @@ def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame: "更新日期", ] ] - temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date - temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date + temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"], errors="coerce").dt.date + temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"], errors="coerce").dt.date temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["总募集规模"] = pd.to_numeric(temp_df["总募集规模"], errors="coerce") temp_df["最近总份额"] = pd.to_numeric(temp_df["最近总份额"], errors="coerce") @@ -91,7 +91,7 @@ def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame: def fund_scale_close_sina() -> pd.DataFrame: """ 新浪财经-基金数据中心-基金规模-封闭式基金 - http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf + https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf :return: 基金规模 :rtype: pandas.DataFrame """ @@ -107,7 +107,7 @@ def fund_scale_close_sina() -> pd.DataFrame: } r = requests.get(url, params=params) data_text = r.text - data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2]) + data_json = demjson.decode(data_text[data_text.find("({") + 1: -2]) temp_df = pd.DataFrame(data_json["data"]) temp_df.reset_index(inplace=True) temp_df["index"] = range(1, len(temp_df) + 1) @@ -148,8 +148,8 @@ def fund_scale_close_sina() -> pd.DataFrame: "更新日期", ] ] - temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date - temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date + temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"], errors="coerce").dt.date + temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"], errors="coerce").dt.date temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["总募集规模"] = pd.to_numeric(temp_df["总募集规模"], errors="coerce") temp_df["最近总份额"] = pd.to_numeric(temp_df["最近总份额"], errors="coerce") @@ -159,7 +159,7 @@ def fund_scale_close_sina() -> pd.DataFrame: def fund_scale_structured_sina() -> pd.DataFrame: """ 新浪财经-基金数据中心-基金规模-分级子基金 - http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf + https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf :return: 基金规模 :rtype: pandas.DataFrame """ @@ -175,7 +175,7 @@ def fund_scale_structured_sina() -> pd.DataFrame: } r = requests.get(url, params=params) data_text = r.text - data_json = demjson.decode(data_text[data_text.find("({") + 1 : -2]) + data_json = demjson.decode(data_text[data_text.find("({") + 1: -2]) temp_df = pd.DataFrame(data_json["data"]) temp_df.reset_index(inplace=True) temp_df["index"] = range(1, len(temp_df) + 1) @@ -216,8 +216,8 @@ def fund_scale_structured_sina() -> pd.DataFrame: "更新日期", ] ] - temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date - temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"]).dt.date + temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"], errors="coerce").dt.date + temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"], errors="coerce").dt.date temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["总募集规模"] = pd.to_numeric(temp_df["总募集规模"], errors="coerce") temp_df["最近总份额"] = pd.to_numeric(temp_df["最近总份额"], errors="coerce") @@ -225,9 +225,8 @@ def fund_scale_structured_sina() -> pd.DataFrame: if __name__ == "__main__": - for fund_item in ["股票型基金", "混合型基金", "债券型基金", "货币型基金", "QDII基金"]: - fund_scale_open_sina_df = fund_scale_open_sina(symbol=fund_item) - print(fund_scale_open_sina_df) + fund_scale_open_sina_df = fund_scale_open_sina(symbol="股票型基金") + print(fund_scale_open_sina_df) fund_scale_close_sina_df = fund_scale_close_sina() print(fund_scale_close_sina_df) diff --git a/docs/changelog.md b/docs/changelog.md index 7ca9087a94f..4fc60741019 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -69,6 +69,10 @@ ## 更新说明详情 +1.11.63 fix: fix fund_scale_open_sina interface + + 1. 修复 fund_scale_open_sina 接口 + 1.11.62 fix: fix stock_zt_pool_dtgc_em interface 1. 修复 stock_zt_pool_dtgc_em 接口 @@ -3092,6 +3096,8 @@ ## 版本更新说明 +1.11.63 fix: fix fund_scale_open_sina interface + 1.11.62 fix: fix stock_zt_pool_dtgc_em interface 1.11.61 fix: fix fund_manager_em interface diff --git a/docs/data/fund/fund_public.md b/docs/data/fund/fund_public.md index 580a49da863..2ce2b34d057 100644 --- a/docs/data/fund/fund_public.md +++ b/docs/data/fund/fund_public.md @@ -2906,9 +2906,9 @@ print(fund_manager_em_df) 接口: fund_new_found_em -目标地址: http://fund.eastmoney.com/data/xinfound.html +目标地址: https://fund.eastmoney.com/data/xinfound.html -描述: 天天基金网-基金数据-新发基金 +描述: 天天基金网-基金数据-新发基金-新成立基金 限量: 单次返回所有新发基金数据 @@ -2946,18 +2946,19 @@ print(fund_new_found_em_df) 数据示例 ``` - 基金代码 基金简称 发行公司 基金类型 ... 成立来涨幅 基金经理 申购状态 优惠费率 -0 013253 海富通养老目标日期2035(FOF) 海富通基金 混合型-平衡 ... 0.00 朱赟 开放申购 0.12 -1 970096 东证融汇禧悦90天滚动持有中短债A 东证融汇证券 债券型-中短债 ... 0.08 应洁茜,石睿柯 开放申购 0.03 -2 970097 东证融汇禧悦90天滚动持有中短债C 东证融汇证券 债券型-中短债 ... 0.07 应洁茜,石睿柯 开放申购 0.00 -3 013481 华宝国证治理指数发起C 华宝基金 指数型-股票 ... -0.87 张放 开放申购 0.00 -4 013480 华宝国证治理指数发起A 华宝基金 指数型-股票 ... -0.87 张放 开放申购 0.10 - ... ... ... ... ... ... ... ... ... -5059 004652 建信鑫利回报灵活配置混合A 建信基金 混合型-灵活 ... 47.00 叶乐天 限大额 0.15 -5060 004653 建信鑫利回报灵活配置混合C 建信基金 混合型-灵活 ... 48.32 叶乐天 限大额 0.00 -5061 005295 诺德天富灵活配置混合 诺德基金 混合型-灵活 ... 42.84 曾文宏 限大额 0.15 -5062 004751 广发鑫和灵活配置混合C 广发基金 混合型-灵活 ... 30.15 吴迪 限大额 0.00 -5063 004750 广发鑫和灵活配置混合A 广发基金 混合型-灵活 ... 33.15 吴迪 限大额 0.12 + 基金代码 基金简称 发行公司 ... 基金经理 申购状态 优惠费率 +0 019879 万家周期驱动股票发起式A 万家基金 ... 叶勇 开放申购 0.15 +1 019873 长城短债E 长城基金 ... 邹德立 限大额 0.00 +2 019872 长城短债D 长城基金 ... 邹德立 限大额 0.03 +3 019880 万家周期驱动股票发起式C 万家基金 ... 叶勇 开放申购 0.00 +4 019671 广发中证香港创新药ETF发起式联接(QDII)C 广发基金 ... 刘杰 开放申购 0.00 + ... ... ... ... ... ... ... +7310 008411 博时富信纯债债券 博时基金 ... 陈黎 限大额 0.08 +7311 008135 华宸未来价值先锋 华宸未来基金 ... 张翼翔 开放申购 0.15 +7312 007729 招商普盛全球配置(QDII-FOF)人民币 招商基金 ... 范刚强 开放申购 0.15 +7313 008055 汇添富中债7-10年国开债C 汇添富基金 ... 何旻,李伟 开放申购 0.00 +7314 008054 汇添富中债7-10年国开债A 汇添富基金 ... 何旻,李伟 开放申购 0.05 +[7315 rows x 11 columns] ``` ### 基金规模 @@ -2966,7 +2967,7 @@ print(fund_new_found_em_df) 接口: fund_scale_open_sina -目标地址: http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf +目标地址: https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf 描述: 基金数据中心-基金规模-开放式基金 @@ -3004,25 +3005,26 @@ print(fund_scale_open_sina_df) 数据示例 ``` - 序号 基金代码 基金简称 ... 成立日期 基金经理 更新日期 -0 1 510300 华泰柏瑞沪深300ETF ... 2012-05-04 柳军 2021-10-15 -1 2 009341 易方达均衡成长股票 ... 2020-05-22 陈皓 2021-10-15 -2 3 512960 博时央企结构调整ETF ... 2018-10-19 赵云阳 2021-10-15 -3 4 000051 华夏沪深300ETF联接A ... 2009-07-10 张弘弢、赵宗庭 2021-10-15 -4 5 001409 工银互联网加股票 ... 2015-06-05 单文 2021-10-15 - ... ... ... ... ... ... ... -2374 2375 010505 申万菱信创业板量化精选股票C ... 2020-10-29 俞诚 2021-10-15 -2375 2376 010524 银华中证5G通信主题ETF联接C ... 2021-01-04 王帅、马君 2021-10-15 -2376 2377 010531 申万菱信中证申万电子行业投资指数(LOF)C ... 2020-11-11 龚丽丽 2021-10-15 -2377 2378 010556 汇添富沪深300指数增强C ... 2020-11-03 吴振翔、许一尊 2021-10-15 -2378 2379 960000 汇丰晋信大盘股票H ... 2015-12-29 黄立华 2021-10-15 + 序号 基金代码 基金简称 ... 成立日期 基金经理 更新日期 +0 1 510300 华泰柏瑞沪深300ETF ... 2012-05-04 柳军 2023-11-06 +1 2 009341 易方达均衡成长股票 ... 2020-05-22 陈皓 2023-11-06 +2 3 512960 博时央企结构调整ETF ... 2018-10-19 赵云阳 2023-11-06 +3 4 000051 华夏沪深300ETF联接A ... 2009-07-10 张弘弢、赵宗庭 2023-11-06 +4 5 001409 工银互联网加股票 ... 2015-06-05 单文 2023-11-06 + ... ... ... ... ... ... ... +3677 3678 015676 鹏华中证移动互联网指数(LOF)C ... 2022-05-10 罗英宇 2023-11-06 +3678 3679 160222 国泰国证食品饮料行业指数A ... 2021-01-01 梁杏 2023-11-06 +3679 3680 160221 国泰国证有色金属行业指数A ... 2021-01-01 吴中昊 2023-11-06 +3680 3681 160218 国泰国证房地产行业指数A ... 2021-01-01 吴中昊 2023-11-06 +3681 3682 960000 汇丰晋信大盘股票H ... 2015-12-29 闵良超 2023-11-06 +[3682 rows x 9 columns] ``` #### 封闭式基金 接口: fund_scale_close_sina -目标地址: http://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf +目标地址: https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf 描述: 基金数据中心-基金规模-封闭式基金 @@ -3060,18 +3062,19 @@ print(fund_scale_close_sina_df) 数据示例 ``` - 序号 基金代码 基金简称 ... 成立日期 基金经理 更新日期 -0 1 163418 兴全合兴两年封闭运作混合(LOF)A ... 2021-01-12 陈宇 2021-10-15 -1 2 010670 兴全合兴两年封闭运作混合(LOF)C ... 2021-01-12 陈宇 NaT -2 3 001369 兴业稳固收益两年理财债券 ... 2015-06-10 唐丁祥 2021-10-15 -3 4 007420 华安鼎信3个月定开债券 ... 2019-05-15 朱才敏、鲍越愚 2021-10-15 -4 5 006393 招商添德3个月定开债发起式A ... 2018-09-12 滕越 2021-10-15 -.. ... ... ... ... ... ... ... -101 102 519059 海富通可转债优选债券 ... 2014-05-06 何谦 NaT -102 103 007501 万家科创主题3年封闭运作灵活配置混合C ... 2019-06-12 李文宾 NaT -103 104 006394 招商添德3个月定开债发起式C ... 2018-09-12 滕越 NaT -104 105 005863 华夏鼎禄三个月定开债券C ... 2018-10-11 张海静 NaT -105 106 000631 中银聚利分级债券 ... 2014-06-05 陈玮 NaT + 序号 基金代码 基金简称 ... 成立日期 基金经理 更新日期 +0 1 017800 招商恒鑫30个月封闭债 ... 2023-02-22 李家辉 2023-10-16 +1 2 001369 兴业稳固收益两年理财债券 ... 2015-06-10 唐丁祥 2023-11-06 +2 3 017798 易方达恒固18个月封闭债券A ... 2023-03-06 纪玲云 2023-10-16 +3 4 017792 工银泰丰一年封闭债券 ... 2023-03-21 张略钊 NaT +4 5 163418 兴全合兴混合(LOF)A ... 2021-01-12 陈宇 2023-11-06 +.. ... ... ... ... ... ... ... +135 136 165809 东吴中证可转债指数 ... 2014-05-09 邵笛 NaN +136 137 519059 海富通可转债优选债券 ... 2014-05-06 何谦 NaN +137 138 000631 中银聚利分级债券 ... 2014-06-05 陈玮 NaN +138 139 005863 华夏鼎禄三个月定开债券C ... 2018-10-11 孙蕾 NaN +139 140 006394 招商添德3个月定开债发起式C ... 2018-09-12 黄晓婷 NaN +[140 rows x 9 columns] ``` #### 分级子基金