akshare 1.14.49__py3-none-any.whl → 1.17.99__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 +595 -129
- akshare/air/air_hebei.py +77 -54
- akshare/air/air_zhenqi.py +0 -4
- akshare/air/cons.py +1 -0
- akshare/air/crypto.js +1 -1
- akshare/air/outcrypto.js +1 -1
- akshare/article/cons.py +1 -0
- akshare/article/epu_index.py +4 -3
- akshare/article/ff_factor.py +19 -8
- akshare/article/fred_md.py +4 -1
- akshare/article/risk_rv.py +3 -8
- akshare/bank/bank_cbirc_2020.py +11 -11
- akshare/bank/cons.py +7 -6
- akshare/bond/bond_buy_back_em.py +228 -0
- akshare/bond/bond_cb_sina.py +1 -0
- akshare/bond/bond_cb_ths.py +17 -9
- akshare/bond/bond_cbond.py +19 -14
- akshare/bond/bond_china.py +38 -39
- akshare/bond/bond_china_money.py +1 -1
- akshare/bond/bond_convert.py +10 -9
- akshare/bond/bond_em.py +37 -17
- akshare/bond/bond_summary.py +38 -37
- akshare/bond/bond_zh_cov.py +31 -40
- akshare/bond/bond_zh_sina.py +4 -0
- akshare/bond/cons.py +14 -11
- akshare/cal/__init__.py +0 -0
- akshare/cal/rv.py +170 -0
- akshare/cost/cost_living.py +7 -5
- akshare/crypto/__init__.py +1 -1
- akshare/crypto/crypto_bitcoin_cme.py +9 -7
- akshare/crypto/crypto_hold.py +4 -2
- akshare/currency/currency.py +1 -0
- akshare/currency/currency_china_bank_sina.py +11 -6
- akshare/data/__init__.py +1 -1
- akshare/data/cninfo.js +1 -1
- akshare/datasets.py +10 -21
- akshare/economic/cons.py +10 -3
- akshare/economic/macro_australia.py +74 -69
- akshare/economic/macro_bank.py +95 -653
- akshare/economic/macro_canada.py +92 -81
- akshare/economic/macro_china.py +97 -105
- akshare/economic/macro_china_hk.py +0 -1
- akshare/economic/macro_euro.py +103 -56
- akshare/economic/macro_finance_ths.py +7 -5
- akshare/economic/macro_germany.py +1 -1
- akshare/economic/macro_japan.py +0 -1
- akshare/economic/macro_other.py +1 -6
- akshare/economic/macro_swiss.py +2 -3
- akshare/economic/macro_uk.py +1 -1
- akshare/economic/macro_usa.py +7 -9
- akshare/economic/marco_cnbs.py +11 -6
- akshare/energy/energy_carbon.py +0 -1
- akshare/energy/energy_oil_em.py +1 -2
- akshare/event/cons.py +1 -0
- akshare/exceptions.py +43 -0
- akshare/file_fold/calendar.json +245 -2
- akshare/forex/__init__.py +0 -0
- akshare/forex/cons.py +192 -0
- akshare/forex/forex_em.py +149 -0
- akshare/fortune/fortune_500.py +1 -37
- akshare/fortune/fortune_bloomberg.py +6 -3
- akshare/fortune/fortune_forbes_500.py +3 -6
- akshare/fortune/fortune_hurun.py +2 -1
- akshare/fortune/fortune_xincaifu_500.py +17 -14
- akshare/fund/fund_announcement_em.py +145 -0
- akshare/fund/fund_aum_em.py +49 -35
- akshare/fund/fund_em.py +251 -220
- akshare/fund/fund_etf_em.py +44 -35
- akshare/fund/fund_etf_sina.py +75 -27
- akshare/fund/fund_etf_ths.py +2 -0
- akshare/fund/fund_fee_em.py +172 -0
- akshare/fund/fund_fhsp_em.py +42 -32
- akshare/fund/fund_init_em.py +8 -5
- akshare/fund/fund_lof_em.py +12 -19
- akshare/fund/fund_manager.py +25 -11
- akshare/fund/fund_overview_em.py +42 -0
- akshare/fund/fund_portfolio_em.py +23 -21
- akshare/fund/fund_position_lg.py +19 -8
- akshare/fund/fund_rank_em.py +2 -5
- akshare/fund/fund_rating.py +33 -12
- akshare/fund/fund_scale_em.py +24 -13
- akshare/fund/fund_scale_sina.py +20 -10
- akshare/fund/fund_xq.py +3 -2
- akshare/futures/cons.py +135 -39
- akshare/futures/cot.py +55 -56
- akshare/futures/futures_basis.py +49 -11
- akshare/futures/futures_comex_em.py +1 -0
- akshare/futures/futures_comm_ctp.py +1 -1
- akshare/futures/futures_contract_detail.py +59 -9
- akshare/futures/futures_daily_bar.py +66 -59
- akshare/futures/futures_foreign.py +14 -8
- akshare/futures/futures_hf_em.py +215 -61
- akshare/futures/futures_hist_em.py +191 -0
- akshare/futures/futures_hq_sina.py +5 -3
- akshare/futures/futures_index_ccidx.py +24 -82
- akshare/futures/futures_inventory_99.py +70 -272
- akshare/futures/futures_inventory_em.py +14 -11
- akshare/futures/futures_news_shmet.py +2 -2
- akshare/futures/futures_roll_yield.py +11 -24
- akshare/futures/futures_rule.py +7 -3
- akshare/futures/futures_rule_em.py +38 -0
- akshare/futures/futures_settlement_price_sgx.py +21 -6
- akshare/futures/futures_stock_js.py +0 -1
- akshare/futures/futures_to_spot.py +5 -6
- akshare/futures/futures_warehouse_receipt.py +48 -47
- akshare/futures/futures_zh_sina.py +3 -3
- akshare/futures/receipt.py +298 -165
- akshare/futures/requests_fun.py +16 -3
- akshare/futures/symbol_var.py +32 -13
- akshare/futures_derivative/cons.py +100 -103
- akshare/futures_derivative/futures_contract_info_cffex.py +55 -39
- akshare/futures_derivative/futures_contract_info_czce.py +2 -0
- akshare/futures_derivative/futures_contract_info_dce.py +43 -17
- akshare/futures_derivative/futures_contract_info_gfex.py +43 -31
- akshare/futures_derivative/futures_contract_info_ine.py +43 -34
- akshare/futures_derivative/futures_contract_info_shfe.py +3 -4
- akshare/futures_derivative/futures_cot_sina.py +8 -6
- akshare/futures_derivative/futures_index_sina.py +25 -13
- akshare/fx/cons.py +12 -7
- akshare/fx/fx_c_swap_cm.py +62 -0
- akshare/fx/fx_quote.py +3 -2
- akshare/fx/fx_quote_baidu.py +2 -1
- akshare/hf/__init__.py +1 -1
- akshare/hf/hf_sp500.py +8 -7
- akshare/index/cons.py +132 -28
- akshare/index/index_cni.py +7 -7
- akshare/index/index_cons.py +2 -2
- akshare/index/index_csindex.py +68 -0
- akshare/index/index_cx.py +20 -20
- akshare/index/index_drewry.py +17 -16
- akshare/index/index_eri.py +1 -0
- akshare/index/index_global_em.py +167 -0
- akshare/index/index_global_sina.py +82 -0
- akshare/index/index_kq_fz.py +17 -14
- akshare/index/index_kq_ss.py +1 -0
- akshare/index/index_option_qvix.py +351 -16
- akshare/index/index_research_sw.py +21 -21
- akshare/index/index_spot.py +9 -5
- akshare/index/index_stock_hk.py +5 -9
- akshare/index/index_stock_zh.py +111 -24
- akshare/index/index_stock_zh_csindex.py +3 -367
- akshare/index/index_sugar.py +18 -4
- akshare/index/index_sw.py +10 -2
- akshare/index/index_yw.py +53 -75
- akshare/index/index_zh_em.py +15 -82
- akshare/interest_rate/interbank_rate_em.py +0 -1
- akshare/movie/jm.js +0 -1
- akshare/news/__init__.py +1 -1
- akshare/news/news_baidu.py +395 -222
- akshare/news/news_stock.py +49 -16
- akshare/option/cons.py +2 -2
- akshare/option/option_commodity.py +341 -220
- akshare/option/option_commodity_sina.py +22 -26
- akshare/option/option_contract_info_ctp.py +63 -0
- akshare/option/option_current_sse.py +61 -0
- akshare/option/option_current_szse.py +84 -0
- akshare/option/option_czce.py +37 -9
- akshare/option/option_daily_stats_sse_szse.py +0 -1
- akshare/option/option_em.py +4 -8
- akshare/option/option_finance.py +60 -12
- akshare/option/option_finance_sina.py +7 -7
- akshare/option/option_lhb_em.py +0 -1
- akshare/option/option_margin.py +62 -0
- akshare/option/option_premium_analysis_em.py +58 -53
- akshare/option/option_risk_analysis_em.py +11 -8
- akshare/option/option_risk_indicator_sse.py +3 -4
- akshare/option/option_value_analysis_em.py +62 -55
- akshare/other/__init__.py +1 -1
- akshare/pro/__init__.py +0 -1
- akshare/pro/client.py +6 -4
- akshare/pro/cons.py +3 -2
- akshare/pro/data_pro.py +6 -5
- akshare/qdii/__init__.py +0 -0
- akshare/qdii/qdii_jsl.py +233 -0
- akshare/qhkc/__init__.py +1 -6
- akshare/qhkc/qhkc_api.py +64 -22
- akshare/qhkc_web/__init__.py +1 -6
- akshare/qhkc_web/qhkc_fund.py +10 -6
- akshare/qhkc_web/qhkc_index.py +28 -14
- akshare/qhkc_web/qhkc_tool.py +62 -59
- akshare/rate/__init__.py +1 -1
- akshare/rate/repo_rate.py +36 -32
- akshare/reits/__init__.py +1 -1
- akshare/reits/reits_basic.py +149 -13
- akshare/request.py +117 -0
- akshare/spot/__init__.py +1 -1
- akshare/spot/spot_hog_soozhu.py +165 -3
- akshare/spot/spot_sge.py +70 -9
- akshare/stock/cons.py +60 -23
- akshare/stock/stock_allotment_cninfo.py +8 -8
- akshare/stock/stock_ask_bid_em.py +3 -78
- akshare/stock/stock_board_concept_em.py +160 -35
- akshare/stock/stock_board_industry_em.py +163 -70
- akshare/stock/stock_dividend_cninfo.py +31 -17
- akshare/stock/stock_dzjy_em.py +347 -260
- akshare/stock/stock_fund_em.py +72 -64
- akshare/stock/stock_fund_hold.py +1 -2
- akshare/stock/stock_gsrl_em.py +1 -0
- akshare/stock/stock_hk_comparison_em.py +175 -0
- akshare/stock/stock_hk_famous.py +4 -5
- akshare/stock/stock_hk_fhpx_ths.py +2 -1
- akshare/stock/stock_hk_hot_rank_em.py +1 -0
- akshare/stock/stock_hk_sina.py +84 -36
- akshare/stock/stock_hold_control_cninfo.py +82 -0
- akshare/stock/stock_hold_control_em.py +0 -2
- akshare/stock/stock_hot_rank_em.py +4 -1
- akshare/stock/stock_hot_search_baidu.py +32 -19
- akshare/stock/stock_hot_up_em.py +4 -1
- akshare/stock/stock_hsgt_em.py +155 -0
- akshare/stock/stock_industry.py +1 -0
- akshare/stock/stock_industry_cninfo.py +1 -2
- akshare/stock/stock_info.py +6 -4
- akshare/stock/stock_info_em.py +17 -11
- akshare/stock/stock_intraday_em.py +4 -78
- akshare/stock/stock_intraday_sina.py +2 -2
- akshare/stock/stock_news_cx.py +39 -0
- akshare/stock/stock_profile_cninfo.py +7 -7
- akshare/stock/stock_profile_em.py +302 -0
- akshare/stock/stock_rank_forecast.py +6 -5
- akshare/stock/stock_repurchase_em.py +7 -2
- akshare/stock/stock_share_changes_cninfo.py +7 -5
- akshare/stock/stock_share_hold.py +24 -20
- akshare/stock/stock_stop.py +6 -6
- akshare/stock/stock_summary.py +153 -417
- akshare/stock/stock_us_famous.py +5 -6
- akshare/stock/stock_us_js.py +3 -2
- akshare/stock/stock_us_pink.py +38 -27
- akshare/stock/stock_us_sina.py +7 -3
- akshare/stock/stock_weibo_nlp.py +18 -20
- akshare/stock/stock_xq.py +24 -22
- akshare/stock/stock_zh_a_sina.py +8 -5
- akshare/stock/stock_zh_a_special.py +240 -243
- akshare/stock/stock_zh_a_tick_tx.py +11 -3
- akshare/stock/stock_zh_ah_tx.py +23 -26
- akshare/stock/stock_zh_b_sina.py +2 -2
- akshare/stock/stock_zh_comparison_em.py +250 -0
- akshare/stock/stock_zh_kcb_sina.py +67 -64
- akshare/stock_a/__init__.py +0 -0
- akshare/stock_a/stock_board_concept_name_em.py +170 -0
- akshare/stock_a/stock_individual_fund_flow_rank.py +258 -0
- akshare/stock_a/stock_zh_a_spot.py +212 -0
- akshare/stock_feature/cons.py +1 -0
- akshare/stock_feature/stock_a_indicator.py +9 -54
- akshare/stock_feature/stock_a_pe_and_pb.py +23 -5
- akshare/stock_feature/stock_account_em.py +0 -1
- akshare/stock_feature/stock_all_pb.py +2 -1
- akshare/stock_feature/stock_analyst_em.py +36 -30
- akshare/stock_feature/stock_board_concept_ths.py +328 -0
- akshare/stock_feature/stock_board_industry_ths.py +57 -2
- akshare/stock_feature/stock_buffett_index_lg.py +10 -8
- akshare/stock_feature/stock_classify_sina.py +3 -6
- akshare/stock_feature/stock_comment_em.py +81 -144
- akshare/stock_feature/stock_congestion_lg.py +2 -1
- akshare/stock_feature/stock_cyq_em.py +5 -11
- akshare/stock_feature/stock_disclosure_cninfo.py +6 -6
- akshare/stock_feature/stock_dxsyl_em.py +121 -74
- akshare/stock_feature/stock_ebs_lg.py +5 -4
- akshare/stock_feature/stock_esg_sina.py +29 -7
- akshare/stock_feature/stock_fhps_em.py +2 -1
- akshare/stock_feature/stock_fhps_ths.py +15 -7
- akshare/stock_feature/stock_fund_flow.py +30 -22
- akshare/stock_feature/stock_gddh_em.py +19 -11
- akshare/stock_feature/stock_gdfx_em.py +226 -113
- akshare/stock_feature/stock_gdhs.py +75 -50
- akshare/stock_feature/stock_gdzjc_em.py +21 -10
- akshare/stock_feature/stock_gpzy_em.py +78 -46
- akshare/stock_feature/stock_gxl_lg.py +3 -2
- akshare/stock_feature/stock_hist_em.py +137 -234
- akshare/stock_feature/stock_hist_tx.py +13 -10
- akshare/stock_feature/stock_hk_valuation_baidu.py +20 -8
- akshare/stock_feature/stock_hot_xq.py +4 -6
- akshare/stock_feature/stock_hsgt_em.py +269 -97
- akshare/stock_feature/stock_hsgt_exchange_rate.py +115 -87
- akshare/stock_feature/stock_hsgt_min_em.py +13 -16
- akshare/stock_feature/stock_info.py +7 -80
- akshare/stock_feature/stock_inner_trade_xq.py +38 -31
- akshare/stock_feature/stock_jgdy_em.py +43 -40
- akshare/stock_feature/stock_lhb_em.py +119 -3
- akshare/stock_feature/stock_margin_em.py +0 -1
- akshare/stock_feature/stock_margin_sse.py +0 -2
- akshare/stock_feature/stock_pankou_em.py +71 -35
- akshare/stock_feature/stock_qsjy_em.py +13 -4
- akshare/stock_feature/stock_report_em.py +151 -7
- akshare/stock_feature/stock_research_report_em.py +55 -20
- akshare/stock_feature/stock_sy_em.py +20 -15
- akshare/stock_feature/stock_technology_ths.py +122 -77
- akshare/stock_feature/stock_tfp_em.py +2 -1
- akshare/stock_feature/stock_three_report_em.py +21 -5
- akshare/stock_feature/stock_ttm_lyr.py +18 -9
- akshare/stock_feature/stock_value_em.py +83 -0
- akshare/stock_feature/stock_yjbb_em.py +58 -32
- akshare/stock_feature/stock_yjyg_cninfo.py +6 -2
- akshare/stock_feature/stock_yjyg_em.py +1 -1
- akshare/stock_feature/stock_yzxdr_em.py +24 -22
- akshare/stock_feature/stock_zdhtmx_em.py +20 -6
- akshare/stock_feature/stock_zh_vote_baidu.py +4 -1
- akshare/stock_feature/stock_ztb_em.py +39 -24
- akshare/stock_fundamental/__init__.py +1 -1
- akshare/stock_fundamental/stock_basic_info_xq.py +119 -0
- akshare/stock_fundamental/{stock_finance_hk.py → stock_finance_hk_em.py} +23 -16
- akshare/stock_fundamental/{stock_finance.py → stock_finance_sina.py} +60 -7
- akshare/stock_fundamental/stock_finance_ths.py +524 -57
- akshare/stock_fundamental/stock_finance_us_em.py +268 -0
- akshare/stock_fundamental/stock_gbjg_em.py +80 -0
- akshare/stock_fundamental/stock_hold.py +26 -17
- akshare/stock_fundamental/stock_ipo_declare.py +1 -0
- akshare/stock_fundamental/stock_kcb_detail_sse.py +10 -10
- akshare/stock_fundamental/stock_kcb_sse.py +26 -25
- akshare/stock_fundamental/stock_notice.py +12 -3
- akshare/stock_fundamental/stock_profit_forecast_em.py +31 -13
- akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py +64 -41
- akshare/stock_fundamental/stock_profit_forecast_ths.py +86 -35
- akshare/stock_fundamental/stock_recommend.py +20 -4
- akshare/stock_fundamental/stock_zygc.py +5 -62
- akshare/utils/context.py +43 -0
- akshare/utils/demjson.py +2009 -1338
- akshare/utils/func.py +49 -2
- akshare/utils/multi_decrypt.py +53 -0
- akshare/utils/token_process.py +6 -5
- {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info}/METADATA +54 -80
- akshare-1.17.99.dist-info/RECORD +409 -0
- {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info}/WHEEL +1 -1
- {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info/licenses}/LICENSE +1 -1
- tests/test_func.py +3 -5
- akshare/bond/bond_futures.py +0 -50
- akshare/bond/bond_investing.py +0 -139
- akshare/crypto/crypto_hist_investing.py +0 -249
- akshare/fund/fund_announcement.py +0 -56
- akshare/futures/futures_international.py +0 -170
- akshare/futures/futures_news_baidu.py +0 -54
- akshare/futures/inventory_data.py +0 -100
- akshare/futures_derivative/futures_index_price_nh.py +0 -61
- akshare/futures_derivative/futures_index_return_nh.py +0 -47
- akshare/futures_derivative/futures_index_volatility_nh.py +0 -53
- akshare/futures_derivative/futures_other_index_nh.py +0 -145
- akshare/index/index_fear_greed_funddb.py +0 -78
- akshare/index/index_investing.py +0 -232
- akshare/sport/__init__.py +0 -6
- akshare/sport/sport_olympic.py +0 -27
- akshare/stock_feature/stock_wencai.py +0 -104
- akshare/stock_fundamental/stock_mda_ym.py +0 -40
- akshare-1.14.49.dist-info/RECORD +0 -387
- {akshare-1.14.49.dist-info → akshare-1.17.99.dist-info}/top_level.txt +0 -0
akshare/fund/fund_em.py
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding:utf-8 -*-
|
|
3
3
|
"""
|
|
4
|
-
Date:
|
|
4
|
+
Date: 2024/12/14 15:00
|
|
5
5
|
Desc: 东方财富网站-天天基金网-基金数据-开放式基金净值
|
|
6
6
|
https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc
|
|
7
|
-
1.基金经理基本数据, 建议包含:基金经理代码,基金经理姓名,从业起始日期,现任基金公司,管理资产总规模,上述数据可在"基金经理列表:
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
1.基金经理基本数据, 建议包含:基金经理代码,基金经理姓名,从业起始日期,现任基金公司,管理资产总规模,上述数据可在"基金经理列表:
|
|
8
|
+
https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc 和
|
|
9
|
+
"基金经理理档案如:https://fund.eastmoney.com/manager/30040164.html 获取.
|
|
10
|
+
2.基金经理任职数据:可调取全部或特定经理,管理的基金数据,建议包含:基金经理代码,基金经理姓名,基金代码,基金简称,
|
|
11
|
+
经理位次(在当前基金的经理中排第几位),起始任职时间,截止任职时间,任职回报.在特定基金的经理信息中可以获取如:
|
|
12
|
+
https://fundf10.eastmoney.com/jjjl_001810.html
|
|
13
|
+
3.在接口:fund_basic"公募基金列表"增加数据"基金经理代码"(或第一基金经理代码),
|
|
14
|
+
"基金经理姓名"(或第一基金经理姓名),"当前基金经理人数","当前经理任职起始时间".
|
|
10
15
|
用户ID:269993
|
|
11
16
|
"""
|
|
17
|
+
|
|
12
18
|
import json
|
|
19
|
+
import math
|
|
13
20
|
import time
|
|
14
21
|
from io import StringIO
|
|
15
22
|
|
|
16
23
|
import pandas as pd
|
|
24
|
+
import py_mini_racer
|
|
17
25
|
import requests
|
|
18
26
|
|
|
19
27
|
from akshare.utils import demjson
|
|
28
|
+
from akshare.utils.cons import headers
|
|
29
|
+
from akshare.utils.tqdm import get_tqdm
|
|
20
30
|
|
|
21
31
|
|
|
22
32
|
def fund_purchase_em() -> pd.DataFrame:
|
|
@@ -26,16 +36,12 @@ def fund_purchase_em() -> pd.DataFrame:
|
|
|
26
36
|
:return: 基金申购状态
|
|
27
37
|
:rtype: pandas.DataFrame
|
|
28
38
|
"""
|
|
29
|
-
url = "
|
|
30
|
-
headers = {
|
|
31
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
32
|
-
}
|
|
39
|
+
url = "https://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
|
|
33
40
|
params = {
|
|
34
41
|
"t": "8",
|
|
35
42
|
"page": "1,50000",
|
|
36
43
|
"js": "reData",
|
|
37
44
|
"sort": "fcode,asc",
|
|
38
|
-
"_": "1641528557742",
|
|
39
45
|
}
|
|
40
46
|
r = requests.get(url, params=params, headers=headers)
|
|
41
47
|
data_text = r.text
|
|
@@ -75,12 +81,18 @@ def fund_purchase_em() -> pd.DataFrame:
|
|
|
75
81
|
"手续费",
|
|
76
82
|
]
|
|
77
83
|
]
|
|
78
|
-
temp_df["下一开放日"] = pd.to_datetime(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
temp_df["
|
|
84
|
+
temp_df["下一开放日"] = pd.to_datetime(
|
|
85
|
+
temp_df["下一开放日"], errors="coerce"
|
|
86
|
+
).dt.date
|
|
87
|
+
temp_df["最新净值/万份收益"] = pd.to_numeric(
|
|
88
|
+
temp_df["最新净值/万份收益"], errors="coerce"
|
|
89
|
+
)
|
|
90
|
+
temp_df["购买起点"] = pd.to_numeric(temp_df["购买起点"], errors="coerce")
|
|
91
|
+
temp_df["日累计限定金额"] = pd.to_numeric(
|
|
92
|
+
temp_df["日累计限定金额"], errors="coerce"
|
|
93
|
+
)
|
|
82
94
|
temp_df["手续费"] = temp_df["手续费"].str.strip("%")
|
|
83
|
-
temp_df["手续费"] = pd.to_numeric(temp_df["手续费"])
|
|
95
|
+
temp_df["手续费"] = pd.to_numeric(temp_df["手续费"], errors="coerce")
|
|
84
96
|
return temp_df
|
|
85
97
|
|
|
86
98
|
|
|
@@ -91,12 +103,9 @@ def fund_name_em() -> pd.DataFrame:
|
|
|
91
103
|
:return: 所有基金的名称和类型
|
|
92
104
|
:rtype: pandas.DataFrame
|
|
93
105
|
"""
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
url = "http://fund.eastmoney.com/js/fundcode_search.js"
|
|
98
|
-
res = requests.get(url, headers=headers)
|
|
99
|
-
text_data = res.text
|
|
106
|
+
url = "https://fund.eastmoney.com/js/fundcode_search.js"
|
|
107
|
+
r = requests.get(url, headers=headers)
|
|
108
|
+
text_data = r.text
|
|
100
109
|
data_json = demjson.decode(text_data.strip("var r = ")[:-1])
|
|
101
110
|
temp_df = pd.DataFrame(data_json)
|
|
102
111
|
temp_df.columns = ["基金代码", "拼音缩写", "基金简称", "基金类型", "拼音全称"]
|
|
@@ -104,7 +113,7 @@ def fund_name_em() -> pd.DataFrame:
|
|
|
104
113
|
|
|
105
114
|
|
|
106
115
|
def fund_info_index_em(
|
|
107
|
-
|
|
116
|
+
symbol: str = "沪深指数", indicator: str = "被动指数型"
|
|
108
117
|
) -> pd.DataFrame:
|
|
109
118
|
"""
|
|
110
119
|
东方财富网站-天天基金网-基金数据-基金信息-指数型
|
|
@@ -113,8 +122,8 @@ def fund_info_index_em(
|
|
|
113
122
|
:type symbol: str
|
|
114
123
|
:param indicator: choice of {"全部", "被动指数型", "增强指数型"}
|
|
115
124
|
:type indicator: str
|
|
116
|
-
:return:
|
|
117
|
-
:rtype:
|
|
125
|
+
:return: 基金信息-指数型
|
|
126
|
+
:rtype: pandas.DataFrame
|
|
118
127
|
"""
|
|
119
128
|
symbol_map = {
|
|
120
129
|
"全部": "",
|
|
@@ -131,7 +140,7 @@ def fund_info_index_em(
|
|
|
131
140
|
"被动指数型": "051",
|
|
132
141
|
"增强指数型": "052",
|
|
133
142
|
}
|
|
134
|
-
url = "
|
|
143
|
+
url = "https://api.fund.eastmoney.com/FundTradeRank/GetRankList"
|
|
135
144
|
if symbol in {"股票指数", "债券指数"}:
|
|
136
145
|
params = {
|
|
137
146
|
"ft": "zs",
|
|
@@ -150,7 +159,6 @@ def fund_info_index_em(
|
|
|
150
159
|
"fr1": indicator_map[indicator],
|
|
151
160
|
"fl": "0",
|
|
152
161
|
"isab": "1",
|
|
153
|
-
"_": "1658888335885",
|
|
154
162
|
}
|
|
155
163
|
else:
|
|
156
164
|
params = {
|
|
@@ -170,7 +178,6 @@ def fund_info_index_em(
|
|
|
170
178
|
"fr1": indicator_map[indicator],
|
|
171
179
|
"fl": "0",
|
|
172
180
|
"isab": "1",
|
|
173
|
-
"_": "1658888335885",
|
|
174
181
|
}
|
|
175
182
|
headers = {
|
|
176
183
|
"Accept": "*/*",
|
|
@@ -180,8 +187,9 @@ def fund_info_index_em(
|
|
|
180
187
|
"Host": "api.fund.eastmoney.com",
|
|
181
188
|
"Pragma": "no-cache",
|
|
182
189
|
"Proxy-Connection": "keep-alive",
|
|
183
|
-
"Referer": "
|
|
184
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
190
|
+
"Referer": "https://fund.eastmoney.com/",
|
|
191
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
192
|
+
"Chrome/103.0.0.0 Safari/537.36",
|
|
185
193
|
}
|
|
186
194
|
r = requests.get(url, params=params, headers=headers)
|
|
187
195
|
data_json = r.json()
|
|
@@ -241,19 +249,18 @@ def fund_info_index_em(
|
|
|
241
249
|
temp_df["跟踪标的"] = symbol
|
|
242
250
|
temp_df["跟踪方式"] = indicator
|
|
243
251
|
|
|
244
|
-
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"])
|
|
245
|
-
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"])
|
|
246
|
-
temp_df["近1周"] = pd.to_numeric(temp_df["近1周"])
|
|
247
|
-
temp_df["近1月"] = pd.to_numeric(temp_df["近1月"])
|
|
248
|
-
temp_df["近3月"] = pd.to_numeric(temp_df["近3月"])
|
|
249
|
-
temp_df["近6月"] = pd.to_numeric(temp_df["近6月"])
|
|
250
|
-
temp_df["近1年"] = pd.to_numeric(temp_df["近1年"])
|
|
251
|
-
temp_df["近2年"] = pd.to_numeric(temp_df["近2年"])
|
|
252
|
-
temp_df["近3年"] = pd.to_numeric(temp_df["近3年"])
|
|
253
|
-
temp_df["今年来"] = pd.to_numeric(temp_df["今年来"])
|
|
254
|
-
temp_df["成立来"] = pd.to_numeric(temp_df["成立来"])
|
|
255
|
-
temp_df["手续费"] = pd.to_numeric(temp_df["手续费"])
|
|
256
|
-
|
|
252
|
+
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
|
|
253
|
+
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce")
|
|
254
|
+
temp_df["近1周"] = pd.to_numeric(temp_df["近1周"], errors="coerce")
|
|
255
|
+
temp_df["近1月"] = pd.to_numeric(temp_df["近1月"], errors="coerce")
|
|
256
|
+
temp_df["近3月"] = pd.to_numeric(temp_df["近3月"], errors="coerce")
|
|
257
|
+
temp_df["近6月"] = pd.to_numeric(temp_df["近6月"], errors="coerce")
|
|
258
|
+
temp_df["近1年"] = pd.to_numeric(temp_df["近1年"], errors="coerce")
|
|
259
|
+
temp_df["近2年"] = pd.to_numeric(temp_df["近2年"], errors="coerce")
|
|
260
|
+
temp_df["近3年"] = pd.to_numeric(temp_df["近3年"], errors="coerce")
|
|
261
|
+
temp_df["今年来"] = pd.to_numeric(temp_df["今年来"], errors="coerce")
|
|
262
|
+
temp_df["成立来"] = pd.to_numeric(temp_df["成立来"], errors="coerce")
|
|
263
|
+
temp_df["手续费"] = pd.to_numeric(temp_df["手续费"], errors="coerce")
|
|
257
264
|
return temp_df
|
|
258
265
|
|
|
259
266
|
|
|
@@ -264,10 +271,7 @@ def fund_open_fund_daily_em() -> pd.DataFrame:
|
|
|
264
271
|
:return: 当前交易日的所有开放式基金净值数据
|
|
265
272
|
:rtype: pandas.DataFrame
|
|
266
273
|
"""
|
|
267
|
-
|
|
268
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
269
|
-
}
|
|
270
|
-
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
|
|
274
|
+
url = "https://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
|
|
271
275
|
params = {
|
|
272
276
|
"t": "1",
|
|
273
277
|
"lx": "1",
|
|
@@ -275,7 +279,7 @@ def fund_open_fund_daily_em() -> pd.DataFrame:
|
|
|
275
279
|
"gsid": "",
|
|
276
280
|
"text": "",
|
|
277
281
|
"sort": "zdf,desc",
|
|
278
|
-
"page": "1,
|
|
282
|
+
"page": "1,50000",
|
|
279
283
|
"dt": "1580914040623",
|
|
280
284
|
"atfc": "",
|
|
281
285
|
"onlySale": "0",
|
|
@@ -327,11 +331,11 @@ def fund_open_fund_daily_em() -> pd.DataFrame:
|
|
|
327
331
|
|
|
328
332
|
|
|
329
333
|
def fund_open_fund_info_em(
|
|
330
|
-
|
|
334
|
+
symbol: str = "710001", indicator: str = "单位净值走势", period: str = "成立来"
|
|
331
335
|
) -> pd.DataFrame:
|
|
332
336
|
"""
|
|
333
337
|
东方财富网-天天基金网-基金数据-开放式基金净值
|
|
334
|
-
https://fund.eastmoney.com/fund.html
|
|
338
|
+
https://fund.eastmoney.com/fund.html
|
|
335
339
|
:param symbol: 基金代码; 可以通过调用 ak.fund_open_fund_daily_em() 获取所有开放式基金代码
|
|
336
340
|
:type symbol: str
|
|
337
341
|
:param indicator: 需要获取的指标
|
|
@@ -341,32 +345,24 @@ def fund_open_fund_info_em(
|
|
|
341
345
|
:return: 指定基金指定指标的数据
|
|
342
346
|
:rtype: pandas.DataFrame
|
|
343
347
|
"""
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
348
|
-
}
|
|
348
|
+
from akshare.utils.cons import headers
|
|
349
|
+
|
|
350
|
+
url = f"https://fund.eastmoney.com/pingzhongdata/{symbol}.js" # 各类数据都在里面
|
|
349
351
|
r = requests.get(url, headers=headers)
|
|
350
352
|
data_text = r.text
|
|
351
353
|
|
|
354
|
+
js_code = py_mini_racer.MiniRacer()
|
|
355
|
+
js_code.eval(data_text)
|
|
356
|
+
|
|
352
357
|
# 单位净值走势
|
|
353
358
|
if indicator == "单位净值走势":
|
|
354
|
-
|
|
355
|
-
data_json = demjson.decode(
|
|
356
|
-
data_text[
|
|
357
|
-
data_text.find("Data_netWorthTrend")
|
|
358
|
-
+ 21: data_text.find("Data_ACWorthTrend")
|
|
359
|
-
- 15
|
|
360
|
-
]
|
|
361
|
-
)
|
|
362
|
-
except:
|
|
363
|
-
return pd.DataFrame()
|
|
359
|
+
data_json = js_code.execute("Data_netWorthTrend")
|
|
364
360
|
temp_df = pd.DataFrame(data_json)
|
|
365
361
|
if temp_df.empty:
|
|
366
362
|
return pd.DataFrame()
|
|
367
|
-
temp_df["x"] = pd.to_datetime(
|
|
368
|
-
|
|
369
|
-
)
|
|
363
|
+
temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert(
|
|
364
|
+
"Asia/Shanghai"
|
|
365
|
+
)
|
|
370
366
|
temp_df["x"] = temp_df["x"].dt.date
|
|
371
367
|
temp_df.columns = [
|
|
372
368
|
"净值日期",
|
|
@@ -381,30 +377,23 @@ def fund_open_fund_info_em(
|
|
|
381
377
|
"日增长率",
|
|
382
378
|
]
|
|
383
379
|
]
|
|
384
|
-
temp_df["净值日期"] = pd.to_datetime(
|
|
380
|
+
temp_df["净值日期"] = pd.to_datetime(
|
|
381
|
+
temp_df["净值日期"], errors="coerce"
|
|
382
|
+
).dt.date
|
|
385
383
|
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
|
|
386
384
|
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce")
|
|
387
385
|
return temp_df
|
|
388
386
|
|
|
389
387
|
# 累计净值走势
|
|
390
388
|
if indicator == "累计净值走势":
|
|
391
|
-
|
|
392
|
-
data_json = demjson.decode(
|
|
393
|
-
data_text[
|
|
394
|
-
data_text.find("Data_ACWorthTrend")
|
|
395
|
-
+ 20: data_text.find("Data_grandTotal")
|
|
396
|
-
- 16
|
|
397
|
-
]
|
|
398
|
-
)
|
|
399
|
-
except:
|
|
400
|
-
return pd.DataFrame()
|
|
389
|
+
data_json = js_code.execute("Data_ACWorthTrend")
|
|
401
390
|
temp_df = pd.DataFrame(data_json)
|
|
402
391
|
if temp_df.empty:
|
|
403
392
|
return pd.DataFrame()
|
|
404
393
|
temp_df.columns = ["x", "y"]
|
|
405
|
-
temp_df["x"] = pd.to_datetime(
|
|
406
|
-
|
|
407
|
-
)
|
|
394
|
+
temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert(
|
|
395
|
+
"Asia/Shanghai"
|
|
396
|
+
)
|
|
408
397
|
temp_df["x"] = temp_df["x"].dt.date
|
|
409
398
|
temp_df.columns = [
|
|
410
399
|
"净值日期",
|
|
@@ -416,16 +405,16 @@ def fund_open_fund_info_em(
|
|
|
416
405
|
"累计净值",
|
|
417
406
|
]
|
|
418
407
|
]
|
|
419
|
-
temp_df["净值日期"] = pd.to_datetime(
|
|
408
|
+
temp_df["净值日期"] = pd.to_datetime(
|
|
409
|
+
temp_df["净值日期"], errors="coerce"
|
|
410
|
+
).dt.date
|
|
420
411
|
temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"], errors="coerce")
|
|
421
412
|
return temp_df
|
|
422
413
|
|
|
423
414
|
# 累计收益率走势
|
|
424
415
|
if indicator == "累计收益率走势":
|
|
425
416
|
url = "https://api.fund.eastmoney.com/pinzhong/LJSYLZS"
|
|
426
|
-
headers = {
|
|
427
|
-
'Referer': 'https://fund.eastmoney.com/'
|
|
428
|
-
}
|
|
417
|
+
headers = {"Referer": "https://fund.eastmoney.com/"}
|
|
429
418
|
period_map = {
|
|
430
419
|
"1月": "m",
|
|
431
420
|
"3月": "q",
|
|
@@ -437,14 +426,13 @@ def fund_open_fund_info_em(
|
|
|
437
426
|
"成立来": "se",
|
|
438
427
|
}
|
|
439
428
|
params = {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
'_': '1704012866899'
|
|
429
|
+
"fundCode": symbol,
|
|
430
|
+
"indexcode": "000300",
|
|
431
|
+
"type": period_map[period],
|
|
444
432
|
}
|
|
445
433
|
r = requests.get(url, params=params, headers=headers)
|
|
446
434
|
data_json = r.json()
|
|
447
|
-
temp_df = pd.DataFrame(data_json[
|
|
435
|
+
temp_df = pd.DataFrame(data_json["Data"][0]["data"])
|
|
448
436
|
temp_df.columns = ["日期", "累计收益率"]
|
|
449
437
|
temp_df["日期"] = pd.to_datetime(
|
|
450
438
|
temp_df["日期"], unit="ms", utc=True
|
|
@@ -455,17 +443,11 @@ def fund_open_fund_info_em(
|
|
|
455
443
|
|
|
456
444
|
# 同类排名走势
|
|
457
445
|
if indicator == "同类排名走势":
|
|
458
|
-
data_json =
|
|
459
|
-
data_text[
|
|
460
|
-
data_text.find("Data_rateInSimilarType")
|
|
461
|
-
+ 25: data_text.find("Data_rateInSimilarPersent")
|
|
462
|
-
- 16
|
|
463
|
-
]
|
|
464
|
-
)
|
|
446
|
+
data_json = js_code.execute("Data_rateInSimilarType")
|
|
465
447
|
temp_df = pd.DataFrame(data_json)
|
|
466
|
-
temp_df["x"] = pd.to_datetime(
|
|
467
|
-
|
|
468
|
-
)
|
|
448
|
+
temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert(
|
|
449
|
+
"Asia/Shanghai"
|
|
450
|
+
)
|
|
469
451
|
temp_df["x"] = temp_df["x"].dt.date
|
|
470
452
|
temp_df.columns = [
|
|
471
453
|
"报告日期",
|
|
@@ -479,25 +461,25 @@ def fund_open_fund_info_em(
|
|
|
479
461
|
"总排名-每日近三月排名",
|
|
480
462
|
]
|
|
481
463
|
]
|
|
482
|
-
temp_df["报告日期"] = pd.to_datetime(
|
|
483
|
-
|
|
484
|
-
|
|
464
|
+
temp_df["报告日期"] = pd.to_datetime(
|
|
465
|
+
temp_df["报告日期"], errors="coerce"
|
|
466
|
+
).dt.date
|
|
467
|
+
temp_df["同类型排名-每日近三月排名"] = pd.to_numeric(
|
|
468
|
+
temp_df["同类型排名-每日近三月排名"], errors="coerce"
|
|
469
|
+
)
|
|
470
|
+
temp_df["总排名-每日近三月排名"] = pd.to_numeric(
|
|
471
|
+
temp_df["总排名-每日近三月排名"], errors="coerce"
|
|
472
|
+
)
|
|
485
473
|
return temp_df
|
|
486
474
|
|
|
487
475
|
# 同类排名百分比
|
|
488
476
|
if indicator == "同类排名百分比":
|
|
489
|
-
data_json =
|
|
490
|
-
data_text[
|
|
491
|
-
data_text.find("Data_rateInSimilarPersent")
|
|
492
|
-
+ 26: data_text.find("Data_fluctuationScale")
|
|
493
|
-
- 23
|
|
494
|
-
]
|
|
495
|
-
)
|
|
477
|
+
data_json = js_code.execute("Data_rateInSimilarPersent")
|
|
496
478
|
temp_df = pd.DataFrame(data_json)
|
|
497
479
|
temp_df.columns = ["x", "y"]
|
|
498
|
-
temp_df["x"] = pd.to_datetime(
|
|
499
|
-
|
|
500
|
-
)
|
|
480
|
+
temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert(
|
|
481
|
+
"Asia/Shanghai"
|
|
482
|
+
)
|
|
501
483
|
temp_df["x"] = temp_df["x"].dt.date
|
|
502
484
|
temp_df.columns = [
|
|
503
485
|
"报告日期",
|
|
@@ -509,7 +491,9 @@ def fund_open_fund_info_em(
|
|
|
509
491
|
"同类型排名-每日近3月收益排名百分比",
|
|
510
492
|
]
|
|
511
493
|
]
|
|
512
|
-
temp_df["报告日期"] = pd.to_datetime(
|
|
494
|
+
temp_df["报告日期"] = pd.to_datetime(
|
|
495
|
+
temp_df["报告日期"], errors="coerce"
|
|
496
|
+
).dt.date
|
|
513
497
|
temp_df["同类型排名-每日近3月收益排名百分比"] = pd.to_numeric(
|
|
514
498
|
temp_df["同类型排名-每日近3月收益排名百分比"], errors="coerce"
|
|
515
499
|
)
|
|
@@ -517,23 +501,32 @@ def fund_open_fund_info_em(
|
|
|
517
501
|
|
|
518
502
|
# 分红送配详情
|
|
519
503
|
if indicator == "分红送配详情":
|
|
520
|
-
url = f"
|
|
504
|
+
url = f"https://fundf10.eastmoney.com/fhsp_{symbol}.html"
|
|
521
505
|
r = requests.get(url, headers=headers)
|
|
522
|
-
|
|
506
|
+
table_num = len(pd.read_html(StringIO(r.text)))
|
|
507
|
+
if table_num == 3:
|
|
508
|
+
temp_df = pd.read_html(StringIO(r.text))[1]
|
|
509
|
+
else:
|
|
510
|
+
temp_df = pd.read_html(StringIO(r.text))[0]
|
|
523
511
|
if temp_df.iloc[0, 1] == "暂无分红信息!":
|
|
524
|
-
return
|
|
512
|
+
return pd.DataFrame()
|
|
525
513
|
else:
|
|
526
514
|
return temp_df
|
|
527
515
|
|
|
528
516
|
# 拆分详情
|
|
529
517
|
if indicator == "拆分详情":
|
|
530
|
-
url = f"
|
|
518
|
+
url = f"https://fundf10.eastmoney.com/fhsp_{symbol}.html"
|
|
531
519
|
r = requests.get(url, headers=headers)
|
|
532
|
-
|
|
520
|
+
table_num = len(pd.read_html(StringIO(r.text)))
|
|
521
|
+
if table_num == 3:
|
|
522
|
+
temp_df = pd.read_html(StringIO(r.text))[2]
|
|
523
|
+
else:
|
|
524
|
+
temp_df = pd.read_html(StringIO(r.text))[1]
|
|
533
525
|
if temp_df.iloc[0, 1] == "暂无拆分信息!":
|
|
534
|
-
return
|
|
526
|
+
return pd.DataFrame()
|
|
535
527
|
else:
|
|
536
528
|
return temp_df
|
|
529
|
+
return pd.DataFrame()
|
|
537
530
|
|
|
538
531
|
|
|
539
532
|
def fund_money_fund_daily_em() -> pd.DataFrame:
|
|
@@ -543,10 +536,7 @@ def fund_money_fund_daily_em() -> pd.DataFrame:
|
|
|
543
536
|
:return: 当前交易日的所有货币型基金收益数据
|
|
544
537
|
:rtype: pandas.DataFrame
|
|
545
538
|
"""
|
|
546
|
-
|
|
547
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
548
|
-
}
|
|
549
|
-
url = "http://fund.eastmoney.com/HBJJ_pjsyl.html"
|
|
539
|
+
url = "https://fund.eastmoney.com/HBJJ_pjsyl.html"
|
|
550
540
|
r = requests.get(url, headers=headers)
|
|
551
541
|
r.encoding = "gb2312"
|
|
552
542
|
show_day = pd.read_html(StringIO(r.text))[1].iloc[0, 5:11].tolist()
|
|
@@ -573,34 +563,43 @@ def fund_money_fund_daily_em() -> pd.DataFrame:
|
|
|
573
563
|
return temp_df
|
|
574
564
|
|
|
575
565
|
|
|
576
|
-
def fund_money_fund_info_em(
|
|
566
|
+
def fund_money_fund_info_em(symbol: str = "000009") -> pd.DataFrame:
|
|
577
567
|
"""
|
|
578
568
|
东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据
|
|
579
|
-
|
|
580
|
-
:param
|
|
581
|
-
:type
|
|
569
|
+
https://fundf10.eastmoney.com/jjjz_004186.html
|
|
570
|
+
:param symbol: 货币型基金代码, 可以通过 fund_money_fund_daily_em 来获取
|
|
571
|
+
:type symbol: str
|
|
582
572
|
:return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据
|
|
583
573
|
:rtype: pandas.DataFrame
|
|
584
574
|
"""
|
|
585
|
-
url = "
|
|
575
|
+
url = "https://api.fund.eastmoney.com/f10/lsjz"
|
|
586
576
|
headers = {
|
|
587
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
588
|
-
"
|
|
577
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
578
|
+
"Chrome/80.0.3987.149 Safari/537.36",
|
|
579
|
+
"Referer": f"https://fundf10.eastmoney.com/jjjz_{symbol}.html",
|
|
580
|
+
"Host": "api.fund.eastmoney.com",
|
|
589
581
|
}
|
|
590
582
|
params = {
|
|
591
|
-
"
|
|
592
|
-
"fundCode": fund,
|
|
583
|
+
"fundCode": symbol,
|
|
593
584
|
"pageIndex": "1",
|
|
594
|
-
"pageSize": "
|
|
585
|
+
"pageSize": "20",
|
|
595
586
|
"startDate": "",
|
|
596
587
|
"endDate": "",
|
|
597
588
|
"_": round(time.time() * 1000),
|
|
598
589
|
}
|
|
599
590
|
r = requests.get(url, params=params, headers=headers)
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
591
|
+
data_json = r.json()
|
|
592
|
+
total_page = math.ceil(int(data_json["TotalCount"]) / 20)
|
|
593
|
+
tqdm = get_tqdm()
|
|
594
|
+
big_list = []
|
|
595
|
+
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
596
|
+
params.update({"pageIndex": page})
|
|
597
|
+
r = requests.get(url, params=params, headers=headers)
|
|
598
|
+
data_json = r.json()
|
|
599
|
+
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
|
|
600
|
+
big_list.append(temp_df)
|
|
601
|
+
big_df = pd.concat(big_list, ignore_index=True)
|
|
602
|
+
big_df.columns = [
|
|
604
603
|
"净值日期",
|
|
605
604
|
"每万份收益",
|
|
606
605
|
"7日年化收益率",
|
|
@@ -615,22 +614,27 @@ def fund_money_fund_info_em(fund: str = "000009") -> pd.DataFrame:
|
|
|
615
614
|
"_",
|
|
616
615
|
"_",
|
|
617
616
|
]
|
|
618
|
-
|
|
619
|
-
|
|
617
|
+
big_df.sort_values(by=["净值日期"], inplace=True, ignore_index=True)
|
|
618
|
+
big_df = big_df[["净值日期", "每万份收益", "7日年化收益率", "申购状态", "赎回状态"]]
|
|
619
|
+
big_df["净值日期"] = pd.to_datetime(big_df["净值日期"], errors="coerce").dt.date
|
|
620
|
+
big_df["每万份收益"] = pd.to_numeric(big_df["每万份收益"], errors="coerce")
|
|
621
|
+
big_df["7日年化收益率"] = pd.to_numeric(big_df["7日年化收益率"], errors="coerce")
|
|
622
|
+
return big_df
|
|
620
623
|
|
|
621
624
|
|
|
622
625
|
def fund_financial_fund_daily_em() -> pd.DataFrame:
|
|
623
626
|
"""
|
|
624
627
|
东方财富网站-天天基金网-基金数据-理财型基金收益
|
|
625
628
|
# 该接口暂无数据
|
|
626
|
-
|
|
629
|
+
https://fund.eastmoney.com/lcjj.html#1_1__0__ljjz,desc_1_os1
|
|
627
630
|
:return: 当前交易日的所有理财型基金收益
|
|
628
631
|
:rtype: pandas.DataFrame
|
|
629
632
|
"""
|
|
630
|
-
url = "
|
|
633
|
+
url = "https://api.fund.eastmoney.com/FundNetValue/GetLCJJJZ"
|
|
631
634
|
headers = {
|
|
632
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
633
|
-
"
|
|
635
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
636
|
+
"Chrome/80.0.3987.149 Safari/537.36",
|
|
637
|
+
"Referer": "https://fund.eastmoney.com/lcjj.html",
|
|
634
638
|
}
|
|
635
639
|
params = {
|
|
636
640
|
"letter": "",
|
|
@@ -641,13 +645,12 @@ def fund_financial_fund_daily_em() -> pd.DataFrame:
|
|
|
641
645
|
"AttentionCodes": "",
|
|
642
646
|
"cycle": "",
|
|
643
647
|
"OnlySale": "1",
|
|
644
|
-
"_": "1588248310234",
|
|
645
648
|
}
|
|
646
649
|
r = requests.get(url, params=params, headers=headers)
|
|
647
650
|
data_json = r.json()
|
|
648
651
|
temp_df = pd.DataFrame(data_json["Data"]["List"])
|
|
649
652
|
if temp_df.empty:
|
|
650
|
-
return
|
|
653
|
+
return pd.DataFrame()
|
|
651
654
|
show_day = data_json["Data"]["showday"]
|
|
652
655
|
data_df = temp_df[
|
|
653
656
|
[
|
|
@@ -701,10 +704,11 @@ def fund_financial_fund_info_em(symbol: str = "000134") -> pd.DataFrame:
|
|
|
701
704
|
:return: 东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值明细
|
|
702
705
|
:rtype: pandas.DataFrame
|
|
703
706
|
"""
|
|
704
|
-
url = "
|
|
707
|
+
url = "https://api.fund.eastmoney.com/f10/lsjz"
|
|
705
708
|
headers = {
|
|
706
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
707
|
-
"
|
|
709
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
710
|
+
"Chrome/80.0.3987.149 Safari/537.36",
|
|
711
|
+
"Referer": f"https://fundf10.eastmoney.com/jjjz_{symbol}.html",
|
|
708
712
|
}
|
|
709
713
|
params = {
|
|
710
714
|
"callback": "jQuery18307915911837995662_1588249228826",
|
|
@@ -717,7 +721,7 @@ def fund_financial_fund_info_em(symbol: str = "000134") -> pd.DataFrame:
|
|
|
717
721
|
}
|
|
718
722
|
r = requests.get(url, params=params, headers=headers)
|
|
719
723
|
text_data = r.text
|
|
720
|
-
data_json = demjson.decode(text_data[text_data.find("{"): -1])
|
|
724
|
+
data_json = demjson.decode(text_data[text_data.find("{") : -1])
|
|
721
725
|
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
|
|
722
726
|
temp_df.columns = [
|
|
723
727
|
"净值日期",
|
|
@@ -734,27 +738,38 @@ def fund_financial_fund_info_em(symbol: str = "000134") -> pd.DataFrame:
|
|
|
734
738
|
"_",
|
|
735
739
|
"分红送配",
|
|
736
740
|
]
|
|
737
|
-
temp_df = temp_df[
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
741
|
+
temp_df = temp_df[
|
|
742
|
+
[
|
|
743
|
+
"净值日期",
|
|
744
|
+
"单位净值",
|
|
745
|
+
"累计净值",
|
|
746
|
+
"日增长率",
|
|
747
|
+
"申购状态",
|
|
748
|
+
"赎回状态",
|
|
749
|
+
"分红送配",
|
|
750
|
+
]
|
|
751
|
+
]
|
|
752
|
+
temp_df.sort_values(["净值日期"], inplace=True, ignore_index=True)
|
|
753
|
+
temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).dt.date
|
|
754
|
+
temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce")
|
|
755
|
+
temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"], errors="coerce")
|
|
756
|
+
temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce")
|
|
743
757
|
return temp_df
|
|
744
758
|
|
|
745
759
|
|
|
746
760
|
def fund_graded_fund_daily_em() -> pd.DataFrame:
|
|
747
761
|
"""
|
|
748
762
|
东方财富网站-天天基金网-基金数据-分级基金净值
|
|
749
|
-
|
|
763
|
+
https://fund.eastmoney.com/fjjj.html#1_1__0__zdf,desc_1
|
|
750
764
|
:return: 当前交易日的所有分级基金净值
|
|
751
765
|
:rtype: pandas.DataFrame
|
|
752
766
|
"""
|
|
767
|
+
url = "https://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
|
|
753
768
|
headers = {
|
|
754
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
755
|
-
"
|
|
769
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
770
|
+
"Chrome/80.0.3987.149 Safari/537.36",
|
|
771
|
+
"Referer": "https://fund.eastmoney.com/fjjj.html",
|
|
756
772
|
}
|
|
757
|
-
url = "http://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx"
|
|
758
773
|
params = {
|
|
759
774
|
"t": "1",
|
|
760
775
|
"lx": "9",
|
|
@@ -811,34 +826,42 @@ def fund_graded_fund_daily_em() -> pd.DataFrame:
|
|
|
811
826
|
return data_df
|
|
812
827
|
|
|
813
828
|
|
|
814
|
-
def fund_graded_fund_info_em(
|
|
829
|
+
def fund_graded_fund_info_em(symbol: str = "150232") -> pd.DataFrame:
|
|
815
830
|
"""
|
|
816
831
|
东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
|
|
817
|
-
|
|
818
|
-
:param
|
|
819
|
-
:type
|
|
832
|
+
https://fundf10.eastmoney.com/jjjz_150232.html
|
|
833
|
+
:param symbol: 分级基金代码, 可以通过 ak.fund_money_fund_daily_em() 来获取
|
|
834
|
+
:type symbol: str
|
|
820
835
|
:return: 东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细
|
|
821
836
|
:rtype: pandas.DataFrame
|
|
822
837
|
"""
|
|
823
|
-
url = "
|
|
838
|
+
url = "https://api.fund.eastmoney.com/f10/lsjz"
|
|
824
839
|
headers = {
|
|
825
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
826
|
-
"
|
|
840
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
841
|
+
"Chrome/80.0.3987.149 Safari/537.36",
|
|
842
|
+
"Referer": f"https://fundf10.eastmoney.com/jjjz_{symbol}.html",
|
|
827
843
|
}
|
|
828
844
|
params = {
|
|
829
|
-
"
|
|
830
|
-
"fundCode": fund,
|
|
845
|
+
"fundCode": symbol,
|
|
831
846
|
"pageIndex": "1",
|
|
832
|
-
"pageSize": "
|
|
847
|
+
"pageSize": "20",
|
|
833
848
|
"startDate": "",
|
|
834
849
|
"endDate": "",
|
|
835
850
|
"_": round(time.time() * 1000),
|
|
836
851
|
}
|
|
837
852
|
r = requests.get(url, params=params, headers=headers)
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
853
|
+
data_json = r.json()
|
|
854
|
+
total_page = math.ceil(int(data_json["TotalCount"]) / 20)
|
|
855
|
+
tqdm = get_tqdm()
|
|
856
|
+
big_list = []
|
|
857
|
+
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
858
|
+
params.update({"pageIndex": page})
|
|
859
|
+
r = requests.get(url, params=params, headers=headers)
|
|
860
|
+
data_json = r.json()
|
|
861
|
+
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
|
|
862
|
+
big_list.append(temp_df)
|
|
863
|
+
big_df = pd.concat(big_list, ignore_index=True)
|
|
864
|
+
big_df.columns = [
|
|
842
865
|
"净值日期",
|
|
843
866
|
"单位净值",
|
|
844
867
|
"累计净值",
|
|
@@ -853,21 +876,25 @@ def fund_graded_fund_info_em(fund: str = "150232") -> pd.DataFrame:
|
|
|
853
876
|
"_",
|
|
854
877
|
"_",
|
|
855
878
|
]
|
|
856
|
-
|
|
857
|
-
|
|
879
|
+
big_df.sort_values(by=["净值日期"], inplace=True, ignore_index=True)
|
|
880
|
+
big_df = big_df[
|
|
881
|
+
["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"]
|
|
882
|
+
]
|
|
883
|
+
big_df["净值日期"] = pd.to_datetime(big_df["净值日期"], errors="coerce").dt.date
|
|
884
|
+
big_df["单位净值"] = pd.to_numeric(big_df["单位净值"], errors="coerce")
|
|
885
|
+
big_df["累计净值"] = pd.to_numeric(big_df["累计净值"], errors="coerce")
|
|
886
|
+
big_df["日增长率"] = pd.to_numeric(big_df["日增长率"], errors="coerce")
|
|
887
|
+
return big_df
|
|
858
888
|
|
|
859
889
|
|
|
860
890
|
def fund_etf_fund_daily_em() -> pd.DataFrame:
|
|
861
891
|
"""
|
|
862
892
|
东方财富网-天天基金网-基金数据-场内交易基金
|
|
863
|
-
|
|
893
|
+
https://fund.eastmoney.com/cnjy_dwjz.html
|
|
864
894
|
:return: 当前交易日的所有场内交易基金数据
|
|
865
895
|
:rtype: pandas.DataFrame
|
|
866
896
|
"""
|
|
867
|
-
|
|
868
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
869
|
-
}
|
|
870
|
-
url = "http://fund.eastmoney.com/cnjy_dwjz.html"
|
|
897
|
+
url = "https://fund.eastmoney.com/cnjy_dwjz.html"
|
|
871
898
|
r = requests.get(url, headers=headers)
|
|
872
899
|
r.encoding = "gb2312"
|
|
873
900
|
show_day = pd.read_html(StringIO(r.text))[1].iloc[0, 6:10].tolist()
|
|
@@ -875,7 +902,7 @@ def fund_etf_fund_daily_em() -> pd.DataFrame:
|
|
|
875
902
|
temp_df_columns = temp_df.iloc[0, :].tolist()[1:]
|
|
876
903
|
temp_df = temp_df.iloc[1:, 1:]
|
|
877
904
|
temp_df.columns = temp_df_columns
|
|
878
|
-
temp_df["基金简称"] = temp_df["基金简称"].str.
|
|
905
|
+
temp_df["基金简称"] = temp_df["基金简称"].str.replace("行情吧档案", '')
|
|
879
906
|
temp_df.reset_index(inplace=True, drop=True)
|
|
880
907
|
temp_df.columns = [
|
|
881
908
|
"基金代码",
|
|
@@ -894,13 +921,13 @@ def fund_etf_fund_daily_em() -> pd.DataFrame:
|
|
|
894
921
|
|
|
895
922
|
|
|
896
923
|
def fund_etf_fund_info_em(
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
924
|
+
fund: str = "511280",
|
|
925
|
+
start_date: str = "20000101",
|
|
926
|
+
end_date: str = "20500101",
|
|
900
927
|
) -> pd.DataFrame:
|
|
901
928
|
"""
|
|
902
929
|
东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
|
|
903
|
-
|
|
930
|
+
https://fundf10.eastmoney.com/jjjz_511280.html
|
|
904
931
|
:param fund: 场内交易基金代码, 可以通过 fund_etf_fund_daily_em 来获取
|
|
905
932
|
:type fund: str
|
|
906
933
|
:param start_date: 开始统计时间
|
|
@@ -910,25 +937,33 @@ def fund_etf_fund_info_em(
|
|
|
910
937
|
:return: 东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细
|
|
911
938
|
:rtype: pandas.DataFrame
|
|
912
939
|
"""
|
|
913
|
-
url = "
|
|
940
|
+
url = "https://api.fund.eastmoney.com/f10/lsjz"
|
|
914
941
|
headers = {
|
|
915
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
916
|
-
"
|
|
942
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
943
|
+
"Chrome/80.0.3987.149 Safari/537.36",
|
|
944
|
+
"Referer": f"https://fundf10.eastmoney.com/jjjz_{fund}.html",
|
|
917
945
|
}
|
|
918
946
|
params = {
|
|
919
947
|
"fundCode": fund,
|
|
920
948
|
"pageIndex": "1",
|
|
921
|
-
"pageSize": "
|
|
922
|
-
"startDate": "-".join(
|
|
923
|
-
[start_date[:4], start_date[4:6], start_date[6:]]
|
|
924
|
-
),
|
|
949
|
+
"pageSize": "20",
|
|
950
|
+
"startDate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]),
|
|
925
951
|
"endDate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]),
|
|
926
952
|
"_": round(time.time() * 1000),
|
|
927
953
|
}
|
|
928
954
|
r = requests.get(url, params=params, headers=headers)
|
|
929
955
|
data_json = r.json()
|
|
930
|
-
|
|
931
|
-
|
|
956
|
+
total_page = math.ceil(data_json["TotalCount"] / 20)
|
|
957
|
+
df_list = []
|
|
958
|
+
tqdm = get_tqdm()
|
|
959
|
+
for page in tqdm(range(1, total_page + 1), leave=False):
|
|
960
|
+
params.update({"pageIndex": page})
|
|
961
|
+
r = requests.get(url, params=params, headers=headers)
|
|
962
|
+
data_json = r.json()
|
|
963
|
+
temp_df = pd.DataFrame(data_json["Data"]["LSJZList"])
|
|
964
|
+
df_list.append(temp_df)
|
|
965
|
+
big_df = pd.concat(df_list)
|
|
966
|
+
big_df.columns = [
|
|
932
967
|
"净值日期",
|
|
933
968
|
"单位净值",
|
|
934
969
|
"累计净值",
|
|
@@ -943,19 +978,21 @@ def fund_etf_fund_info_em(
|
|
|
943
978
|
"_",
|
|
944
979
|
"_",
|
|
945
980
|
]
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
981
|
+
big_df = big_df[
|
|
982
|
+
["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"]
|
|
983
|
+
]
|
|
984
|
+
big_df["净值日期"] = pd.to_datetime(big_df["净值日期"], errors="coerce").dt.date
|
|
985
|
+
big_df["单位净值"] = pd.to_numeric(big_df["单位净值"], errors="coerce")
|
|
986
|
+
big_df["累计净值"] = pd.to_numeric(big_df["累计净值"], errors="coerce")
|
|
987
|
+
big_df["日增长率"] = pd.to_numeric(big_df["日增长率"], errors="coerce")
|
|
988
|
+
big_df.sort_values(["净值日期"], inplace=True, ignore_index=True)
|
|
989
|
+
return big_df
|
|
953
990
|
|
|
954
991
|
|
|
955
992
|
def fund_value_estimation_em(symbol: str = "全部") -> pd.DataFrame:
|
|
956
993
|
"""
|
|
957
994
|
东方财富网-数据中心-净值估算
|
|
958
|
-
|
|
995
|
+
https://fund.eastmoney.com/fundguzhi.html
|
|
959
996
|
:param symbol: choice of {'全部', '股票型', '混合型', '债券型', '指数型', 'QDII', 'ETF联接', 'LOF', '场内交易基金'}
|
|
960
997
|
:type symbol: str
|
|
961
998
|
:return: 近期净值估算数据
|
|
@@ -972,10 +1009,11 @@ def fund_value_estimation_em(symbol: str = "全部") -> pd.DataFrame:
|
|
|
972
1009
|
"LOF": 8,
|
|
973
1010
|
"场内交易基金": 9,
|
|
974
1011
|
}
|
|
975
|
-
url = "
|
|
1012
|
+
url = "https://api.fund.eastmoney.com/FundGuZhi/GetFundGZList"
|
|
976
1013
|
headers = {
|
|
977
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
|
|
978
|
-
"
|
|
1014
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
|
|
1015
|
+
"Chrome/81.0.4044.138 Safari/537.36",
|
|
1016
|
+
"Referer": "https://fund.eastmoney.com/",
|
|
979
1017
|
}
|
|
980
1018
|
params = {
|
|
981
1019
|
"type": symbol_map[symbol],
|
|
@@ -1042,7 +1080,7 @@ def fund_value_estimation_em(symbol: str = "全部") -> pd.DataFrame:
|
|
|
1042
1080
|
|
|
1043
1081
|
|
|
1044
1082
|
def fund_hk_fund_hist_em(
|
|
1045
|
-
|
|
1083
|
+
code: str = "1002200683", symbol: str = "历史净值明细"
|
|
1046
1084
|
) -> pd.DataFrame:
|
|
1047
1085
|
"""
|
|
1048
1086
|
东方财富网-天天基金网-基金数据-香港基金-历史净值明细(分红送配详情)
|
|
@@ -1054,10 +1092,7 @@ def fund_hk_fund_hist_em(
|
|
|
1054
1092
|
:return: 香港基金-历史净值明细(分红送配详情)
|
|
1055
1093
|
:rtype: pandas.DataFrame
|
|
1056
1094
|
"""
|
|
1057
|
-
url = "
|
|
1058
|
-
headers = {
|
|
1059
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
|
|
1060
|
-
}
|
|
1095
|
+
url = "https://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx"
|
|
1061
1096
|
if symbol == "历史净值明细":
|
|
1062
1097
|
params = {
|
|
1063
1098
|
"api": "HKFDApi",
|
|
@@ -1068,7 +1103,6 @@ def fund_hk_fund_hist_em(
|
|
|
1068
1103
|
"pagesize": "1000",
|
|
1069
1104
|
"date1": "",
|
|
1070
1105
|
"date2": "",
|
|
1071
|
-
"_": "1611131371333",
|
|
1072
1106
|
}
|
|
1073
1107
|
r = requests.get(url, params=params, headers=headers)
|
|
1074
1108
|
data_json = r.json()
|
|
@@ -1105,7 +1139,6 @@ def fund_hk_fund_hist_em(
|
|
|
1105
1139
|
"pagesize": "1000",
|
|
1106
1140
|
"date1": "",
|
|
1107
1141
|
"date2": "",
|
|
1108
|
-
"_": "1611131371333",
|
|
1109
1142
|
}
|
|
1110
1143
|
r = requests.get(url, params=params, headers=headers)
|
|
1111
1144
|
data_json = r.json()
|
|
@@ -1146,9 +1179,7 @@ if __name__ == "__main__":
|
|
|
1146
1179
|
fund_name_em_df = fund_name_em()
|
|
1147
1180
|
print(fund_name_em_df)
|
|
1148
1181
|
|
|
1149
|
-
fund_info_index_em_df = fund_info_index_em(
|
|
1150
|
-
symbol="债券指数", indicator="全部"
|
|
1151
|
-
)
|
|
1182
|
+
fund_info_index_em_df = fund_info_index_em(symbol="债券指数", indicator="全部")
|
|
1152
1183
|
print(fund_info_index_em_df)
|
|
1153
1184
|
|
|
1154
1185
|
fund_open_fund_daily_em_df = fund_open_fund_daily_em()
|
|
@@ -1162,7 +1193,7 @@ if __name__ == "__main__":
|
|
|
1162
1193
|
time.sleep(3)
|
|
1163
1194
|
|
|
1164
1195
|
fund_open_fund_info_em_df = fund_open_fund_info_em(
|
|
1165
|
-
symbol="
|
|
1196
|
+
symbol="502010", indicator="累计净值走势", period="成立来"
|
|
1166
1197
|
)
|
|
1167
1198
|
print(fund_open_fund_info_em_df)
|
|
1168
1199
|
time.sleep(3)
|
|
@@ -1186,20 +1217,20 @@ if __name__ == "__main__":
|
|
|
1186
1217
|
time.sleep(3)
|
|
1187
1218
|
|
|
1188
1219
|
fund_open_fund_info_em_df = fund_open_fund_info_em(
|
|
1189
|
-
symbol="
|
|
1220
|
+
symbol="014164", indicator="分红送配详情"
|
|
1190
1221
|
)
|
|
1191
1222
|
print(fund_open_fund_info_em_df)
|
|
1192
1223
|
time.sleep(3)
|
|
1193
1224
|
|
|
1194
1225
|
fund_open_fund_info_em_df = fund_open_fund_info_em(
|
|
1195
|
-
symbol="
|
|
1226
|
+
symbol="005561", indicator="拆分详情"
|
|
1196
1227
|
)
|
|
1197
1228
|
print(fund_open_fund_info_em_df)
|
|
1198
1229
|
|
|
1199
1230
|
fund_money_fund_daily_em_df = fund_money_fund_daily_em()
|
|
1200
1231
|
print(fund_money_fund_daily_em_df)
|
|
1201
1232
|
|
|
1202
|
-
fund_money_fund_info_em_df = fund_money_fund_info_em(
|
|
1233
|
+
fund_money_fund_info_em_df = fund_money_fund_info_em(symbol="000009")
|
|
1203
1234
|
print(fund_money_fund_info_em_df)
|
|
1204
1235
|
|
|
1205
1236
|
fund_financial_fund_daily_em_df = fund_financial_fund_daily_em()
|
|
@@ -1211,7 +1242,7 @@ if __name__ == "__main__":
|
|
|
1211
1242
|
fund_graded_fund_daily_em_df = fund_graded_fund_daily_em()
|
|
1212
1243
|
print(fund_graded_fund_daily_em_df)
|
|
1213
1244
|
|
|
1214
|
-
fund_graded_fund_info_em_df = fund_graded_fund_info_em(
|
|
1245
|
+
fund_graded_fund_info_em_df = fund_graded_fund_info_em(symbol="150232")
|
|
1215
1246
|
print(fund_graded_fund_info_em_df)
|
|
1216
1247
|
|
|
1217
1248
|
fund_etf_fund_daily_em_df = fund_etf_fund_daily_em()
|