Repository: jindaxiang/akshare Branch: main Commit: 9703d169c425 Files: 474 Total size: 6.0 MB Directory structure: gitextract_cj0h4lbg/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ └── akshare_report.md │ └── workflows/ │ ├── main_dev_check.yml │ └── release_and_deploy.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── Dockerfile-Jupyter ├── LICENSE ├── README.md ├── akshare/ │ ├── __init__.py │ ├── _version.py │ ├── air/ │ │ ├── __init__.py │ │ ├── air_hebei.py │ │ ├── air_zhenqi.py │ │ ├── cons.py │ │ ├── crypto.js │ │ ├── outcrypto.js │ │ └── sunrise_tad.py │ ├── article/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── epu_index.py │ │ ├── ff_factor.py │ │ ├── fred_md.py │ │ └── risk_rv.py │ ├── bank/ │ │ ├── __init__.py │ │ ├── bank_cbirc_2020.py │ │ └── cons.py │ ├── bond/ │ │ ├── __init__.py │ │ ├── bond_buy_back_em.py │ │ ├── bond_cb_sina.py │ │ ├── bond_cb_ths.py │ │ ├── bond_cbond.py │ │ ├── bond_china.py │ │ ├── bond_china_money.py │ │ ├── bond_convert.py │ │ ├── bond_em.py │ │ ├── bond_gb_sina.py │ │ ├── bond_info_cm.py │ │ ├── bond_issue_cninfo.py │ │ ├── bond_nafmii.py │ │ ├── bond_summary.py │ │ ├── bond_zh_cov.py │ │ ├── bond_zh_sina.py │ │ └── cons.py │ ├── cal/ │ │ ├── __init__.py │ │ └── rv.py │ ├── crypto/ │ │ ├── __init__.py │ │ ├── crypto_bitcoin_cme.py │ │ └── crypto_hold.py │ ├── currency/ │ │ ├── __init__.py │ │ ├── currency.py │ │ ├── currency_china_bank_sina.py │ │ └── currency_safe.py │ ├── data/ │ │ ├── __init__.py │ │ ├── cninfo.js │ │ └── ths.js │ ├── datasets.py │ ├── economic/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── macro_australia.py │ │ ├── macro_bank.py │ │ ├── macro_canada.py │ │ ├── macro_china.py │ │ ├── macro_china_hk.py │ │ ├── macro_china_nbs.py │ │ ├── macro_constitute.py │ │ ├── macro_euro.py │ │ ├── macro_finance_ths.py │ │ ├── macro_germany.py │ │ ├── macro_info_ws.py │ │ ├── macro_japan.py │ │ ├── macro_other.py │ │ ├── macro_swiss.py │ │ ├── macro_uk.py │ │ ├── macro_usa.py │ │ └── marco_cnbs.py │ ├── energy/ │ │ ├── __init__.py │ │ ├── energy_carbon.py │ │ └── energy_oil_em.py │ ├── event/ │ │ ├── __init__.py │ │ ├── cons.py │ │ └── migration.py │ ├── exceptions.py │ ├── file_fold/ │ │ ├── __init__.py │ │ └── calendar.json │ ├── forex/ │ │ ├── __init__.py │ │ ├── cons.py │ │ └── forex_em.py │ ├── fortune/ │ │ ├── __init__.py │ │ ├── fortune_500.py │ │ ├── fortune_bloomberg.py │ │ ├── fortune_forbes_500.py │ │ ├── fortune_hurun.py │ │ └── fortune_xincaifu_500.py │ ├── fund/ │ │ ├── __init__.py │ │ ├── fund_amac.py │ │ ├── fund_announcement_em.py │ │ ├── fund_aum_em.py │ │ ├── fund_em.py │ │ ├── fund_etf_em.py │ │ ├── fund_etf_sina.py │ │ ├── fund_etf_sse.py │ │ ├── fund_etf_szse.py │ │ ├── fund_etf_ths.py │ │ ├── fund_fee_em.py │ │ ├── fund_fhsp_em.py │ │ ├── fund_init_em.py │ │ ├── fund_init_ths.py │ │ ├── fund_lof_em.py │ │ ├── fund_manager.py │ │ ├── fund_overview_em.py │ │ ├── fund_portfolio_em.py │ │ ├── fund_position_lg.py │ │ ├── fund_rank_em.py │ │ ├── fund_rating.py │ │ ├── fund_report_cninfo.py │ │ ├── fund_scale_em.py │ │ ├── fund_scale_sina.py │ │ └── fund_xq.py │ ├── futures/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── cot.py │ │ ├── futures_basis.py │ │ ├── futures_comex_em.py │ │ ├── futures_comm_ctp.py │ │ ├── futures_comm_js.py │ │ ├── futures_comm_qihuo.py │ │ ├── futures_contract_detail.py │ │ ├── futures_daily_bar.py │ │ ├── futures_foreign.py │ │ ├── futures_hf_em.py │ │ ├── futures_hist_em.py │ │ ├── futures_hq_sina.py │ │ ├── futures_index_ccidx.py │ │ ├── futures_inventory_99.py │ │ ├── futures_inventory_em.py │ │ ├── futures_news_shmet.py │ │ ├── futures_roll_yield.py │ │ ├── futures_rule.py │ │ ├── futures_rule_em.py │ │ ├── futures_settle.py │ │ ├── futures_settlement_price_sgx.py │ │ ├── futures_spot_stock_em.py │ │ ├── futures_stock_js.py │ │ ├── futures_to_spot.py │ │ ├── futures_warehouse_receipt.py │ │ ├── futures_zh_sina.py │ │ ├── receipt.py │ │ ├── requests_fun.py │ │ └── symbol_var.py │ ├── futures_derivative/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── futures_contract_info_cffex.py │ │ ├── futures_contract_info_czce.py │ │ ├── futures_contract_info_dce.py │ │ ├── futures_contract_info_gfex.py │ │ ├── futures_contract_info_ine.py │ │ ├── futures_contract_info_shfe.py │ │ ├── futures_cot_sina.py │ │ ├── futures_hog.py │ │ ├── futures_index_sina.py │ │ └── futures_spot_sys.py │ ├── fx/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── currency_investing.py │ │ ├── fx_c_swap_cm.py │ │ ├── fx_quote.py │ │ └── fx_quote_baidu.py │ ├── hf/ │ │ ├── __init__.py │ │ └── hf_sp500.py │ ├── index/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── index_cflp.py │ │ ├── index_cni.py │ │ ├── index_cons.py │ │ ├── index_csindex.py │ │ ├── index_cx.py │ │ ├── index_drewry.py │ │ ├── index_eri.py │ │ ├── index_global_em.py │ │ ├── index_global_sina.py │ │ ├── index_hog.py │ │ ├── index_kq_fz.py │ │ ├── index_kq_ss.py │ │ ├── index_option_qvix.py │ │ ├── index_research_fund_sw.py │ │ ├── index_research_sw.py │ │ ├── index_spot.py │ │ ├── index_stock_hk.py │ │ ├── index_stock_us_sina.py │ │ ├── index_stock_zh.py │ │ ├── index_stock_zh_csindex.py │ │ ├── index_sugar.py │ │ ├── index_sw.py │ │ ├── index_yw.py │ │ ├── index_zh_a_scope.py │ │ └── index_zh_em.py │ ├── interest_rate/ │ │ ├── __init__.py │ │ └── interbank_rate_em.py │ ├── movie/ │ │ ├── __init__.py │ │ ├── artist_yien.py │ │ ├── jm.js │ │ ├── movie_yien.py │ │ └── video_yien.py │ ├── news/ │ │ ├── __init__.py │ │ ├── news_baidu.py │ │ ├── news_cctv.py │ │ └── news_stock.py │ ├── nlp/ │ │ ├── __init__.py │ │ └── nlp_interface.py │ ├── option/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── option_comm_qihuo.py │ │ ├── option_commodity.py │ │ ├── option_commodity_sina.py │ │ ├── option_contract_info_ctp.py │ │ ├── option_current_sse.py │ │ ├── option_current_szse.py │ │ ├── option_czce.py │ │ ├── option_daily_stats_sse_szse.py │ │ ├── option_em.py │ │ ├── option_finance.py │ │ ├── option_finance_sina.py │ │ ├── option_lhb_em.py │ │ ├── option_margin.py │ │ ├── option_premium_analysis_em.py │ │ ├── option_risk_analysis_em.py │ │ ├── option_risk_indicator_sse.py │ │ └── option_value_analysis_em.py │ ├── other/ │ │ ├── __init__.py │ │ ├── other_car_cpca.py │ │ └── other_car_gasgoo.py │ ├── pro/ │ │ ├── __init__.py │ │ ├── client.py │ │ ├── cons.py │ │ └── data_pro.py │ ├── qdii/ │ │ ├── __init__.py │ │ └── qdii_jsl.py │ ├── qhkc/ │ │ ├── __init__.py │ │ └── qhkc_api.py │ ├── qhkc_web/ │ │ ├── __init__.py │ │ ├── qhkc_fund.py │ │ ├── qhkc_index.py │ │ └── qhkc_tool.py │ ├── rate/ │ │ ├── __init__.py │ │ └── repo_rate.py │ ├── reits/ │ │ ├── __init__.py │ │ └── reits_basic.py │ ├── request.py │ ├── spot/ │ │ ├── __init__.py │ │ ├── spot_hog_soozhu.py │ │ ├── spot_price_qh.py │ │ └── spot_sge.py │ ├── stock/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── stock_allotment_cninfo.py │ │ ├── stock_ask_bid_em.py │ │ ├── stock_board_concept_em.py │ │ ├── stock_board_industry_em.py │ │ ├── stock_cg_equity_mortgage.py │ │ ├── stock_cg_guarantee.py │ │ ├── stock_cg_lawsuit.py │ │ ├── stock_dividend_cninfo.py │ │ ├── stock_dzjy_em.py │ │ ├── stock_fund_em.py │ │ ├── stock_fund_hold.py │ │ ├── stock_gsrl_em.py │ │ ├── stock_hk_comparison_em.py │ │ ├── stock_hk_famous.py │ │ ├── stock_hk_fhpx_ths.py │ │ ├── stock_hk_hot_rank_em.py │ │ ├── stock_hk_sina.py │ │ ├── stock_hold_control_cninfo.py │ │ ├── stock_hold_control_em.py │ │ ├── stock_hold_num_cninfo.py │ │ ├── stock_hot_rank_em.py │ │ ├── stock_hot_search_baidu.py │ │ ├── stock_hot_up_em.py │ │ ├── stock_hsgt_em.py │ │ ├── stock_industry.py │ │ ├── stock_industry_cninfo.py │ │ ├── stock_industry_pe_cninfo.py │ │ ├── stock_industry_sw.py │ │ ├── stock_info.py │ │ ├── stock_info_em.py │ │ ├── stock_intraday_em.py │ │ ├── stock_intraday_sina.py │ │ ├── stock_ipo_summary_cninfo.py │ │ ├── stock_new_cninfo.py │ │ ├── stock_news_cx.py │ │ ├── stock_profile_cninfo.py │ │ ├── stock_profile_em.py │ │ ├── stock_rank_forecast.py │ │ ├── stock_repurchase_em.py │ │ ├── stock_share_changes_cninfo.py │ │ ├── stock_share_hold.py │ │ ├── stock_stop.py │ │ ├── stock_summary.py │ │ ├── stock_us_famous.py │ │ ├── stock_us_js.py │ │ ├── stock_us_pink.py │ │ ├── stock_us_sina.py │ │ ├── stock_weibo_nlp.py │ │ ├── stock_xq.py │ │ ├── stock_zh_a_sina.py │ │ ├── stock_zh_a_special.py │ │ ├── stock_zh_a_tick_tx.py │ │ ├── stock_zh_ah_tx.py │ │ ├── stock_zh_b_sina.py │ │ ├── stock_zh_comparison_em.py │ │ ├── stock_zh_kcb_report.py │ │ └── stock_zh_kcb_sina.py │ ├── stock_feature/ │ │ ├── __init__.py │ │ ├── cons.py │ │ ├── stock_a_below_net_asset_statistics.py │ │ ├── stock_a_high_low.py │ │ ├── stock_a_indicator.py │ │ ├── stock_a_pe_and_pb.py │ │ ├── stock_account_em.py │ │ ├── stock_all_pb.py │ │ ├── stock_analyst_em.py │ │ ├── stock_board_concept_ths.py │ │ ├── stock_board_industry_ths.py │ │ ├── stock_buffett_index_lg.py │ │ ├── stock_classify_sina.py │ │ ├── stock_comment_em.py │ │ ├── stock_concept_futu.py │ │ ├── stock_congestion_lg.py │ │ ├── stock_cyq_em.py │ │ ├── stock_disclosure_cninfo.py │ │ ├── stock_dxsyl_em.py │ │ ├── stock_ebs_lg.py │ │ ├── stock_esg_sina.py │ │ ├── stock_fhps_em.py │ │ ├── stock_fhps_ths.py │ │ ├── stock_fund_flow.py │ │ ├── stock_gddh_em.py │ │ ├── stock_gdfx_em.py │ │ ├── stock_gdhs.py │ │ ├── stock_gdzjc_em.py │ │ ├── stock_gpzy_em.py │ │ ├── stock_gxl_lg.py │ │ ├── stock_hist_em.py │ │ ├── stock_hist_tx.py │ │ ├── stock_hk_valuation_baidu.py │ │ ├── stock_hot_xq.py │ │ ├── stock_hsgt_em.py │ │ ├── stock_hsgt_exchange_rate.py │ │ ├── stock_hsgt_min_em.py │ │ ├── stock_info.py │ │ ├── stock_inner_trade_xq.py │ │ ├── stock_irm_cninfo.py │ │ ├── stock_jgdy_em.py │ │ ├── stock_lh_yybpm.py │ │ ├── stock_lhb_em.py │ │ ├── stock_lhb_sina.py │ │ ├── stock_margin_em.py │ │ ├── stock_margin_sse.py │ │ ├── stock_margin_szse.py │ │ ├── stock_market_legu.py │ │ ├── stock_pankou_em.py │ │ ├── stock_qsjy_em.py │ │ ├── stock_report_em.py │ │ ├── stock_research_report_em.py │ │ ├── stock_sns_sseinfo.py │ │ ├── stock_sy_em.py │ │ ├── stock_technology_ths.py │ │ ├── stock_tfp_em.py │ │ ├── stock_three_report_em.py │ │ ├── stock_ttm_lyr.py │ │ ├── stock_us_valuation_baidu.py │ │ ├── stock_value_em.py │ │ ├── stock_yjbb_em.py │ │ ├── stock_yjyg_cninfo.py │ │ ├── stock_yjyg_em.py │ │ ├── stock_yzxdr_em.py │ │ ├── stock_zdhtmx_em.py │ │ ├── stock_zf_pg.py │ │ ├── stock_zh_valuation_baidu.py │ │ ├── stock_zh_vote_baidu.py │ │ ├── stock_ztb_em.py │ │ └── ths.js │ ├── stock_fundamental/ │ │ ├── __init__.py │ │ ├── stock_basic_info_xq.py │ │ ├── stock_finance_hk_em.py │ │ ├── stock_finance_sina.py │ │ ├── stock_finance_ths.py │ │ ├── stock_finance_us_em.py │ │ ├── stock_gbjg_em.py │ │ ├── stock_hold.py │ │ ├── stock_ipo_declare.py │ │ ├── stock_ipo_review.py │ │ ├── stock_ipo_ths.py │ │ ├── stock_ipo_tutor.py │ │ ├── stock_kcb_detail_sse.py │ │ ├── stock_kcb_sse.py │ │ ├── stock_notice.py │ │ ├── stock_profit_forecast_em.py │ │ ├── stock_profit_forecast_hk_etnet.py │ │ ├── stock_profit_forecast_ths.py │ │ ├── stock_recommend.py │ │ ├── stock_register_em.py │ │ ├── stock_restricted_em.py │ │ ├── stock_zygc.py │ │ └── stock_zyjs_ths.py │ ├── tool/ │ │ ├── __init__.py │ │ └── trade_date_hist.py │ └── utils/ │ ├── __init__.py │ ├── cons.py │ ├── context.py │ ├── demjson.py │ ├── func.py │ ├── multi_decrypt.py │ ├── request.py │ ├── token_process.py │ └── tqdm.py ├── docs/ │ ├── README.rst │ ├── akdocker/ │ │ └── akdocker.md │ ├── anaconda.md │ ├── answer.md │ ├── articles.md │ ├── changelog.md │ ├── conf.py │ ├── contributing.md │ ├── data/ │ │ ├── article/ │ │ │ └── article.md │ │ ├── bank/ │ │ │ └── bank.md │ │ ├── bond/ │ │ │ └── bond.md │ │ ├── currency/ │ │ │ └── currency.md │ │ ├── dc/ │ │ │ └── dc.md │ │ ├── energy/ │ │ │ └── energy.md │ │ ├── event/ │ │ │ └── event.md │ │ ├── fund/ │ │ │ ├── fund_private.md │ │ │ └── fund_public.md │ │ ├── futures/ │ │ │ └── futures.md │ │ ├── fx/ │ │ │ └── fx.md │ │ ├── hf/ │ │ │ └── hf.md │ │ ├── index/ │ │ │ └── index.md │ │ ├── index.rst │ │ ├── interest_rate/ │ │ │ └── interest_rate.md │ │ ├── macro/ │ │ │ └── macro.md │ │ ├── nlp/ │ │ │ └── nlp.md │ │ ├── option/ │ │ │ └── option.md │ │ ├── others/ │ │ │ └── others.md │ │ ├── qdii/ │ │ │ └── qdii.md │ │ ├── qhkc/ │ │ │ ├── broker.md │ │ │ ├── commodity.md │ │ │ ├── fund.md │ │ │ ├── fundamental.md │ │ │ ├── index.rst │ │ │ ├── index_data.md │ │ │ └── tools.md │ │ ├── spot/ │ │ │ └── spot.md │ │ ├── stock/ │ │ │ └── stock.md │ │ └── tool/ │ │ └── tool.md │ ├── data_tips.md │ ├── demo.md │ ├── dependency.md │ ├── deploy_http.md │ ├── index.rst │ ├── indicator.md │ ├── installation.md │ ├── introduction.md │ ├── platform.md │ ├── requirements.txt │ ├── special.md │ ├── trade.md │ └── tutorial.md ├── pyproject.toml ├── setup.py └── tests/ ├── __init__.py └── test_func.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/ISSUE_TEMPLATE/akshare_report.md ================================================ --- name: AKShare-问题报告 about: 反馈 AKShare 接口相关的问题 title: AKShare 接口问题报告 labels: bug assignees: '' --- > 由于开源项目维护工作量较大,本 issue 只接受接口报错问题。如有更多问题,推荐加入【财经数据与量化投研】知识社区:https://t.zsxq.com/ZCxUG 。 > 推荐使用 **AKQuant** 进行量化投研:https://akquant.akfamily.xyz ## 重要前提 遇到任何 AKShare 使用问题,请先将您本地的 AKShare 升级到**最新版**,可以通过如下命令升级: ```bash pip install akshare --upgrade # Python 版本需要大于等于 3.9 ``` ## 如何提交问题 请提交以下相关信息,以更精准的解决问题。**不符合提交规范的 issue 会被关闭!** 1. 请先详细阅读 AKShare 文档中对应接口的使用方式:https://akshare.akfamily.xyz 2. 请务必将 AKShare 升级到最新版本 3. 请检查操作系统版本,目前只支持 64 位主流操作系统 4. 请检查 Python 版本,目前只支持 3.9 以上的版本 5. 请提交相关接口的名称和相应的调用代码 6. 接口报错的截图或描述 7. 期望获得的正确结果 ================================================ FILE: .github/workflows/main_dev_check.yml ================================================ # main_dev_check name: Main and Dev Checks on: push: branches: - main - dev pull_request: branches: - main - dev jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.11", "3.12", "3.13", "3.14"] steps: - name: Checkout code uses: actions/checkout@v6 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install . - name: Lint with Ruff run: | pip install ruff ruff format . ruff check . --fix - name: Test with pytest run: | pip install pytest pytest ================================================ FILE: .github/workflows/release_and_deploy.yml ================================================ # release_and_deploy name: Release and Deploy on: push: tags: - 'release-v*.*.*' jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v6 - name: Set up Python uses: actions/setup-python@v6 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip pip install build twine - name: Build and publish package env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python -m build twine upload dist/* - name: Create GitHub release uses: softprops/action-gh-release@v2 with: token: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .gitignore ================================================ # --- Python Core --- __pycache__/ *.py[cod] *$py.class uv.lock # --- Distribution / Packaging --- build/ dist/ *.egg-info/ .eggs/ *.egg MANIFEST *.tar.gz # --- Virtual Environments --- # Common venv naming conventions .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ .venv/ # --- Unit Test / Coverage --- .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover *.py,cover .hypothesis/ .pytest_cache/ htmlcov/ # --- Type Checking --- .mypy_cache/ .dmypy.json dmypy.json # --- Jupyter Notebook --- .ipynb_checkpoints # --- IDEs / Editors --- # JetBrains (IntelliJ, PyCharm, etc.) .idea/ *.iml *.icls /_windows/ /codestyles/ colors # VS Code .vscode/ *.code-workspace # Vim *.swp *.swo # --- OS Generated Files --- # macOS .DS_Store .DS_Store? ._* .Spotlight-V100 .Trashes # Windows ehthumbs.db Thumbs.db # --- Project Specific --- *.bak *.xml /data /tests/data # Documentation docs/build/ docs/_build/ ================================================ FILE: .pre-commit-config.yaml ================================================ # commit setup repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-yaml - id: check-toml - id: check-json - id: end-of-file-fixer - id: trailing-whitespace - id: check-added-large-files args: ['--maxkb=5000'] - id: check-case-conflict - id: detect-private-key - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.15.0 hooks: # Run the linter. - id: ruff args: [--fix] # Run the formatter. - id: ruff-format - repo: https://github.com/compilerla/conventional-pre-commit rev: v4.3.0 hooks: - id: conventional-pre-commit stages: [commit-msg] args: [] ================================================ FILE: .readthedocs.yaml ================================================ # Read the Docs configuration file # https://docs.readthedocs.io/en/stable/config-file/v2.html version: 2 build: os: ubuntu-24.04 tools: python: "3.13" sphinx: configuration: docs/conf.py # fail_on_warning: true python: install: - requirements: docs/requirements.txt ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards Examples of behavior that contributes to a positive environment for our community include: * Demonstrating empathy and kindness toward other people * Being respectful of differing opinions, viewpoints, and experiences * Giving and gracefully accepting constructive feedback * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience * Focusing on what is best not just for us as individuals, but for the overall community Examples of unacceptable behavior include: * The use of sexualized language or imagery, and sexual attention or advances of any kind * Trolling, insulting or derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or email address, without their explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Enforcement Responsibilities Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. ## Scope This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at @albertandking. All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. ## Enforcement Guidelines Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. ### 2. Warning **Community Impact**: A violation through a single incident or series of actions. **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. ### 3. Temporary Ban **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. **Consequence**: A permanent ban from any sort of public interaction within the community. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations]. [homepage]: https://www.contributor-covenant.org [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html [Mozilla CoC]: https://github.com/mozilla/diversity [FAQ]: https://www.contributor-covenant.org/faq [translations]: https://www.contributor-covenant.org/translations ================================================ FILE: CONTRIBUTING.md ================================================ # Contributing to AKShare First off, thanks for taking the time to contribute! ❤️ All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: > - Star the project > - Tweet about it > - Refer this project in your project's readme > - Mention the project at local meetups and tell your friends/colleagues ## Table of Contents - [Code of Conduct](#code-of-conduct) - [I Have a Question](#i-have-a-question) - [I Want To Contribute](#i-want-to-contribute) - [Reporting Bugs](#reporting-bugs) - [Suggesting Enhancements](#suggesting-enhancements) - [Your First Code Contribution](#your-first-code-contribution) - [Improving The Documentation](#improving-the-documentation) - [Styleguides](#styleguides) - [Commit Messages](#commit-messages) - [Join The Project Team](#join-the-project-team) ## Code of Conduct This project and everyone participating in it is governed by the [AKShare Code of Conduct](https://github.com/akfamily/akshareblob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to . ## I Have a Question > If you want to ask a question, we assume that you have read the available [Documentation](https://akshare.akfamily.xyz/). Before you ask a question, it is best to search for existing [Issues](https://github.com/akfamily/akshare/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. If you then still feel the need to ask a question and need clarification, we recommend the following: - Open an [Issue](https://github.com/akfamily/akshare/issues/new). - Provide as much context as you can about what you're running into. - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. We will then take care of the issue as soon as possible. ## I Want To Contribute > ### Legal Notice > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. ### Reporting Bugs #### Before Submitting a Bug Report A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - Make sure that you are using the latest version. - Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://akshare.akfamily.xyz/). If you are looking for support, you might want to check [this section](#i-have-a-question)). - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/akfamily/akshareissues?q=label%3Abug). - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. - Collect information about the bug: - Stack trace (Traceback) - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. - Possibly your input and the output - Can you reliably reproduce the issue? And can you also reproduce it with older versions? #### How Do I Submit a Good Bug Report? > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to . We use GitHub issues to track bugs and errors. If you run into an issue with the project: - Open an [Issue](https://github.com/akfamily/akshare/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) - Explain the behavior you would expect and the actual behavior. - Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. - Provide the information you collected in the previous section. Once it's filed: - The project team will label the issue accordingly. - A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. - If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). ### Suggesting Enhancements This section guides you through submitting an enhancement suggestion for akshare, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. #### Before Submitting an Enhancement - Make sure that you are using the latest version. - Read the [documentation](https://akshare.akfamily.xyz/) carefully and find out if the functionality is already covered, maybe by an individual configuration. - Perform a [search](https://github.com/akfamily/akshare/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. #### How Do I Submit a Good Enhancement Suggestion? Enhancement suggestions are tracked as [GitHub issues](https://github.com/akfamily/akshare/issues). - Use a **clear and descriptive title** for the issue to identify the suggestion. - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. - **Explain why this enhancement would be useful** to most akshare users. You may also want to point out the other projects that solved it better and which could serve as inspiration. ### Your First Code Contribution ### Improving The Documentation ## Styleguides ### Commit Messages ## Join The Project Team ## Attribution This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! ================================================ FILE: Dockerfile ================================================ # 使用精简镜像,镜像体积从 1.2G 下降为约 400M,提高启动效率,同时升级到 Python 3.14.x 提高 20% 以上性能 FROM python:3.14-slim-bullseye # 升级 pip 到最新版 RUN pip install --upgrade pip # 新增 gunicorn 安装,提升并发和并行能力 RUN pip install --no-cache-dir akshare fastapi uvicorn gunicorn -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com --upgrade RUN pip install --no-cache-dir aktools -i https://pypi.org/simple --upgrade # 设置工作目录方便启动 ENV APP_HOME=/usr/local/lib/python3.14/site-packages/aktools WORKDIR $APP_HOME # 默认启动 gunicorn 服务 CMD ["gunicorn", "--bind", "0.0.0.0:8080", "main:app", "-k", "uvicorn.workers.UvicornWorker"] ================================================ FILE: Dockerfile-Jupyter ================================================ # 升级到 Python 3.13.x 提高 20% 以上性能 FROM python:3.14-bullseye # 设定时区 ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # RUN pip install akshare jupyterlab -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com --upgrade RUN pip install --no-cache-dir jupyterlab scikit-learn scipy pandas aktools akshare ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2019-2026 Albert King Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ **资源分享**:对于想了解更多财经数据与量化投研的小伙伴,推荐一个专注于财经数据和量化研究的知识社区。 该社区提供相关文档和视频学习资源,汇集了各类财经数据源和量化投研工具的使用经验。 有兴趣深入学习的朋友可点此[了解更多](https://t.zsxq.com/ZCxUG),也推荐大家关注微信公众号【数据科学实战】。 **重磅推荐**:AKQuant 是一款专为 **量化投研 (Quantitative Research)** 打造的高性能量化回测框架。它以 Rust 铸造极速撮合内核, 以 Python 链接数据与 AI 生态,旨在为量化投资者提供可靠高效的量化投研解决方案。参见[AKQuant](https://github.com/akfamily/akquant) **工具推荐**:期魔方是一款本地化期货量化分析工具,适合数据分析爱好者使用。无需复杂部署,支持数据分析和机器学习功能,研究功能免费开放。 如需了解更多信息可访问[期魔方](https://qmfquant.com)。 ![AKShare Logo](https://github.com/akfamily/akshare/blob/main/assets/images/akshare_logo.jpg) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/akshare.svg)](https://pypi.org/project/akshare/) [![PyPI](https://img.shields.io/pypi/v/akshare.svg)](https://pypi.org/project/akshare/) [![PyPI Downloads](https://static.pepy.tech/personalized-badge/akshare?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/akshare) [![Documentation Status](https://readthedocs.org/projects/akshare/badge/?version=latest)](https://akshare.readthedocs.io/?badge=latest) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![akshare](https://img.shields.io/badge/Data%20Science-AKShare-green)](https://github.com/akfamily/akshare) [![Actions Status](https://github.com/akfamily/akshare/actions/workflows/release_and_deploy.yml/badge.svg)](https://github.com/akfamily/akshare/actions) [![MIT Licence](https://img.shields.io/badge/license-MIT-blue)](https://github.com/akfamily/akshare/blob/main/LICENSE) [![](https://img.shields.io/github/forks/jindaxiang/akshare)](https://github.com/akfamily/akshare) [![](https://img.shields.io/github/stars/jindaxiang/akshare)](https://github.com/akfamily/akshare) [![](https://img.shields.io/github/issues/jindaxiang/akshare)](https://github.com/akfamily/akshare) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) ## Overview [AKShare](https://github.com/akfamily/akshare) requires Python(64 bit) 3.9 or higher and aims to simplify the process of fetching financial data. **Write less, get more!** - Documentation: [中文文档](https://akshare.akfamily.xyz/) ## Installation ### General ```shell pip install akshare --upgrade ``` ### China ```shell pip install akshare -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com --upgrade ``` ### PR Please check out [Documentation](https://akshare.akfamily.xyz/contributing.html) if you want to contribute to AKShare ### Docker #### Pull images ```shell docker pull registry.cn-shanghai.aliyuncs.com/akfamily/aktools:jupyter ``` #### Run Container ```shell docker run -it registry.cn-shanghai.aliyuncs.com/akfamily/aktools:jupyter python ``` #### Test ```python import akshare as ak print(ak.__version__) ``` ## Usage ### Data Code: ```python import akshare as ak stock_zh_a_hist_df = ak.stock_zh_a_hist(symbol="000001", period="daily", start_date="20170301", end_date='20231022', adjust="") print(stock_zh_a_hist_df) ``` Output: ``` 日期 开盘 收盘 最高 ... 振幅 涨跌幅 涨跌额 换手率 0 2017-03-01 9.49 9.49 9.55 ... 0.84 0.11 0.01 0.21 1 2017-03-02 9.51 9.43 9.54 ... 1.26 -0.63 -0.06 0.24 2 2017-03-03 9.41 9.40 9.43 ... 0.74 -0.32 -0.03 0.20 3 2017-03-06 9.40 9.45 9.46 ... 0.74 0.53 0.05 0.24 4 2017-03-07 9.44 9.45 9.46 ... 0.63 0.00 0.00 0.17 ... ... ... ... ... ... ... ... ... 1610 2023-10-16 11.00 11.01 11.03 ... 0.73 0.09 0.01 0.26 1611 2023-10-17 11.01 11.02 11.05 ... 0.82 0.09 0.01 0.25 1612 2023-10-18 10.99 10.95 11.02 ... 1.00 -0.64 -0.07 0.34 1613 2023-10-19 10.91 10.60 10.92 ... 3.01 -3.20 -0.35 0.61 1614 2023-10-20 10.55 10.60 10.67 ... 1.51 0.00 0.00 0.27 [1615 rows x 11 columns] ``` ### Plot Code: ```python import akshare as ak import mplfinance as mpf # Please install mplfinance as follows: pip install mplfinance stock_us_daily_df = ak.stock_us_daily(symbol="AAPL", adjust="qfq") stock_us_daily_df = stock_us_daily_df.set_index(["date"]) stock_us_daily_df = stock_us_daily_df["2020-04-01": "2020-04-29"] mpf.plot(stock_us_daily_df, type="candle", mav=(3, 6, 9), volume=True, show_nontrading=False) ``` Output: ![KLine](https://jfds-1252952517.cos.ap-chengdu.myqcloud.com/akshare/readme/home/AAPL_candle.png) ## Features - **Easy of use**: Just one line code to fetch the data; - **Extensible**: Easy to customize your own code with other application; - **Powerful**: Python ecosystem. ## Tutorials 1. [Overview](https://akshare.akfamily.xyz/introduction.html) 2. [Installation](https://akshare.akfamily.xyz/installation.html) 3. [Tutorial](https://akshare.akfamily.xyz/tutorial.html) 4. [Data Dict](https://akshare.akfamily.xyz/data/index.html) 5. [Subjects](https://akshare.akfamily.xyz/topic/index.html) ## Contribution [AKShare](https://github.com/akfamily/akshare) is still under developing, feel free to open issues and pull requests: - Report or fix bugs - Require or publish interface - Write or fix documentation - Add test cases > Notice: We use [Ruff](https://github.com/astral-sh/ruff) to format the code ## Statement 1. All data provided by [AKShare](https://github.com/akfamily/akshare) is just for academic research purpose; 2. The data provided by [AKShare](https://github.com/akfamily/akshare) is for reference only and does not constitute any investment proposal; 3. Any investor based on [AKShare](https://github.com/akfamily/akshare) research should pay more attention to data risk; 4. [AKShare](https://github.com/akfamily/akshare) will insist on providing open-source financial data; 5. Based on some uncontrollable factors, some data interfaces in [AKShare](https://github.com/akfamily/akshare) may be removed; 6. Please follow the relevant open-source protocol used by [AKShare](https://github.com/akfamily/akshare); 7. Provide HTTP API for the person who uses other program language: [AKTools](https://aktools.readthedocs.io/). ## Show your style Use the badge in your project's README.md: ```markdown [![Data: akshare](https://img.shields.io/badge/Data%20Science-AKShare-green)](https://github.com/akfamily/akshare) ``` Using the badge in README.rst: ``` .. image:: https://img.shields.io/badge/Data%20Science-AKShare-green :target: https://github.com/akfamily/akshare ``` Looks like this: [![Data: akshare](https://img.shields.io/badge/Data%20Science-AKShare-green)](https://github.com/akfamily/akshare) ## Citation Please use this **bibtex** if you want to cite this repository in your publications: ```markdown @misc{akshare, author = {Albert King and Yaojie Zhang}, title = {AKShare}, year = {2022}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/akfamily/akshare}}, } ``` ## Acknowledgement Special thanks [FuShare](https://github.com/LowinLi/fushare) for the opportunity of learning from the project; Special thanks [TuShare](https://github.com/waditu/tushare) for the opportunity of learning from the project; Thanks for the data provided by [东方财富网站](http://data.eastmoney.com); Thanks for the data provided by [新浪财经网站](https://finance.sina.com.cn); Thanks for the data provided by [金十数据网站](https://www.jin10.com/); Thanks for the data provided by [生意社网站](http://www.100ppi.com/); Thanks for the data provided by [中国银行间市场交易商协会网站](http://www.nafmii.org.cn/); Thanks for the data provided by [99期货网站](http://www.99qh.com/); Thanks for the data provided by [中国外汇交易中心暨全国银行间同业拆借中心网站](http://www.chinamoney.com.cn/chinese/); Thanks for the data provided by [和讯财经网站](http://www.hexun.com/); Thanks for the data provided by [DACHENG-XIU 网站](https://dachxiu.chicagobooth.edu/); Thanks for the data provided by [上海证券交易所网站](http://www.sse.com.cn/assortment/options/price/); Thanks for the data provided by [深证证券交易所网站](http://www.szse.cn/); Thanks for the data provided by [北京证券交易所网站](http://www.bse.cn/); Thanks for the data provided by [中国金融期货交易所网站](http://www.cffex.com.cn/); Thanks for the data provided by [上海期货交易所网站](http://www.shfe.com.cn/); Thanks for the data provided by [大连商品交易所网站](http://www.dce.com.cn/); Thanks for the data provided by [郑州商品交易所网站](http://www.czce.com.cn/); Thanks for the data provided by [上海国际能源交易中心网站](http://www.ine.com.cn/); Thanks for the data provided by [Timeanddate 网站](https://www.timeanddate.com/); Thanks for the data provided by [河北省空气质量预报信息发布系统网站](http://110.249.223.67/publish/); Thanks for the data provided by [Economic Policy Uncertainty 网站](http://www.nanhua.net/nhzc/varietytrend.html); Thanks for the data provided by [申万指数网站](http://www.swsindex.com/idx0120.aspx?columnid=8832); Thanks for the data provided by [真气网网站](https://www.zq12369.com/); Thanks for the data provided by [财富网站](http://www.fortunechina.com/); Thanks for the data provided by [中国证券投资基金业协会网站](http://gs.amac.org.cn/); Thanks for the data provided by [Expatistan 网站](https://www.expatistan.com/cost-of-living); Thanks for the data provided by [北京市碳排放权电子交易平台网站](https://www.bjets.com.cn/article/jyxx/); Thanks for the data provided by [国家金融与发展实验室网站](http://www.nifd.cn/); Thanks for the data provided by [义乌小商品指数网站](http://www.ywindex.com/Home/Product/index/); Thanks for the data provided by [百度迁徙网站](https://qianxi.baidu.com/?from=shoubai#city=0); Thanks for the data provided by [思知网站](https://www.ownthink.com/); Thanks for the data provided by [Currencyscoop 网站](https://currencyscoop.com/); Thanks for the data provided by [新加坡交易所网站](https://www.sgx.com/zh-hans/research-education/derivatives); ================================================ FILE: akshare/__init__.py ================================================ """ AKShare 是基于 Python 的开源财经数据接口库,实现对股票、期货、期权、基金、债券、外汇、加密货币等金 融产品的量价数据,基本面数据和另类数据从数据采集,数据清洗到数据下载的工具,满足金融数据科学 家,数据科学爱好者在数据获取方面的需求。它的特点是利用 AKShare 获取的是基于可信任数据源 发布的原始数据,广大数据科学家可以利用原始数据进行再加工,从而得出科学的结论。如果您使用其他编程语言或软件 请使用 AKTools 来快速搭建 AKShare HTTP API 接口。 """ """ 版本更新记录: 0.1.13 更新所有基于 fushare 的接口 0.1.14 更新 requirements.txt 文件 0.1.15 自动安装所需要的 packages 0.1.16 修正部分函数命名 0.1.17 更新版本号自动管理 0.1.18 更新说明文档 0.1.19 修正 cot.py 中请求错误 0.1.20 修正 __doc__ 0.1.21 修复 __doc__ 0.1.22 修复命名和绘图 0.1.23 修复错误机制 0.1.24 增加奇货可查所有指数数据获取接口 0.1.25 修复 qhck 接口 0.1.26 修复代码格式问题 0.1.27 修复说明格式问题 0.1.28 更新说明文档 0.1.29 规范说明文档格式 0.1.30 规范说明文档格式 0.1.31 规范 cot.py 函数说明 0.1.32 update futures_basis.py 0.1.33 增加奇货可查数据三个接口: get_qhkc_index, get_qhkc_index_trend, get_qhkc_index_profit_loss 使用方法请 help(get_qhkc_index) 查看 0.1.34 增加奇货可查-资金数据三个接口: get_qhkc_fund_position_change, get_qhkc_fund_bs, get_qhkc_fund_position 使用方法请 help(get_qhkc_fund_position_change) 查看 0.1.35 增加奇货可查-工具-外盘比价接口: get_qhkc_tool_foreign 使用方法请 help(get_qhkc_tool_foreign) 查看 0.1.36 增加奇货可查-工具-各地区经济数据接口: get_qhkc_tool_gdp 使用方法请 help(get_qhkc_tool_gdp) 查看 0.1.37 增加中国银行间市场交易商协会-债券接口 get_bond_bank 使用方法请 help(get_bond_bank) 查看 0.1.38 修正 0.1.39 模块化处理 0.1.40 统一接口函数参数 start --> start_day; end --> end_day 0.1.41 更新大连商品交易所-苯乙烯-EB品种 0.1.42 更新上海期货交易所-上海国际能源交易中心-20号胶-NR品种 更新上海期货交易所-不锈钢-SS品种 0.1.43 修复 example --> qhkc_api.py 函数调用 0.1.44 修复 example --> daily_run.py 函数调用 0.1.45 修复 akdocker.md 函数接口调用说明和感谢单位 0.1.46 修复 akdocker.md 图片显示 0.1.47 修复 akdocker.md 增加说明部分 0.1.48 更新大连商品交易所-粳米-RR品种 0.1.49 增加智道智科-私募指数数据接口 使用方法请 help(get_zdzk_fund_index) 查看 0.1.50 更新 akdocker.md 文件 0.1.51 更新官方文档: https://akshare.akfamily.xyz 0.1.52 增加量化策略和量化平台板块 0.1.53 增加期货品种列表和名词解释 0.1.54 修改 AkShare的初衷, 增加管理期货策略指数 0.1.55 新增 99 期货库存数据接口 0.1.56 修复 99 期货库存数据接口 0.1.57 更新 md 文件数据接口 0.1.58 更新 md 文件数据接口 0.1.59 更新 md 文件数据接口 0.1.60 更新 致谢部分, 申明借鉴和引用的 package 0.1.61 更新说明文档 0.1.62 提供英为财情-股票指数-全球股指与期货指数数据接口 https://cn.investing.com/indices/ 0.1.63 更新说明文档-致谢英为财情 0.1.64 更新 get_country_index 返回格式为日期索引 0.1.65 更新 get_country_index 返回格式数据开盘, 收盘, 高, 低为浮点型 0.1.66 提供英为财情-股票指数-全球股指与期货指数数据接口 https://cn.investing.com/rates-bonds/ 新增 get_country_bond 返回格式数据开盘, 收盘, 高, 低为浮点型 0.1.67 更新说明文档-私募指数数据说明 0.1.68 更新说明文档-私募指数数据说明-增加图片 0.1.69 更新说明文档-债券说明格式调整 0.1.70 更新大商所, 郑商所商品期权数据接口 0.1.71 更新大商所, 郑商所, 上期所商品期权数据接口 0.1.72 修改大商所, 郑商所, 上期所商品期权数据接口 增加函数说明 更新说明文档-期权部分 0.1.73 更新说明文档-期权部分 0.1.74 更新说明文档格式调整 0.1.75 新增外汇接口, 银行间债券市场行情数据接口 0.1.76 更新说明文档 0.1.77 新增全球期货历史数据查询接口 0.1.78 新增全球宏观数据-中国宏观数据 年度、月度CPI数据, 年度M2数据 0.1.79 更新说明文档 0.1.80 更新说明文档-刷新 0.1.81 新增全球宏观数据-中国宏观数据 中国年度PPI数据 中国年度PMI数据 中国年度GDP数据 中国年度财新PMI数据 中国外汇储备数据 中国电力能源数据 中国年度非制造业PMI数据 人民币中间报价汇率 0.1.82 新增全球宏观数据-美国宏观数据 美联储利率决议报告 美国非农就业人数报告 美国失业率报告 美国EIA原油库存报告 0.1.83 更新说明文档 0.1.84 新增全球宏观数据-美国宏观数据 美国初请失业金人数报告 美国核心PCE物价指数年率报告 美国CPI月率报告 美联储劳动力市场状况指数报告 美国ADP就业人数报告 美国国内生产总值(GDP)报告 美国原油产量报告 新增全球宏观数据-欧洲宏观数据 欧洲央行决议报告 新增全球宏观数据-机构宏观数据 全球最大黄金ETF—SPDR Gold Trust持仓报告 全球最大白银ETF--iShares Silver Trust持仓报告 欧佩克报告 0.1.85 新增期货-仓单有效期接口 0.1.86 更新说明文档 0.1.87 新增和讯财经-企业社会责任数据接口 0.1.88 更新说明文档 0.1.89 更新requirements.txt 0.1.90 更新setup.py 0.1.91 新增和讯财经-中国概念股行情及日频历史数据接口 0.1.92 更新说明文档 0.1.93 新增交易法门-套利工具-跨期价差(自由价差)数据接口 0.1.94 新增生意社-商品与期货-现期图数据接口 新增西本新干线-指数数据 0.1.95 新增新浪财经-期货-实时数据接口 0.1.96 修正新浪财经-期货-实时数据接口-返回 current_price 字段为实时数据 0.1.97 修正新浪财经-期货-实时数据接口-返回 current_price 和 ask_price 字段为实时数据 0.1.98 修正版本更新错误 0.1.99 增加自动安装 pillow 0.2.1 增加港股当日(时点)行情数据和历史数据(前复权和后复权因子) 0.2.2 增加美股当日(时点)行情数据和历史数据(前复权因子) 0.2.3 增加金融期权 0.2.4 增加加密货币行情接口 0.2.5 增加 AKShare 接口导图 0.2.6 更新港股数据接口和说明文档 0.2.7 更新 qhkc_web 接口注释和说明文档 0.2.8 更新说明文档 0.2.9 更新A+H股数据实时行情数据和历史行情数据(后复权) 0.2.10 更新说明文档 0.2.11 更新说明文档 0.2.12 增加A股实时行情数据和历史行情数据 0.2.13 统一股票接口命名 0.2.14 统一股票接口命名, 去除 get 0.2.15 增加科创板实时行情数据和历史行情数据 0.2.16 增加银保监分局本级行政处罚数据 0.2.17 更新说明文档 0.2.18 修正银保监分局本级行政处罚数据接口字段命名 0.2.19 增加 Nodejs 安装说明 0.2.20 增加 Realized Library 接口 0.2.21 更新说明文档 0.2.22 更新说明文档 0.2.23 修正银保监分局本级行政处罚数据接口反扒升级-修改完成 0.2.24 增加FF多因子模型数据接口 0.2.25 更新说明文档 0.2.26 修正期货-实时行情: 接口命名, 字段补充及限制访问速度 0.2.27 增加新浪-外盘期货实时行情数据接口 0.2.28 修正新浪-外盘期货实时行情数据引入 更新文档 0.2.29 更新文档 0.2.30 监管-银保监: 反扒措施在变化, 更新接口 修正期货-国内-实时行情接口订阅问题 0.2.31 修正期货-国内-金融期货实时行情接口订阅问题 0.2.32 更新说明文档 0.2.33 更新说明文档-期货-外盘 0.2.34 新增新浪-指数实时行情和历史行情接口 0.2.35 新增新浪-指数和A股实时行情列表获取问题 0.2.36 新增腾讯财经-A股分笔行情历史数据 0.2.37 新增金十数据-实时监控接口 0.2.38 更新说明文档 0.2.39 更新说明文档目录结构 0.2.40 更新专题板块 0.2.41 更新说明文件 0.2.42 更新 MindMap 0.2.43 重构说明文档-模块化处理, 将 github 说明文档和 docs 在线文档分开处理 重构私募指数接口 0.2.44 增加日出和日落模块 0.2.45 增加河北空气指数数据 0.2.46 更新 requirements.txt 0.2.47 添加初始化文件 0.2.48 添加 websocket-client 0.2.49 南华期货-南华商品指数 0.2.50 修正英为财情-指数板块的成交量显示问题 0.2.51 消除部分警告信息 0.2.52 基差数据缺失错误提示修正 0.2.53 统一南华期货-商品指数历史走势-收益率指数 新增南华期货-商品指数历史走势-价格指数 新增南华期货-商品指数历史走势-波动率指数 0.2.54 添加 numpy 依赖 0.2.55 更新已实现波动率的说明文档 统一 ff_crr --> article_ff_crr 0.2.56 新增经济政策不确定性(EPU)数据接口 更新说明文档 修改示例说明 0.2.57 修改 air_hebei 接口, 默认返回全部城市 0.2.58 新增微博指数 0.2.59 增加西本新干线说明文档 0.2.60 新增百度指数 0.2.61 修正河北空气数据代码 0.2.62 新增百度搜索指数 新增百度资讯指数 新增百度媒体指数 0.2.63 更新指数-legend代码 0.2.64 fix pillow>=6.2.0 0.2.65 新增谷歌指数 0.2.66 修正南华指数URL硬编码问题 0.2.67 修正 get_futures_index 函数中上海期货交易所 CU 出现 cuefp 数据导致指数合成异常的问题 0.2.68 降低 Python 版本要求 0.2.69 降低python版本要求到 Python3.7.1 0.2.70 适配 VNPY 使用 0.2.71 交易法门数据接口 0.2.72 申万行业一级指数-实时 0.2.73 更新纯碱期货数据接口 0.2.74 新增AQI空气质量数据接口 0.2.75 新增申万一级指数接口 0.2.76 统一交易法门登录和数据获取接口 0.2.77 清除冗余函数 0.2.78 Python 降级 0.2.79 Python 降级 0.2.80 Python 3.6 0.2.81 html5lib 0.2.82 websockets-8.1 0.2.83 修复 weibo_index 函数日期格式问题 0.2.84 修复 baidu_index 接口 0.2.85 临时修复 baidu_index 接口 0.2.86 lxml 降级 0.2.87 lxml 降级 更新安装时的错误处理 0.2.88 pypinyin 降级 0.2.89 全国空气质量数据数据格式规范为数值型 0.2.90 更新注册仓单的产品参数和异常错误 0.2.91 世界五百强公司排名接口 0.2.92 更新中国债券市场行情数据接口 0.2.93 增加自动测试模型 0.2.94 增加私募基金管理人信息公示接口 0.2.95 增加中国证券投资基金业协会-信息公示 0.2.96 修复交易法门登录验证码 由于交易法门-数据部分权限缘故, 需要注册后方可使用 0.2.97 更新说明文档 0.2.98 增加甲醇期权和PTA期权 0.2.99 更新外汇数据接口, 规范格式 0.3.0 猫眼电影实时票房 0.3.1 更新说明文档 0.3.2 更新说明文档 0.3.3 更新外盘期货行情订阅时, 统一字段名称与网页端一致 0.3.4 新增能源-碳排放权数据 0.3.5 新增世界各大城市生活成本数据 0.3.6 商品现货价格指数 0.3.7 修复百度指数日期问题 0.3.8 新增中国宏观数据接口和文档说明 0.3.9 新增中国宏观杠杆率数据 0.3.10 修改金融期权数据接口 0.3.11 修复实时票房数据接口 0.3.12 新增新浪主力连续接口 0.3.13 新增新浪主力连续列表 0.3.14 中国倒闭公司名单 0.3.15 中国独角兽名单 中国千里马名单 0.3.16 东方财富-机构调研 0.3.17 东方财富网-数据中心-特色数据-机构调研 机构调研统计 机构调研详细 0.3.18 修复自动测试接口 0.3.19 修复融资融券字段名匹配问题 增加东方财富网-数据中心-特色数据-股票质押 0.3.20 东方财富网-数据中心-特色数据-股权质押 东方财富网-数据中心-特色数据-股权质押-股权质押市场概况: https://data.eastmoney.com/gpzy/marketProfile.aspx 东方财富网-数据中心-特色数据-股权质押-上市公司质押比例: https://data.eastmoney.com/gpzy/pledgeRatio.aspx 东方财富网-数据中心-特色数据-股权质押-重要股东股权质押明细: https://data.eastmoney.com/gpzy/pledgeDetail.aspx 东方财富网-数据中心-特色数据-股权质押-质押机构分布统计-证券公司: https://data.eastmoney.com/gpzy/distributeStatistics.aspx 东方财富网-数据中心-特色数据-股权质押-质押机构分布统计-银行: https://data.eastmoney.com/gpzy/distributeStatistics.aspx 东方财富网-数据中心-特色数据-股权质押-行业数据: https://data.eastmoney.com/gpzy/industryData.aspx 0.3.21 东方财富网-数据中心-特色数据-商誉 东方财富网-数据中心-特色数据-商誉-A股商誉市场概况: https://data.eastmoney.com/sy/scgk.html 东方财富网-数据中心-特色数据-商誉-商誉减值预期明细: https://data.eastmoney.com/sy/yqlist.html 东方财富网-数据中心-特色数据-商誉-个股商誉减值明细: https://data.eastmoney.com/sy/jzlist.html 东方财富网-数据中心-特色数据-商誉-个股商誉明细: https://data.eastmoney.com/sy/list.html 东方财富网-数据中心-特色数据-商誉-行业商誉: https://data.eastmoney.com/sy/hylist.html 0.3.22 期货规则-交易日历数据表 更新2020交易日历数据 0.3.23 东方财富网-数据中心-特色数据-股票账户统计: https://data.eastmoney.com/cjsj/gpkhsj.html 0.3.24 移除-交易法门系列老函数 因为交易法门网站需要会员登录后访问数据 0.3.25 增加-交易法门-工具-套利分析接口 增加-交易法门-工具-交易规则接口 0.3.26 增加-交易法门-数据-农产品-豆油 增加-交易法门-数据-黑色系-焦煤 增加-交易法门-工具-持仓分析-期货分析 增加-交易法门-工具-持仓分析-持仓分析 0.3.27 交易法门-说明文档 0.3.28 增加-股票指数-股票指数成份股接口 0.3.29 增加-股票指数-股票指数成份股接口-代码注释 0.3.30 增加-义乌小商品指数 0.3.31 修复-银保监分局本级行政处罚数据接口 接口重命名为: bank_fjcf_table_detail 0.3.32 新增-中国电煤价格指数 0.3.33 修复-银保监分局本级行政处罚数据接口-20200108新增字段后适应 0.3.34 增加-交易法门-工具-期限分析-基差日报 增加-交易法门-工具-期限分析-基差分析 增加-交易法门-工具-期限分析-期限结构 增加-交易法门-工具-期限分析-价格季节性 0.3.35 更新说明文档 0.3.36 # 交易法门-工具-仓单分析 增加-交易法门-工具-仓单分析-仓单日报 增加-交易法门-工具-仓单分析-仓单查询 增加-交易法门-工具-仓单分析-虚实盘比查询 # 交易法门-工具-资讯汇总 增加-交易法门-工具-资讯汇总-研报查询 增加-交易法门-工具-资讯汇总-交易日历 # 交易法门-工具-资金分析 增加-交易法门-工具-资金分析-资金流向 0.3.37 更新说明文档 0.3.38 修改-交易法门-工具-资金分析-资金流向函数的字段和说明文档 0.3.39 金十数据中心-经济指标-央行利率-主要央行利率 美联储利率决议报告 欧洲央行决议报告 新西兰联储决议报告 中国央行决议报告 瑞士央行决议报告 英国央行决议报告 澳洲联储决议报告 日本央行决议报告 俄罗斯央行决议报告 印度央行决议报告 巴西央行决议报告 macro_euro_gdp_yoy # 金十数据中心-经济指标-欧元区-国民经济运行状况-经济状况-欧元区季度GDP年率报告 macro_euro_cpi_mom # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区CPI月率报告 macro_euro_cpi_yoy # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区CPI年率报告 macro_euro_ppi_mom # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区PPI月率报告 macro_euro_retail_sales_mom # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区零售销售月率报告 macro_euro_employment_change_qoq # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场-欧元区季调后就业人数季率报告 macro_euro_unemployment_rate_mom # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场-欧元区失业率报告 macro_euro_trade_balance # 金十数据中心-经济指标-欧元区-贸易状况-欧元区未季调贸易帐报告 macro_euro_current_account_mom # 金十数据中心-经济指标-欧元区-贸易状况-欧元区经常帐报告 macro_euro_industrial_production_mom # 金十数据中心-经济指标-欧元区-产业指标-欧元区工业产出月率报告 macro_euro_manufacturing_pmi # 金十数据中心-经济指标-欧元区-产业指标-欧元区制造业PMI初值报告 macro_euro_services_pmi # 金十数据中心-经济指标-欧元区-产业指标-欧元区服务业PMI终值报告 macro_euro_zew_economic_sentiment # 金十数据中心-经济指标-欧元区-领先指标-欧元区ZEW经济景气指数报告 macro_euro_sentix_investor_confidence # 金十数据中心-经济指标-欧元区-领先指标-欧元区Sentix投资者信心指数报告 0.3.40 修复-欧洲央行决议报告 0.3.41 增加-东方财富网-经济数据-银行间拆借利率 0.3.42 # 中国 macro_china_gdp_yearly # 金十数据中心-经济指标-中国-国民经济运行状况-经济状况-中国GDP年率报告 macro_china_cpi_yearly # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国CPI年率报告 macro_china_cpi_monthly # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国CPI月率报告 macro_china_ppi_yearly # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国PPI年率报告 macro_china_exports_yoy # 金十数据中心-经济指标-中国-贸易状况-以美元计算出口年率报告 macro_china_imports_yoy # 金十数据中心-经济指标-中国-贸易状况-以美元计算进口年率 macro_china_trade_balance # 金十数据中心-经济指标-中国-贸易状况-以美元计算贸易帐(亿美元) macro_china_industrial_production_yoy # 金十数据中心-经济指标-中国-产业指标-规模以上工业增加值年率 macro_china_pmi_yearly # 金十数据中心-经济指标-中国-产业指标-官方制造业PMI macro_china_cx_pmi_yearly # 金十数据中心-经济指标-中国-产业指标-财新制造业PMI终值 macro_china_cx_services_pmi_yearly # 金十数据中心-经济指标-中国-产业指标-财新服务业PMI macro_china_non_man_pmi # 金十数据中心-经济指标-中国-产业指标-中国官方非制造业PMI macro_china_fx_reserves_yearly # 金十数据中心-经济指标-中国-金融指标-外汇储备(亿美元) macro_china_m2_yearly # 金十数据中心-经济指标-中国-金融指标-M2货币供应年率 macro_china_shibor_all # 金十数据中心-经济指标-中国-金融指标-上海银行业同业拆借报告 macro_china_hk_market_info # 金十数据中心-经济指标-中国-金融指标-人民币香港银行同业拆息 macro_china_daily_energy # 金十数据中心-经济指标-中国-其他-中国日度沿海六大电库存数据 macro_china_rmb # 金十数据中心-经济指标-中国-其他-中国人民币汇率中间价报告 macro_china_market_margin_sz # 金十数据中心-经济指标-中国-其他-深圳融资融券报告 macro_china_market_margin_sh # 金十数据中心-经济指标-中国-其他-上海融资融券报告 macro_china_au_report # 金十数据中心-经济指标-中国-其他-上海黄金交易所报告 macro_china_ctci # 发改委-中国电煤价格指数-全国综合电煤价格指数 macro_china_ctci_detail # 发改委-中国电煤价格指数-各价区电煤价格指数 macro_china_ctci_detail_hist # 发改委-中国电煤价格指数-历史电煤价格指数 macro_china_money_supply # 中国货币供应量 # 美国 macro_usa_gdp_monthly # 金十数据中心-经济指标-美国-经济状况-美国GDP macro_usa_cpi_monthly # 金十数据中心-经济指标-美国-物价水平-美国CPI月率报告 macro_usa_core_cpi_monthly # 金十数据中心-经济指标-美国-物价水平-美国核心CPI月率报告 macro_usa_personal_spending # 金十数据中心-经济指标-美国-物价水平-美国个人支出月率报告 macro_usa_retail_sales # 金十数据中心-经济指标-美国-物价水平-美国零售销售月率报告 macro_usa_import_price # 金十数据中心-经济指标-美国-物价水平-美国进口物价指数报告 macro_usa_export_price # 金十数据中心-经济指标-美国-物价水平-美国出口价格指数报告 macro_usa_lmci # 金十数据中心-经济指标-美国-劳动力市场-LMCI macro_usa_unemployment_rate # 金十数据中心-经济指标-美国-劳动力市场-失业率-美国失业率报告 macro_usa_job_cuts # 金十数据中心-经济指标-美国-劳动力市场-失业率-美国挑战者企业裁员人数报告 macro_usa_non_farm # 金十数据中心-经济指标-美国-劳动力市场-就业人口-美国非农就业人数报告 macro_usa_adp_employment # 金十数据中心-经济指标-美国-劳动力市场-就业人口-美国ADP就业人数报告 macro_usa_core_pce_price # 金十数据中心-经济指标-美国-劳动力市场-消费者收入与支出-美国核心PCE物价指数年率报告 macro_usa_real_consumer_spending # 金十数据中心-经济指标-美国-劳动力市场-消费者收入与支出-美国实际个人消费支出季率初值报告 macro_usa_trade_balance # 金十数据中心-经济指标-美国-贸易状况-美国贸易帐报告 macro_usa_current_account # 金十数据中心-经济指标-美国-贸易状况-美国经常帐报告 macro_usa_rig_count # 金十数据中心-经济指标-美国-产业指标-制造业-贝克休斯钻井报告 # 金十数据中心-经济指标-美国-产业指标-制造业-美国个人支出月率报告 macro_usa_ppi # 金十数据中心-经济指标-美国-产业指标-制造业-美国生产者物价指数(PPI)报告 macro_usa_core_ppi # 金十数据中心-经济指标-美国-产业指标-制造业-美国核心生产者物价指数(PPI)报告 macro_usa_api_crude_stock # 金十数据中心-经济指标-美国-产业指标-制造业-美国API原油库存报告 macro_usa_pmi # 金十数据中心-经济指标-美国-产业指标-制造业-美国Markit制造业PMI初值报告 macro_usa_ism_pmi # 金十数据中心-经济指标-美国-产业指标-制造业-美国ISM制造业PMI报告 macro_usa_nahb_house_market_index # 金十数据中心-经济指标-美国-产业指标-房地产-美国NAHB房产市场指数报告 macro_usa_house_starts # 金十数据中心-经济指标-美国-产业指标-房地产-美国新屋开工总数年化报告 macro_usa_new_home_sales # 金十数据中心-经济指标-美国-产业指标-房地产-美国新屋销售总数年化报告 macro_usa_building_permits # 金十数据中心-经济指标-美国-产业指标-房地产-美国营建许可总数报告 macro_usa_exist_home_sales # 金十数据中心-经济指标-美国-产业指标-房地产-美国成屋销售总数年化报告 macro_usa_house_price_index # 金十数据中心-经济指标-美国-产业指标-房地产-美国FHFA房价指数月率报告 macro_usa_spcs20 # 金十数据中心-经济指标-美国-产业指标-房地产-美国S&P/CS20座大城市房价指数年率报告 macro_usa_pending_home_sales # 金十数据中心-经济指标-美国-产业指标-房地产-美国成屋签约销售指数月率报告 macro_usa_cb_consumer_confidence # 金十数据中心-经济指标-美国-领先指标-美国谘商会消费者信心指数报告 macro_usa_nfib_small_business # 金十数据中心-经济指标-美国-领先指标-美国NFIB小型企业信心指数报告 macro_usa_michigan_consumer_sentiment # 金十数据中心-经济指标-美国-领先指标-美国密歇根大学消费者信心指数初值报告 macro_usa_eia_crude_rate # 金十数据中心-经济指标-美国-其他-美国EIA原油库存报告 macro_usa_initial_jobless # 金十数据中心-经济指标-美国-其他-美国初请失业金人数报告 macro_usa_crude_inner # 金十数据中心-经济指标-美国-其他-美国原油产量报告 0.3.43 增加-交易法门-数据-黑色系-焦煤 0.3.44 更新宏观数据 macro_cons_gold_volume # 全球最大黄金ETF—SPDR Gold Trust持仓报告 macro_cons_gold_change # 全球最大黄金ETF—SPDR Gold Trust持仓报告 macro_cons_gold_amount # 全球最大黄金ETF—SPDR Gold Trust持仓报告 macro_cons_silver_volume # 全球最大白银ETF--iShares Silver Trust持仓报告 macro_cons_silver_change # 全球最大白银ETF--iShares Silver Trust持仓报告 macro_cons_silver_amount # 全球最大白银ETF--iShares Silver Trust持仓报告 macro_cons_opec_month # 欧佩克报告-月度 0.3.45 增加中国证券投资基金业协会-信息公示 # 中国证券投资基金业协会-信息公示-会员信息 amac_member_info # 中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询 # 中国证券投资基金业协会-信息公示-从业人员信息 amac_person_org_list # 中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息 # 中国证券投资基金业协会-信息公示-私募基金管理人公示 amac_manager_info # 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询 amac_manager_classify_info # 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示 amac_member_sub_info # 中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示 # 中国证券投资基金业协会-信息公示-基金产品 amac_fund_info # 中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品 amac_securities_info # 中国证券投资基金业协会-信息公示-基金产品-证券公司集合资管产品公示 amac_aoin_info # 中国证券投资基金业协会-信息公示-基金产品-证券公司直投基金 amac_fund_sub_info # 中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金 amac_fund_account_info # 中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示 amac_fund_abs # 中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划 amac_futures_info # 中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示 # 中国证券投资基金业协会-信息公示-诚信信息 amac_manager_cancelled_info # 中国证券投资基金业协会-信息公示-诚信信息-已注销私募基金管理人名单 0.3.46 更新-商品期权-菜籽粕期权接口 修复 get_sector_futures 字段名问题 0.3.47 增加-商品期权-郑州商品交易所-期权-历史数据 0.3.48 修复 macro_cons_opec_month 接口数据更新问题 0.3.49 新增-交易法门-工具-仓单分析-虚实盘比日报接口 0.3.50 更新-说明文档 0.3.51 修复 macro_cons_opec_month 接口数据更新问题, 统一数据接口跟网页端统一 修复-百度指数-由用户输入cookie来访问数据及说明文档 0.3.52 新增-英为财情-外汇-货币对历史数据 0.3.53 修复-macro_usa_rig_count-接口返回数据 修复-rate_interbank-文档注释 0.3.54 新增-事件接口 新增-事件接口新型冠状病毒-网易 新增-事件接口新型冠状病毒-丁香园 0.3.55 更新-事件接口新型冠状病毒 0.3.56 更新-事件接口新型冠状病毒-全国疫情趋势图 0.3.57 更新-事件接口新型冠状病毒-分省地区 一些细节修复 0.3.58 新增-财富排行榜(英文版) 0.3.59 新增-currency_name_code-接口 0.3.60 修复-财富排行榜(英文版)-索引乱序问题 0.3.61 修复-事件接口新型冠状病毒-hospital-接口 0.3.62 修复-20200203交易日问题 0.3.63 修复-事件接口新型冠状病毒-网易接口 0.3.64 修复-事件接口新型冠状病毒-丁香园接口 0.3.65 修复-calendar.json 问题, 感谢 fxt0706 0.3.66 修复-epu_index-加载问题 0.3.67 修复-option_commodity-json数据加载问题 0.3.68 更名函数 movie_board -> box_office_spot 0.3.69 新增-epidemic_baidu 百度-新型冠状病毒肺炎-疫情实时大数据报告 0.3.70 修复-epidemic_dxy-字段问题 0.3.71 修复-epidemic_dxy-具体省份字段问题 0.3.72 新增-百度迁徙地图接口 0.3.73 修复文字表述 0.3.74 修复-epidemic_163-数据更新问题 0.3.75 修复-epidemic_dxy-图片显示问题 0.3.76 新增-stock_zh_index_daily_tx-补充新浪指数的数据缺失问题 0.3.77 修复-epidemic_163-数据更新问题 0.3.78 新增-bond_china_yield-中国债券信息网-国债及其他债券收益率曲线 0.3.79 修改-bond_china_yield-参数 0.3.80 新增-基金数据接口 0.3.81 新增-基金数据接口-净值 0.3.82 新增-小区查询 新增-相同行程查询 0.3.83 新增-交易法门-工具-套利分析-FullCarry 修改-交易法门-工具-期限分析-基差分析 0.3.84 新增-货币对-投机情绪报告 0.3.85 修复-epidemic_area_detail-增加下载进度提示 0.3.86 修复-epidemic_dxy-完善图片获取 0.3.87 新增-债券质押式回购成交明细数据 新增-细化到地市的疫情历史数据20200123至今 0.3.88 新增-交易法门-工具-持仓分析-持仓季节性 修复-epidemic_163 0.3.89 新增-epidemic_163-数据说明接口 0.3.90 修复-epidemic_dxy 0.3.91 修复-get_receipt-MA数值问题 0.3.92 新增-奇货可查接口测试 0.3.93 新增-奇货可查接口测试-代码补全 0.3.94 修复-epidemic_dxy 0.3.95 新增-债券-沪深债券 新增-债券-沪深可转债 0.3.96 修复-baidu_search_index-异常 0.3.97 新增-特许经营数据 0.3.98 修复-get_receipt-MA数值问题条件判断 0.3.99 修复-air_hebei-代码格式 0.4.1 修复-pandas-版本降级 0.4.2 修复-epidemic_baidu 0.4.3 新增-慈善中国 0.4.4 新增-epidemic_history-疫情所有历史数据 0.4.5 完善-慈善中国-类型注解 0.4.6 修复-charity_china_report 0.4.7 新增-测试接口 0.4.8 修复-epidemic_hist_all 修复-epidemic_hist_city 修复-epidemic_hist_province 0.4.9 新增-option_cffex_hs300_list_sina 新增-option_cffex_hs300_spot_sina 新增-option_cffex_hs300_daily_sina 新增-option_sse_list_sina 新增-option_sse_expire_day_sina 新增-option_sse_codes_sina 新增-option_sse_spot_price_sina 新增-option_sse_underlying_spot_price_sina 新增-option_sse_greeks_sina 新增-option_sse_minute_sina 新增-option_sse_daily_sina 0.4.10 修复-金十数据websocket接口 0.4.11 新增-交易法门-工具-资金分析-资金流向 新增-交易法门-工具-资金分析-沉淀资金 新增-交易法门-工具-资金分析-资金季节性 新增-交易法门-工具-资金分析-成交排名 0.4.12 新增-微博舆情报告 0.4.13 新增-Python3.8.1支持 0.4.14 修复-get_receipt-CZCE问题 0.4.15 修复-hf_subscribe_exchange_symbol-在Linux Python 3.8.1 报错问题 0.4.16 修复-get_js_dc_current 0.4.17 新增-知识图谱 0.4.18: fix: use tqdm replace print hints 0.4.19: fix: use tqdm replace print hints in energy_carbon.py and charity_china.py 0.4.20: add: jyfm_tools_position_structure and jyfm_tools_symbol_handbook 0.4.21: fix: macro_cons_opec_month print hints 0.4.22: fix: add tqdm desc 0.4.23: fix: add tqdm stock_zh_a_spot desc 0.4.24: fix: add get_us_stock_name to get the u.s. stock name 0.4.25: fix: upload setup.py file and set automate release and deploy 0.4.26: fix: bond_spot_quote and docs 0.4.27: test: automate test 0.4.28: test: automate test 0.4.29: feats: add currency interface 0.4.30: fix: futures_roll_yield.py/get_roll_yield: CUefp error 0.4.31: format: format currency.py 0.4.32: fix: bond_china.py 0.4.33: add: jyfm_tools_futures_arbitrage_matrix for jyfm futures 0.4.34: fix: get_czce_rank_table history-20171228 format 0.4.35: fix: get_czce_rank_table history-20071228 format 0.4.36: fix: macro_cons_opec_month 0.4.37: add: get_ine_daily to fetch SC and NR data 0.4.38: add: futures_sgx_daily to fetch futures data from sgx 0.4.39: refactor: migration.py/covid_19_163 interface 0.4.40: refactor: migration.py interface 0.4.41: fix: cot.py get_rank_sum_daily interface 0.4.42: add: wdbank.py test 0.4.43: add: wdbank.py dependencies 0.4.44: add: tool github 0.4.45: add: fund_public file and docs 0.4.46: add: macro_china_lpr 0.4.47: add: stock_em_analyst 0.4.48: add: stock_comment_em 0.4.49: add: stock_em_hsgt 0.4.50: fix: stock_em_sy_yq_list 0.4.51: add: stock_tfp_em 0.4.52: fix: migration.py 0.4.53: fix: futures_hq_sina.py 0.4.54: add: futures_foreign 0.4.55: fix: macro_constitute.py 0.4.56: add: index_vix 0.4.57: fix: covid-19; desc: delete pic show 0.4.58: add: qhkc api 0.4.59: add: jyfm_tools 0.4.60: fix: covid_19_dxy and cot.py 0.4.61: fix: cot.py dict keys use strip 0.4.62: fix: add PG into cons.py map_dict 0.4.63: add: energy_oil to add energy_oil_hist and energy_oil_detail 0.4.64: add: futures_em_spot_stock 0.4.65: add: futures_global_commodity_name_url_map 0.4.66: fix: fund_em.py timezone transfer 0.4.67: fix: covid covid_19_area_detail 0.4.68: fix: marco_usa 0.4.69: add: futures_cfmmc 0.4.70: add: covid_19 CSSE 数据接口 0.4.71: add: argus 0.4.72: add: stock_zh_tick_163 0.4.73: add: stock_zh_tick_tx_js 0.4.74: fix: stock_zh_tick_163 return tips 0.4.75: fix: nh_index 0.4.76: add: fred_md 0.4.77: fix: get_dce_option_daily 0.4.78: add: internal_flow_history 0.4.79: add: stock_dxsyl_em 0.4.80: fix: covid and docs 0.4.81: add: stock_yjyg_em and stock_yysj_em 0.4.82: fix: futures_xgx_index 0.4.83: fix: fortune_500.py 0.4.84: fix: a and kcb stock return format 0.4.85: fix: a and kcb stock field 0.4.86: add: hf_sp_500 0.4.87: fix: jinshi data update 0.4.88: fix: macro_china 0.4.89: fix: macro_other 0.4.90: fix: stock_zh_a and stock_zh_kcb return adjusted stock price 0.4.91: add: futures_inventory_em 0.4.92: fix: adjust hk_stock_sina, us_stock_sina 0.4.93: fix: air_quality 0.4.94: fix: air_quality path 0.4.95: add: js file 0.4.96: fix: format air interface 0.4.97: fix: interbank_rate_em.py add need_page parameter to control update content 0.4.98: add: mplfinance package 0.4.99: add: fund_em 0.5.1: fix: add PG to futures list 0.5.2: fix: air_zhenqi.py rename air_city_dict to air_city_table 0.5.3: add: add two fields into covid_163 0.5.4: fix: fix request_fun timeout and error type 0.5.5: fix: fund_graded_fund_daily_em return fields 0.5.6: fix: stock_us_sina.py rename columns 0.5.7: fix: import akshare only load functions 0.5.8: add: macro_china_money_supply 0.5.9: add: macro_china_new_house_price, macro_china_enterprise_boom_index, macro_china_national_tax_receipts 0.5.10: fix: zh_stock_ah_tx 0.5.11: fix: fund_em return fields 0.5.12: fix: add date to fund_em daily function 0.5.13: add: stock_fund 0.5.14: add: stock_market_fund_flow, stock_sector_fund_flow, stock_individual_fund_flow_rank 0.5.15: fix: baidu_index 0.5.16: add: fund_value_estimation_em 0.5.17: fix: delete macro_euro zero value 0.5.18: add: stock_financial_abstract, stock_financial_analysis_indicator 0.5.19: add: stock_add_stock, stock_ipo_info, stock_history_dividend_detail, stock_history_dividend 0.5.20: add: stock_restricted_shares, stock_circulate_stock_holder 0.5.21: add: futures_dce_position_rank 0.5.22: fix: fix futures_dce_position_rank return format 0.5.23: add: stock_sector_spot, stock_sector_detail 0.5.24: fix: futures_dce_position_rank 0.5.25: fix: futures_dce_position_rank return fields 0.5.26: add: stock_info 0.5.27: add: stock_hsgt_hold_stock_em 0.5.28: add: stock_fund_stock_holder, stock_main_stock_holder 0.5.29: fix: stock_em_sy 0.5.30: fix: air_zhenqi.py 0.5.31: fix: add futures_dce_position_rank_other to fix futures_dce_position_rank at 20160104 0.5.32: fix: futures_dce_position_rank_other return format 0.5.33: add: zh_bond_cov_sina and set pandas version 0.5.34: fix: set pandas version > 0.25 0.5.35: add: bond_cov_comparison and bond_zh_cov 0.5.36: fix: stock_info_sz_name_code return code format 0.5.37: add: stock_hold 0.5.38: fix: futures_dce_position_rank_other exchange symbol and variety 0.5.39: add: stock_recommend 0.5.40: fix: stock_recommend output format 0.5.41: fix: deprecated requests-html module 0.5.42: fix: reformat investing interface 0.5.43: fix: qhck interface 0.5.44: add: LME holding and stock report 0.5.45: fix: transform the data type of stock_zh_a_spot output 0.5.46: add: CFTC holding and stock 0.5.47: fix: fix index_investing_global interface 0.5.48: fix: fix stock_info_a_code_name interface 0.5.49: fix: fix stock_zh_a_daily interface 0.5.50: fix: fix get_roll_yield_bar interface 0.5.51: add: stock_summary 0.5.52: fix: fix get_roll_yield_bar interface 0.5.53: add: add watch_jinshi_quotes interface 0.5.54: add: add stock_price_js interface 0.5.55: add: add futures_czce_warehouse_receipt interface 0.5.56: add: add futures_dce_warehouse_receipt, futures_shfe_warehouse_receipt interface 0.5.57: fix: fix macro data interface 0.5.58: add: add stock_qsjy_em interface 0.5.59: fix: fix fund interface 0.5.60: fix: add index_bloomberg_billionaires interface 0.5.61: fix: fix futures_rule interface 0.5.62: add: add stock_a_pe, stock_a_pb interface 0.5.63: add: add stock_a_lg_indicator interface 0.5.64: add: add stock_a_high_low_statistics interface 0.5.65: add: add stock_a_below_net_asset_statistics interface 0.5.66: fix: fix stock_zh_a_daily default return unadjusted data 0.5.67: fix: fix R and MATLAB compatibility issues 0.5.68: add: add option_commodity_sina interface 0.5.69: fix: fix option_commodity_sina interface 0.5.70: merge: merge #4048 0.5.71: add: add tool_trade_date_hist interface 0.5.72: add: add fund_etf_category_sina, fund_etf_hist_sina interface 0.5.73: add: add stock_report_disclosure interface 0.5.74: add: add stock_zh_a_minute interface 0.5.75: add: add futures_zh_minute_sina interface 0.5.76: add: add option_finance_minute_sina interface 0.5.77: fix: fix currency_hist interface return data format 0.5.78: add: add hold field in futures_zh_minute_sina interface 0.5.79: add: add stock_report_fund_hold interface 0.5.80: fix: fix PG to futures cons file 0.5.81: add: add stock_zh_index_hist_csindex interface 0.5.82: fix: fix LU to futures cons file 0.5.83: fix: fix qhkc broker_positions_process interface 0.5.84: fix: fix tool_trade_date_hist_sina interface and update calendar.json 0.5.85: add: add index_stock_hist interface 0.5.86: fix: fix code format 0.5.87: fix: fix cot interface 0.5.88: fix: fix stock_account_statistics_em interface 0.5.89: add: add macro_china_new_financial_credit interface 0.5.90: add: add stock_sina_lhb interface 0.5.91: fix: fix covid for python3.8 0.5.92: fix: fix futures_daily_bar interface 0.5.93: add: add macro_china_fx_gold interface 0.5.94: add: add stock_zh_index_daily_em, bond_cb_jsl interface 0.5.95: fix: fix get_dce_option_daily interface 0.5.96: add: add stock_hsgt_hist_em interface 0.5.97: fix: fix remove mplfinance package in requirements.txt 0.5.98: add: add stock_hk_eniu_indicator interface 0.5.99: fix: fix stock_zh_ah_daily interface 0.6.1: fix: fix stock_zh_ah_daily interface set default value 0.6.2: fix: fix stock_zh_a_minute interface and add adjust parameter 0.6.3: fix: fix stock_zh_a_minute interface 0.6.4: add: add macro_china interface 0.6.5: add: add macro_china_wbck interface 0.6.6: fix: fix macro_china_wbck interface 0.6.7: add: add index_stock_cons_sina interface 0.6.8: fix: fix option_commodity interface 0.6.9: fix: fix stock_gpzy_pledge_ratio_em interface 0.6.10: add: add macro_china_hb, macro_china_gksccz, macro_china_bond_public interface 0.6.11: fix: fix python version should be 3.7 later 0.6.12: fix: fix stock_gpzy_distribute_statistics_company_em interface 0.6.13: add: add stock_us_fundamental interface 0.6.14: fix: fix stock_us_fundamental interface 0.6.15: fix: fix macro_china_market_margin_sh interface 0.6.16: fix: fix stock_us_daily time period and adjust for specific stock 0.6.17: fix: fix stock_js_weibo_report interface 0.6.18: fix: fix get_shfe_option_daily interface column name 0.6.19: fix: fix stock_hk_daily interface to process non-dividend stock 0.6.20: fix: fix covid_baidu interface 0.6.21: fix: fix futures_hf_spot interface 0.6.22: fix: fix stock_zh_index_daily_tx interface 0.6.23: fix: fix currency_hist interface 0.6.24: fix: fix stock_zh_kcb_spot interface 0.6.25: add: add stock_register_kcb interface 0.6.26: add: add stock_em_sy_list interface 0.6.27: fix: fix stock_sector_detail interface 0.6.28: add: add stock_register_cyb interface 0.6.29: fix: fix stock_zh_a_daily interface 0.6.30: add: add energy interface 0.6.31: fix: fix energy interface 0.6.32: fix: fix docs interface 0.6.33: fix: fix get_roll_yield_bar interface 0.6.34: fix: fix currency_investing and futures_inventory_em interface and add index_stock_cons_csindex interface 0.6.35: fix: fix get_futures_daily interface 0.6.36: fix: fix stock_info_a_code_name interface 0.6.37: fix: fix stock_sector_detail interface 0.6.38: fix: fix get_futures_daily interface 0.6.39: add: add stock_xgsglb_em interface 0.6.40: add: add stock_zh_a_new interface 0.6.41: fix: fix get_ine_daily interface 0.6.42: add: add bond_futures_deliverable_coupons interface 0.6.43: fix: fix bond_futures_deliverable_coupons interface 0.6.44: add: add futures_comex_inventory interface 0.6.45: add: add macro_china_xfzxx interface 0.6.46: add: add macro_china_reserve_requirement_ratio interface 0.6.47: fix: fix franchise_china interface 0.6.48: fix: fix get_rank_sum interface 0.6.49: fix: fix get_dce_rank_table interface 0.6.50: add: add macro_china_hgjck, macro_china_consumer_goods_retail interface 0.6.51: fix: fix macro_china_hgjck interface 0.6.52: add: add macro_china_society_electricity interface 0.6.53: add: add macro_china_society_traffic_volume interface 0.6.54: add: add macro_china_postal_telecommunicational interface 0.6.55: add: add macro_china_international_tourism_fx interface 0.6.56: add: add macro_china_swap_rate interface 0.6.57: fix: fix stock_sina_lhb_detail_daily interface 0.6.58: add: add bond_china_close_return interface 0.6.59: add: add macro_china_passenger_load_factor interface 0.6.60: fix: fix stock_sina_lhb_ggtj interface 0.6.61: fix: fix option_czce_hist interface 0.6.62: fix: fix sunrise_daily interface 0.6.63: fix: fix get_roll_yield_bar interface 0.6.64: add: add macro_china_insurance interface 0.6.65: add: add macro_china_supply_of_money interface 0.6.66: add: add support for python 3.9.0 0.6.67: add: add macro_china_foreign_exchange_gold interface 0.6.68: add: add macro_china_retail_price_index interface 0.6.69: fix: fix box_office_spot interface 0.6.70: fix: fix bond_investing_global interface 0.6.71: fix: fix futures_return_index_nh interface 0.6.72: fix: fix get_receipt interface 0.6.73: add: add news_cctv interface 0.6.74: fix: fix macro and acm interface 0.6.75: add: add movie_boxoffice interface 0.6.76: fix: fix remove execjs dependence 0.6.77: add: add macro_china_real_estate interface 0.6.78: fix: fix movie_boxoffice interface 0.6.79: fix: split movie_boxoffice to single interface 0.6.80: fix: movie_boxoffice interface 0.6.81: fix: fix stock_report_fund_hold interface 0.6.82: fix: fix stock_comment_em interface 0.6.83: add: add crypto_hist and crypto_name_url_table interface 0.6.84: fix: fix crypto_hist interface 0.6.85: fix: fix stock_a_pb and stock_a_pe interface 0.6.86: fix: fix stock_zh_a_minute interface 0.6.87: fix: remove email interface 0.6.88: fix: fix get_dce_rank_table interface 0.6.89: fix: fix get_dce_rank_table interface 0.6.90: add: add fund_em_rank interface 0.6.91: fix: fix get_futures_daily interface 0.6.92: add: add repo_rate_hist interface 0.6.93: fix: fix stock_report_fund_hold interface 0.6.94: fix: fix docs interface 0.6.95: fix: fix macro_china_market_margin_sh interface 0.6.96: fix: fix stock_zh_a_daily interface 0.6.97: add: add stock_hsgt_board_rank_em interface 0.6.98: fix: fix fortune_rank interface 0.6.99: add: add forbes_rank interface 0.7.1: fix: fix futures_dce_position_rank interface 0.7.2: add: add xincaifu_rank interface 0.7.3: add: add hurun_rank interface 0.7.4: fix: fix hurun_rank interface 0.7.5: add: add currency_pair_map interface 0.7.6: fix: fix stock_jgdy_detail_em interface 0.7.7: fix: fix stock_info interface 0.7.8: fix: fix bond_cb_jsl interface 0.7.9: fix: fix stock_jgdy_detail_em interface 0.7.10: fix: fix match_main_contract interface 0.7.11: fix: fix stock_analyst_rank_em and stock_analyst_detail_em interface 0.7.12: add: add stock_zh_a_cdr_daily interface 0.7.13: fix: fix stock_zh_a_cdr_daily and stock_zh_a_daily interface 0.7.14: fix: fix get_receipt interface 0.7.15: add: add futures_contract_detail interface 0.7.16: fix: fix futures_zh_spot interface 0.7.17: del: del zdzk interface 0.7.18: fix: fix stock_zh_a_daily interface 0.7.19: fix: fix stock_zh_a_daily interface 0.7.20: fix: fix stock_jgdy_tj_em interface 0.7.21: fix: fix zh_stock_kcb_report interface 0.7.22: fix: fix zh_stock_kcb_report interface 0.7.23: fix: fix fund_open_fund_info_em interface 0.7.24: fix: fix futures_spot_price_daily interface 0.7.25: add: add option_current_em interface 0.7.26: fix: fix option_current_em interface 0.7.27: add: add js_news interface 0.7.28: fix: fix js_news interface 0.7.29: fix: fix macro_china_market_margin_sh interface 0.7.30: add: add nlp_answer interface 0.7.31: fix: fix index_sw interface 0.7.32: add: add index_cni interface 0.7.33: add: add more index_cni interface 0.7.34: add: add stock_dzjy_sctj interface 0.7.35: add: add stock_dzjy_mrmx interface 0.7.36: add: add stock_dzjy_mrtj interface 0.7.37: add: add stock_dzjy_hygtj interface 0.7.38: add: add stock_dzjy_hyyybtj interface 0.7.39: add: add stock_dzjy_yybph interface 0.7.40: fix: fix js_news interface 0.7.41: add: add stock_yzxdr_em interface 0.7.42: fix: fix fund_etf_fund_daily_em interface 0.7.43: fix: fix match_main_contract interface 0.7.44: fix: fix stock_hk_daily interface 0.7.45: fix: fix stock_yzxdr_em interface 0.7.46: fix: fix option_czce_hist interface 0.7.47: fix: fix bond_zh_cov interface 0.7.48: fix: fix futures_dce_position_rank interface 0.7.49: fix: fix stock_us_zh_spot interface 0.7.50: fix: fix stock_hsgt_stock_statistics_em interface 0.7.51: fix: fix stock_us_daily interface 0.7.52: fix: fix stock_sector_fund_flow_rank interface 0.7.53: fix: fix stock_yzxdr_em interface 0.7.54: add: add stock_a_code_to_symbol interface 0.7.55: add: add stock_news_em interface 0.7.56: fix: fix stock_news_em interface 0.7.57: fix: fix xlrd support 0.7.58: fix: fix stock_zh_a_tick_tx_js support 0.7.59: fix: fix read_excel support 0.7.60: fix: fix fund_open_fund_daily_em interface 0.7.61: fix: fix calendar.json interface 0.7.62: fix: fix QQ group interface 0.7.63: add: add bond_summary_sse interface 0.7.64: fix: fix macro_cons_gold_volume interface 0.7.65: fix: fix fund_value_estimation_em interface 0.7.66: fix: fix fund_value_estimation_em interface 0.7.67: fix: fix get_dce_daily interface 0.7.68: fix: fix stock_zh_index_spot interface 0.7.69: fix: fix covid_19 interface 0.7.70: fix: fix get_dce_rank_table interface 0.7.71: fix: fix stock_us_daily interface 0.7.72: fix: fix get_ine_daily interface 0.7.73: add: add macro_china_money_supply interface 0.7.74: fix: fix stock_zh_a_minute interface 0.7.75: add: add bond_cash_summary_sse interface 0.7.76: fix: fix get_rank_sum_daily interface 0.7.77: fix: fix get_inventory_data interface 0.7.78: fix: fix futures_inventory_99 interface 0.7.79: fix: fix stock_a_below_net_asset_statistics interface 0.7.80: add: add bank_rank_banker interface 0.7.81: add: add macro_china_stock_market_cap interface 0.7.82: fix: fix macro_china_stock_market_cap interface 0.7.83: fix: fix stock_news_em interface 0.7.84: fix: fix covid_19_dxy interface 0.7.85: add: add futures_spot_price_previous interface 0.7.86: add: add fund_em_hk_rank interface 0.7.87: add: add fund_em_lcx_rank interface 0.7.88: fix: fix bond_repo_zh_tick interface 0.7.89: fix: fix stock_hk_daily interface 0.7.90: fix: fix stock_gpzy_pledge_ratio_em interface 0.7.91: fix: fix stock_report_disclosure interface 0.7.92: add: add fund_hk_fund_hist_em interface 0.7.93: add: add fund_portfolio_hold_em interface 0.7.94: fix: fix futures_spot_price_previous interface 0.7.95: add: add covid_19_trace interface 0.7.96: fix: fix bond_spot_quote interface 0.7.97: fix: fix bond_spot_deal interface 0.7.98: fix: fix stock_report_fund_hold interface 0.7.99: fix: fix stock_zh_a_daily interface 0.8.1: add: add stock_report_fund_hold_detail interface 0.8.2: fix: fix option_finance_board interface 0.8.3: fix: fix stock_zh_a_daily interface 0.8.4: fix: fix option interface 0.8.5: fix: fix bond_investing_global interface 0.8.6: add: add macro_china_shrzgm interface 0.8.7: add: add stock_zh_a_tick_163_now interface 0.8.8: fix: fix add PK to CZCE 0.8.9: add: add futures delivery and spot interface 0.8.10: fix: fix fund_portfolio_hold_em interface 0.8.11: add: add futures_to_spot_dce interface 0.8.12: add: add futures_delivery_shfe interface 0.8.13: fix: fix stock_us_daily interface 0.8.14: fix: fix fund_open_fund_rank_em interface 0.8.15: fix: fix chinese_to_english interface 0.8.16: fix: fix stock_a_pe interface 0.8.17: add: add stock_financial_report_sina interface 0.8.18: fix: fix futures_spot_price_daily interface 0.8.19: add: add stock_margin_sse interface 0.8.20: add: add stock_margin_detail_sse interface 0.8.21: fix: fix stock_szse_summary interface 0.8.22: fix: fix stock_zh_a_daily interface 0.8.23: fix: fix covid_19_dxy interface 0.8.24: fix: fix fund_value_estimation_em interface 0.8.25: fix: fix stock_zh_index_daily_tx interface 0.8.26: fix: fix stock_hk_daily interface 0.8.27: fix: fix get_dce_rank_table interface 0.8.28: fix: fix stock_analyst_rank_em interface 0.8.29: add: add fund_rating interface 0.8.30: add: add fund_manager interface 0.8.31: fix: fix stock_zh_a_minute interface 0.8.32: fix: fix get_dce_rank_table interface 0.8.33: add: add stock_profit_forecast interface 0.8.34: fix: fix index_investing_global interface 0.8.35: add: add bond_zh_us_rate interface 0.8.36: add: add stock_fhps_em interface 0.8.37: add: add stock_yjkb_em interface 0.8.38: fix: fix get_czce_daily interface 0.8.39: add: add stock_board_concept_cons_ths interface 0.8.40: fix: fix stock_board_concept_cons_ths interface 0.8.41: fix: fix energy_carbon_bj interface 0.8.42: fix: fix stock_zh_a_daily interface 0.8.43: fix: fix stock_yjyg_em interface 0.8.44: fix: fix stock_comment_em interface 0.8.45: add: add stock_sse_deal_daily interface 0.8.46: fix: fix stock_board_concept_cons_ths interface 0.8.47: add: add stock_board_concept_info_ths interface 0.8.48: fix: fix fund_rating_sh fund_rating_zs fund_rating_ja interface 0.8.49: add: add stock_yjbb_em interface 0.8.50: fix: fix stock_zh_index_spot interface 0.8.51: fix: fix stock_zh_a_spot interface 0.8.52: add: add stock_zcfz_em, stock_lrb_em, stock_xjll_em interface 0.8.53: fix: fix stock_zcfz_em interface 0.8.54: fix: fix stock_register_kcb interface 0.8.55: add: add stock_ipo_declare interface 0.8.56: fix: fix index_bloomberg_billionaires interface 0.8.57: fix: fix hurun_rank interface 0.8.58: add: add hurun_rank interface 0.8.59: fix: fix get_sector_futures interface 0.8.60: fix: fix currency_hist interface 0.8.61: fix: fix stock_hsgt_hold_stock_em interface 0.8.62: fix: fix stock_zh_a_tick_163 interface 0.8.63: fix: fix futures_zh_daily_sina interface 0.8.64: fix: fix futures_inventory_em interface 0.8.65: fix: fix futures_hq_spot_df interface 0.8.66: fix: fix currency_hist interface 0.8.67: fix: fix requirements.txt interface 0.8.68: fix: fix bond_investing_global interface 0.8.69: fix: fix stock_board_concept_cons_ths interface 0.8.70: add: add stock_board_concept_index_ths interface 0.8.71: fix: fix remove obor fold 0.8.72: fix: fix stock_board_concept_index_ths interface 0.8.73: add: add stock_board_industry_index_ths interface 0.8.74: fix: fix test interface 0.8.75: fix: fix stock_board_industry_index_ths interface 0.8.76: add: add stock_notice_report interface 0.8.77: fix: fix rate_interbank interface 0.8.78: fix: fix stock_board_concept_index_ths interface 0.8.79: add: add stock_lh_yyb_most, stock_lh_yyb_capital, stock_lh_yyb_control interface 0.8.80: fix: fix stock_yjkb_em interface 0.8.81: add: add crypto_bitcoin_hold_report interface 0.8.82: fix: fix energy_carbon_hb interface 0.8.83: fix: fix get_czce_daily interface 0.8.84: fix: fix amac_fund_abs interface 0.8.85: fix: fix rename amac_person_org_list to amac_person_fund_org_list interface 0.8.86: add: add amac_person_bond_org_list interface 0.8.87: add: add stock_fund_flow_concept interface 0.8.88: add: add stock_fund_flow_industry interface 0.8.89: add: add stock_fund_flow_individual interface 0.8.90: add: add stock_fund_flow_big_deal interface 0.8.91: add: add stock_ggcg_em interface 0.8.92: fix: fix stock_zh_a_daily interface 0.8.93: fix: fix bond_spot_deal interface 0.8.94: fix: fix stock_us_daily interface 0.8.95: add: add fund_new_found_em interface 0.8.96: fix: fix get_czce_rank_table interface 0.8.97: add: add stock_wc_hot_top interface 0.8.98: add: add index_kq interface 0.8.99: fix: fix stock_individual_fund_flow_rank interface 0.9.1: fix: fix stock_profit_forecast interface 0.9.2: fix: fix get_futures_daily interface 0.9.3: fix: fix get_futures_daily interface 0.9.4: fix: fix get_shfe_daily interface 0.9.5: add: add stock_hot_rank_wc interface 0.9.6: fix: fix stock_hot_rank_wc interface 0.9.7: fix: fix stock_hot_rank_wc interface 0.9.8: fix: fix forbes_rank interface 0.9.9: fix: fix stock_a_below_net_asset_statistics interface 0.9.10: fix: fix stock_hot_rank_wc interface 0.9.11: add: add drewry_wci_index interface 0.9.12: fix: fix bond_investing_global interface 0.9.13: fix: fix currency_hist interface 0.9.14: fix: fix futures_global_commodity_hist interface 0.9.15: add: add index_kq_fashion interface 0.9.16: add: add index_eri interface 0.9.17: fix: fix futures_global_commodity_hist interface 0.9.18: fix: fix stock_dxsyl_em interface 0.9.19: add: add stock_market_activity_legu interface 0.9.20: fix: fix stock_individual_fund_flow_rank interface 0.9.21: add: add index_cflp_price interface 0.9.22: add: add index_cflp_volume interface 0.9.23: fix: fix index_cflp_volume interface 0.9.24: fix: fix stock_info_sz_name_code interface 0.9.25: add: add car_gasgoo_sale_rank interface 0.9.26: fix: fix stock_hk_daily interface 0.9.27: fix: fix stock_report_fund_hold interface 0.9.28: add: add stock_average_position_legu interface 0.9.29: add: add stock_em_qbzf interface 0.9.30: add: add stock_em_pg interface 0.9.31: fix: fix index_investing_global interface 0.9.32: fix: fix bond_investing_global interface 0.9.33: add: add marco_china_hk interface 0.9.34: fix: fix get_futures_daily interface 0.9.35: fix: fix stock_zh_a_daily interface 0.9.36: fix: fix stock_zh_a_daily hfq and qfq interface 0.9.37: fix: fix stock_hot_rank_wc interface 0.9.38: add: add stock_zt_pool_em interface 0.9.39: fix: fix stock_us_daily interface 0.9.40: fix: fix bond_cov_comparison interface 0.9.41: fix: fix stock_zt_pool_previous_em interface 0.9.42: add: add stock_zt_pool_strong_em interface 0.9.43: fix: fix stock_zt_pool_strong_em interface 0.9.44: fix: fix stock_zt_pool_sub_new_em interface 0.9.45: fix: fix stock_zt_pool_em interface 0.9.46: fix: fix spot_goods interface 0.9.47: fix: fix futures_comex_inventory interface 0.9.48: fix: fix stock_zcfz_em interface 0.9.49: fix: fix stock_hk_daily interface 0.9.50: fix: fix futures_spot_stock interface 0.9.51: fix: fix stock_hk_daily interface 0.9.52: fix: remove internal_flow_history interface 0.9.53: add: add stock_zh_a_alerts_cls interface 0.9.54: fix: fix bond_zh_us_rate interface 0.9.55: fix: fix index_vix interface 0.9.56: fix: fix macro_fx_sentiment interface 0.9.57: fix: fix stock_zh_a_alerts_cls interface 0.9.58: add: add stock_staq_net_stop interface 0.9.59: fix: fix covid_19_baidu interface 0.9.60: fix: fix currency_convert interface 0.9.61: fix: fix stock_info_sz_name_code interface 0.9.62: add: add stock_zh_a_gdhs interface 0.9.63: fix: fix stock_zh_a_gdhs interface 0.9.64: add: add futures_sina_hold_pos interface 0.9.65: fix: fix bond_zh_us_rate interface 0.9.66: fix: fix set urllib3==1.25.11 0.9.67: fix: fix stock_hsgt_hold_stock_em interface 0.9.68: fix: fix stock_zh_a_tick_tx interface 0.9.69: add: add currency_boc_sina interface 0.9.70: add: add stock_zh_a_hist interface 0.9.71: fix: fix stock_zh_a_hist interface 0.9.72: fix: fix stock_zh_a_hist interface 0.9.73: fix: fix stock_zh_a_tick_tx_js interface 0.9.74: add: add stock_changes_em interface 0.9.75: add: add stock_hk_spot_em, stock_hk_hist interface 0.9.76: add: add stock_us_spot_em, stock_us_hist interface 0.9.77: fix: fix stock_us_hist interface 0.9.78: fix: fix rename python file name interface 0.9.79: add: add crypto_bitcoin_cme interface 0.9.80: fix: fix futures_display_main_sina interface 0.9.81: add: add crypto_crix interface 0.9.82: fix: fix crypto_crix interface 0.9.83: fix: fix crypto_crix interface 0.9.84: fix: fix rename futures_hq_spot to futures_foreign_commodity_realtime interface 0.9.85: fix: fix rate_interbank interface 0.9.86: add: add fund_aum_em interface 0.9.87: fix: fix death_company interface 0.9.88: fix: fix stock_financial_analysis_indicator interface 0.9.89: fix: fix fund_manager interface 0.9.90: fix: fix stock_a_below_net_asset_statistics interface 0.9.91: fix: fix stock_yjbb_em interface 0.9.92: fix: fix stock_tfp_em interface 0.9.93: fix: fix stock_zh_a_gdhs interface 0.9.94: add: add macro_china_qyspjg, macro_china_fdi interface 0.9.95: fix: fix stock_board_concept_index_ths interface 0.9.96: fix: fix stock_info_sz_name_code interface 0.9.97: fix: fix urllib3 version at 1.25.8 0.9.98: fix: fix js_news interface 0.9.99: fix: fix news_cctv interface 1.0.1: add: add macro_usa_phs interface 1.0.2: fix: fix macro_usa_phs interface 1.0.3: add: add macro_germany interface 1.0.4: fix: fix macro_china interface 1.0.5: add: add macro_china_gyzjz interface 1.0.6: fix: fix get_receipt interface 1.0.7: fix: fix get_ine_daily interface 1.0.8: fix: fix macro_china_cpi interface 1.0.9: fix: fix stock_zh_a_gdhs interface 1.0.10: fix: fix stock_zh_a_spot_em interface 1.0.11: fix: fix stock_board_industry_name_ths interface 1.0.12: fix: fix macro_china_money_supply interface 1.0.13: fix: fix rename stock_board_concept_index_ths to stock_board_concept_hist_ths interface 1.0.14: add: add stock_board_concept_cons_em and stock_board_concept_hist_em interface 1.0.15: fix: fix stock_hk_hist interface 1.0.16: fix: fix tool_trade_date_hist_sina interface 1.0.17: fix: fix calendar.json interface 1.0.18: fix: fix reformat macro_china_national_tax_receipts, macro_china_hgjck, macro_china_stock_market_cap interface 1.0.19: fix: fix marco_china_hk interface 1.0.20: fix: fix bond_zh_hs_cov_daily interface 1.0.21: fix: fix charity_china interface 1.0.22: fix: fix stock_xgsglb_em interface 1.0.23: fix: fix stock_dxsyl_em interface 1.0.24: fix: fix stock_board_concept_hist_em interface 1.0.25: fix: fix get_receipt interface 1.0.26: add: add energy_carbon_domestic interface 1.0.27: fix: fix get_roll_yield_bar interface 1.0.28: add: add covid_19_baidu interface 1.0.29: fix: fix covid_19_baidu interface 1.0.30: fix: fix option_czce_hist interface 1.0.31: fix: fix futures_foreign_commodity_realtime interface 1.0.32: fix: fix covid_19_baidu interface 1.0.33: fix: fix bond_china_close_return interface 1.0.34: fix: fix bond_china_close_return interface 1.0.35: fix: fix bond_cb_jsl interface 1.0.36: fix: fix stock_hsgt_north_net_flow_in_em interface 1.0.37: add: add macro_swiss interface 1.0.38: add: add macro_japan interface 1.0.39: add: add macro_uk interface 1.0.40: add: add stock_szse_margin interface 1.0.41: add: add macro_australia interface 1.0.42: fix: fix index_stock_hist interface 1.0.43: fix: fix stock_margin_detail_szse interface 1.0.44: fix: fix stock_margin_detail_szse interface 1.0.45: fix: fix option_dce_daily interface and rename interface in option_commodity 1.0.46: add: add futures_hog_info interface 1.0.47: fix: fix futures_hog_info interface 1.0.48: add: add macro_canada interface 1.0.49: fix: fix stock_individual_fund_flow interface 1.0.50: fix: fix stock_jgdy_tj_em interface 1.0.51: add: add sport_olympic_hist interface 1.0.52: add: add stock_financial_hk interface 1.0.53: fix: fix tool_trade_date_hist_sina interface 1.0.54: fix: fix macro_china_gdp_yearly interface 1.0.55: fix: fix macro_china_freight_index interface 1.0.56: add: add stock_a_ttm_lyr interface 1.0.57: add: add stock_a_all_pb interface 1.0.58: add: add futures_hog_rank interface 1.0.59: fix: fix futures_zh_daily_sina interface 1.0.60: fix: fix futures_main_sina interface 1.0.61: fix: fix stock_a_all_pb interface 1.0.62: add: add futures_egg_price interface 1.0.63: fix: fix remove jyfm interface 1.0.64: fix: fix rename zh_stock_kcb_report to stock_zh_kcb_report_em interface 1.0.65: fix: fix stock_gpzy_pledge_ratio_detail_em interface 1.0.66: fix: fix macro_cons_opec_month interface 1.0.67: fix: fix futures_sgx_daily interface 1.0.68: fix: remove agoyal_stock_return interface 1.0.69: fix: remove bank_rank_banker interface 1.0.70: fix: remove watch_jinshi_quotes interface 1.0.71: fix: remove watch_argus interface 1.0.72: fix: fix amac_fund_abs interface 1.0.73: add: add bond_cash_summary_sse interface 1.0.74: fix: fix bond_zh_hs_cov_spot interface 1.0.75: fix: fix bond_futures_deliverable_coupons interface 1.0.76: fix: fix stock_financial_hk_analysis_indicator_em interface 1.0.77: fix: fix macro_china_m2_yearly interface 1.0.78: add: add reits_realtime_em, reits_info_jsl interface 1.0.79: fix: fix news_cctv interface 1.0.80: add: add stock_zh_a_hist_min_em, stock_zh_a_hist_pre_min_em interface 1.0.81: add: add stock_us_hist_min_em, stock_hk_hist_min_em interface 1.0.82: fix: fix bond_zh_cov interface 1.0.83: fix: fix macro_china interface 1.0.84: add: add bond_zh_cov_info interface 1.0.85: fix: fix stock_report_fund_hold interface 1.0.86: fix: fix stock_zt_pool_dtgc_em interface 1.0.87: fix: fix macro_china_swap_rate interface 1.0.88: fix: fix stock_zh_a_hist_min_em interface 1.0.89: fix: fix stock_hk_hist_min_em interface 1.0.90: fix: fix stock_us_hist_min_em interface 1.0.91: fix: fix stock_zh_a_hist_min_em interface 1.0.92: fix: fix stock_zh_a_hist interface 1.0.93: fix: fix stock_hk_hist_min_em interface 1.0.94: fix: fix stock_zh_a_new interface 1.0.95: fix: fix stock_zh_a_daily interface 1.0.96: add: add stock_zh_a_st_em interface 1.0.97: fix: fix futures_spot_stock interface 1.0.98: add: add stock_zh_a_new_em interface 1.0.99: fix: fix stock_hot_rank_wc interface 1.1.1: add: add index_investing_global_from_url interface 1.1.2: add: add stock_us_pink_spot_em interface 1.1.3: add: add stock_us_famous_spot_em interface 1.1.4: fix: fix stock_average_position_legu interface 1.1.5: add: add stock_rank_forecast_cninfo interface 1.1.6: fix: fix futures_zh_minute_sina interface 1.1.7: fix: fix covid_19_trace interface 1.1.8: add: add stock_industry_pe_ratio_cninfo interface 1.1.9: fix: fix stock_price_js interface 1.1.10: fix: fix stock_hsgt_hold_stock_em interface 1.1.11: fix: fix stock_fund_flow_concept interface 1.1.12: fix: fix stock_fund_flow_industry interface 1.1.13: add: add stock_dividents_cninfo interface 1.1.14: fix: fix stock_fund_flow_concept interface 1.1.15: add: add stock_new_gh_cninfo interface 1.1.16: fix: fix stock_jgdy_detail_em interface 1.1.17: fix: fix stock_jgdy_tj_em interface 1.1.18: fix: fix stock_fund_flow_concept and stock_fund_flow_industry interface 1.1.19: add: add stock_new_ipo_cninfo interface 1.1.20: fix: fix stock_a_pe interface 1.1.21 fix: fix setuptools==57.5.0 package 1.1.22 fix: fix remove demjson package 1.1.23 fix: fix update urllib3 package 1.1.24 fix: fix email address 1.1.25 add: add stock_hold_num_cninfo interface 1.1.26 fix: fix stock_fund_flow_concept interface 1.1.27 add: add stock_hold_control_cninfo interface 1.1.28 fix: fix move project to AKFamily interface 1.1.29 fix: fix urllib3>=1.25.8 package 1.1.30 fix: fix stock_zh_index_hist_csindex interface 1.1.31 add: add stock_hold_management_detail_cninfo interface 1.1.32 add: add sw_index_representation_spot interface 1.1.33 fix: fix sw_index_xxx interface 1.1.34 fix: fix drewry_wci_index interface 1.1.35 fix: fix fund_etf_category_sina interface 1.1.36 fix: fix sw_index_daily_indicator interface 1.1.37 fix: fix drewry_wci_index interface 1.1.38 add: add futures_comm_info interface 1.1.39 fix: fix futures_comm_info interface 1.1.40 fix: fix remove covid_19_history interface 1.1.41 add: add stock_zh_b_sina interface 1.1.42 fix: fix stock_zh_a_minute interface 1.1.43 add: add stock_cg_guarantee_cninfo interface 1.1.44 fix: fix stock_zh_index_daily interface 1.1.45 fix: fix stock_zh_index_daily_tx interface 1.1.46 fix: fix remove watch_jinshi_fx interface 1.1.47 fix: fix stock_jgdy_tj_em and stock_jgdy_detail_em interface 1.1.48 fix: fix rename fund_em_portfolio_hold to fund_portfolio_hold_em interface 1.1.49 fix: fix stock_jgdy_tj_em and stock_jgdy_detail_em interface 1.1.50 add: add stock_cg_lawsuit_cninfo interface 1.1.51 fix: fix stock_hot_rank_wc interface 1.1.52 add: add stock_cg_equity_mortgage_cninfo interface 1.1.53 fix: fix index_detail_hist_adjust_cni interface 1.1.54 fix: fix stock_board_concept_hist_ths interface 1.1.55 fix: fix stock_sina_lhb_ggtj and stock_sina_lhb_jgzz interface 1.1.56 add: add fund_aum_hist_em interface 1.1.57 fix: fix stock_sina_lhb_ggtj and stock_sina_lhb_jgzz interface 1.1.58 add: add bond_treasure_issue_cninfo interface 1.1.59 add: add bond_local_government_issue_cninfo interface 1.1.60 add: add bond_corporate_issue_cninfo interface 1.1.61 add: add bond_cov_issue_cninfo interface 1.1.62 fix: fix bond_zh_us_rate interface 1.1.63 add: add bond_cov_stock_issue_cninfo interface 1.1.64 add: add fund_report_stock_cninfo interface 1.1.65 fix: fix stock_notice_report interface 1.1.66 add: add fund_report_industry_allocation_cninfo interface 1.1.67 fix: fix stock_zh_index_hist_csindex interface 1.1.68 fix: fix index_stock_cons_csindex interface 1.1.69 add: add fund_scale_open_sina interface 1.1.70 add: add fund_scale_close_sina interface 1.1.71 add: add fund_scale_structured_sina interface 1.1.72 add: add fund_report_asset_allocation_cninfo interface 1.1.73 add: add stock_zh_index_value_csindex interface 1.1.74 fix: fix fund_etf_fund_info_em interface 1.1.75 add: add index_value_hist_funddb interface 1.1.76 fix: fix amac_fund_info interface 1.1.77 fix: fix stock_zh_a_tick_163_now interface 1.1.78 add: add stock_hsgt_individual_em interface 1.1.79 fix: fix stock_jgdy_tj_em interface 1.1.80 add: add support for Python 3.10 interface 1.1.81 add: add stock_hsgt_individual_detail_em interface 1.1.82 fix: fix stock_tfp_em interface 1. rename stock_em_tfp to stock_tfp_em 2. reformat output data type 1.1.83 add: add stock_ipo_benefit_ths interface 1.1.84 fix: fix stock_board_industry_index_ths interface 1. add start_date and end_date parameters 1.1.85 fix: fix stock_hsgt_stock_statistics_em interface 1.1.86 fix: fix stock_hsgt_stock_statistics_em interface 1.1.87 fix: fix stock_hsgt_hist_em interface 1.1.88 fix: fix stock_sector_spot interface 1.1.89 fix: fix stock_sector_detail interface 1.1.90 fix: fix stock_board_concept_name_ths interface 1.1.91 fix: fix stock_hsgt_individual_detail_em interface 1.1.92 add: add stock_rank_cxg_ths interface 1.1.93 add: add stock_rank_cxd_ths interface 1.1.94 fix: fix fund_portfolio_hold_em interface 1.1.95 fix: fix stock_board_concept_hist_ths interface 1.1.96 add: add bond_zh_hs_cov_min interface 1.1.97 add: add stock_rank_lxsz_ths interface 1.1.98 add: add stock_rank_lxxd_ths interface 1.1.99 add: add stock_rank_cxfl_ths interface 1.2.1 add: add stock_rank_cxsl_ths interface 1.2.2 fix: fix zh_subscribe_exchange_symbol interface 1.2.3 add: add stock_rank_xstp_ths interface 1.2.4 fix: fix fund_portfolio_hold_em interface 1.2.5 fix: fix index_stock_hist interface 1.2.6 add: add stock_rank_xxtp_ths interface 1.2.7 add: add stock_rank_ljqd_ths interface 1.2.8 add: add stock_rank_ljqs_ths interface 1.2.9 fix: fix stock_zh_a_gdhs interface 1.2.10 fix: fix bond_zh_hs_daily interface 1.2.11 add: add stock_zh_a_gdhs_detail_em interface 1.2.12 fix: fix stock_zh_a_gdhs interface 1.2.13 add: add stock_rank_xzjp_ths interface 1.2.14 add: add sw_index_second_spot interface 1.2.15 fix: fix stock_board_industry_name_ths interface 1.2.16 add: add stock_board_cons_ths interface 1.2.17 fix: fix amac_fund_info interface 1.2.18 fix: fix amac interface 1.2.19 fix: fix amac cons.py interface 1.2.20 fix: fix stock_zh_a_spot_em interface 1.2.21 fix: fix stock_zh_a_hist interface 1.2.22 fix: fix amac_fund_info interface 1.2.23 add: add video_tv interface 1.2.24 fix: fix car_gasgoo_sale_rank interface 1.2.25 fix: fix amac_manager_classify_info interface 1.2.26 fix: fix amac interface 1.2.27 add: add online_value_artist interface 1.2.28 add: add club_rank_game interface 1.2.29 add: add player_rank_game interface 1.2.30 add: add business_value_artist interface 1.2.31 fix: fix stock_zt_pool_em interface 1.2.32 add: add video_variety_show interface 1.2.33 add: add fund_fh_em interface 1.2.34 fix: fix fund_open_fund_info_em interface 1.2.35 fix: fix fund_open_fund_info_em interface 1.2.36 add: add stock_info_bj_name_code interface 1.2.37 fix: fix stock_info_a_code_name interface 1.2.38 fix: fix futures_foreign_commodity_realtime interface 1.2.39 fix: fix stock_info_sh_delist interface 1.2.40 add: add fund_scale_change_em interface 1.2.41 add: add fund_hold_structure_em interface 1.2.42 fix: fix fund_manager interface 1.2.43 fix: fix get_czce_daily interface 1.2.44 add: add futures_index_cscidx interface 1.2.45 fix: fix stock_info_a_code_name interface 1.2.46 add: add stock_board_industry_cons_em interface 1.2.47 fix: fix covid_19_dxy interface 1.2.48 fix: fix covid_19_dxy interface 1.2.49 fix: fix rate_interbank interface 1.2.50 fix: fix futures_price_index_nh interface 1.2.51 add: add futures_hq_subscribe_exchange_symbol interface 1.2.52 fix: fix futures_foreign_commodity_realtime interface 1.2.53 add: add get_ine_daily interface 1.2.54 fix: fix bond_zh_hs_cov_min interface 1.2.55 add: add stock_repurchase_em interface 1.2.56 fix: fix stock_zh_a_tick_163 interface 1.2.57 add: add stock_us_hist_fu interface 1.2.58 fix: fix stock_board_concept_hist_ths interface 1.2.59 fix: fix macro_china_hk interface 1.2.60 fix: fix macro_china_hk interface 1.2.61 fix: fix stock_board_concept_hist_ths interface 1.2.62 fix: fix stock_dzjy_sctj interface 1.2.63 add: add spot_hist_sge interface 1.2.64 add: add spot_silver_benchmark_sge interface 1.2.65 remove: remove wdbank interface 1.2.66 add: add spot_golden_benchmark_sge interface 1.2.67 fix: fix air_quality_hebei interface 1.2.68 fix: fix stock_financial_hk_analysis_indicator_em interface 1.2.69 fix: fix get_futures_daily interface 1.2.70 fix: fix sw_index_spot interface 1.2.71 add: add sw_index_third_info interface 1.2.72 add: add sw_index_third_cons interface 1.2.73 fix: fix sw_index_third_cons interface 1.2.74 fix: fix macro_australia and macro_canada interface 1.2.75 fix: fix docs interface 1.2.76 fix: fix amac_person_fund_org_list interface 1.2.77 add: add bond_cb_adj_logs_jsl interface 1.2.78 fix: fix amac_person_fund_org_list interface 1.2.79 fix: fix amac_person_fund_org_list interface 1.2.80 fix: fix sw_index_daily interface 1.2.81 fix: fix stock_us_hist_fu interface 1.2.82 fix: fix spot_symbol_table_sge interface 1.2.83 fix: fix macro_bank interface 1.2.84 fix: fix repo_rate_hist interface 1.2.85 fix: fix repo_rate_hist interface 1.2.86 add: add stock_a_pe_and_pb interface 1.2.87 add: add stock_hk_ggt_components_em interface 1.2.88 fix: fix futures_nh_index interface 1.2.89 fix: fix futures_index_cscidx interface 1.2.90 fix: fix stock_board_industry_index_ths interface 1.2.91 fix: fix fund_etf_hist_sina interface 1.2.92 fix: fix futures_zh_spot interface 1.2.93 fix: fix fund_manager interface 1.2.94 fix: fix fund_new_found_em interface 1.2.95 add: add stock_individual_info_em interface 1.2.96 fix: fix match_main_contract interface 1.2.97 fix: fix stock_profit_forecast interface 1.2.98 fix: fix futures_spot_stock interface 1.2.99 fix: fix PYPI info 1.3.1 fix: fix option_shfe_daily interface 1.3.2 fix: remove github interface 1.3.3 fix: fix stock_em_ztb interface 1.3.4 fix: fix stock_hsgt_stock_statistics_em interface 1.3.5 fix: update QQ info 1.3.6 fix: fix stock_dzjy_sctj interface 1.3.7 fix: fix stock_hsgt_north_xxxx interface 1.3.8 fix: fix stock_info_change_name interface 1.3.9 add: add index_sugar_msweet interface 1.3.10 fix: fix index_sugar_msweet interface 1.3.11 fix: fix index_cflp_price interface 1.3.12 add: add index_inner_quote_sugar_msweet interface 1.3.13 fix: fix stock_zh_a_tick_163 interface 1.3.14 fix: fix stock_zh_a_scr_report interface 1.3.15 fix: fix option_current_em interface 1.3.16 fix: fix stock_account_statistics_em interface 1.3.17 fix: fix stock_sse_deal_daily interface 1.3.18 fix: fix stock_sse_summary interface 1.3.19 add: add index_stock_cons_weight_csindex interface 1.3.20 fix: fix index_cni_xx interface 1.3.21 fix: fix index_detail_hist_adjust_cni interface 1.3.22 fix: fix hf_sp_500 interface 1.3.23 fix: fix macro_china_gksccz interface 1.3.24 fix: fix macro_china_bond_public interface 1.3.25 fix: fix stock_hk_hist interface 1.3.26 fix: fix stock_us_spot_em interface 1.3.27 fix: fix stock_us_hist interface 1.3.28 fix: fix stock_zh_a_hist interface 1.3.29 fix: fix update calendar.json to 2022 1.3.30 fix: fix stock_zh_index_daily_em interface 1.3.31 fix: fix stock_dzjy_mrmx interface 1.3.32 fix: fix stock_dzjy_mrtj interface 1.3.33 fix: fix stock_dzjy_yybph interface 1.3.34 fix: fix stock_history_dividend interface 1.3.35 add: add fund_purchase_em interface 1.3.36 fix: fix futures_inventory_99 interface 1.3.37 fix: fix stock_financial_analysis_indicator interface 1.3.38 fix: fix index_value_name_funddb interface 1.3.39 fix: fix macro_china_hb interface 1.3.40 add: add stock_gdfx_free_holding_analyse_em interface 1.3.41 add: add stock_gdfx_free_top_10_em interface 1.3.42 add: add stock_gdfx_free_holding_detail_em interface 1.3.43 add: add stock_gdfx_free_holding_change_em interface 1.3.44 fix: fix stock_board_concept_name_ths interface 1.3.45 add: add stock_gdfx_holding_change_em interface 1.3.46 fix: fix futures_main_sina interface 1.3.47 add: add stock_gdfx_free_holding_statistics_em interface 1.3.48 add: add stock_gdfx_free_holding_teamwork_em interface 1.3.49 fix: fix fund_open_fund_info_em interface 1.3.50 fix: fix stock_notice_report interface 1.3.51 fix: fix futures_comm_info interface 1.3.52 fix: fix stock_hsgt_individual_detail_em interface 1.3.53 fix: fix sw_index_cons interface 1.3.54 fix: fix stock_em_qbzf interface 1.3.55 fix: fix futures_comm_info interface 1.3.56 fix: fix stock_hsgt_board_rank_em interface 1.3.57 fix: fix futures_main_sina interface 1.3.58 fix: fix stock_margin_detail_szse interface 1.3.59 add: add covid_19_risk_area interface 1.3.60 fix: fix covid_19_risk_area interface 1.3.61 fix: fix futures_zh_spot interface 1.3.62 fix: fix option_sse_spot_price_sina interface 1.3.63 fix: fix option_finance_minute_sina interface 1.3.64 fix: fix futures_foreign_commodity_realtime interface 1.3.65 fix: fix option_sse_codes_sina interface 1.3.66 fix: fix option_commodity_hist_sina interface 1.3.67 add: add option_lhb_em interface 1.3.68 fix: fix stock_hsgt_board_rank_em interface 1.3.69 fix: fix stock_gdfx_free_holding_statistics_em interface 1.3.70 fix: fix option_sse_spot_price_sina interface 1.3.71 fix: fix stock_history_dividend_detail interface 1.3.72 add: add option_value_analysis_em interface 1.3.73 fix: fix stock_info_sh_delist interface 1.3.74 fix: fix option_value_analysis_em interface 1.3.75 add: add option_risk_analysis_em interface 1.3.76 add: add option_premium_analysis_em interface 1.3.77 fix: fix sw_index_daily_indicator interface 1.3.78 fix: fix forbes_rank interface 1.3.79 add: add dockerfile for aktools interface 1.3.80 fix: fix dockerfile for aktools interface 1.3.81 fix: fix release_and_deploy interface 1.3.82 fix: fix dockerfile interface 1.3.83 fix: fix dockerfile-jupyter 1.3.84 fix: fix release_and_deploy 1.3.85 fix: fix release_and_deploy.yml 1.3.86 fix: fix master_dev_check.yml 1.3.87 fix: fix master_dev_check.yml 1.3.88 fix: fix master_dev_check.yml 1.3.89 fix: fix master_dev_check.yml 1.3.90 fix: fix master_dev_check.yml 1.3.91 fix: fix master_dev_check.yml 1.3.92 fix: fix docker image of akshare for jupyter and aktools 1.3.93 fix: fix docs 1.3.94 fix: fix akdocker.md 1.3.95 fix: fix covid_19_risk_area interface 1.3.96 fix: fix bond_china_close_return interface 1.3.97 fix: fix stock_us_hist interface 1.3.98 fix: fix stock_hk_hist interface 1.3.99 fix: fix index_yw interface 1.4.1 fix: fix index_yw interface 1.4.2 add: add index_dei_cx interface 1.4.3 add: add index_ii_cx interface 1.4.4 add: add index_si_cx interface 1.4.5 add: add index_pmi_com_cx interface 1.4.6 add: add index_pmi_man_cx interface 1.4.7 add: add index_pmi_ser_cx interface 1.4.8 add: add sport_olympic_winter_hist interface 1.4.9 fix: fix macro_cnbs interface 1.4.10 fix: fix get_futures_daily interface 1.4.11 fix: fix futures_spot_price_previous interface 1.4.12 add: add stock_hot_rank_em interface 1.4.13 add: add stock_hot_rank_detail_em interface 1.4.14 add: add index_bi_cx interface 1.4.15 add: add stock_hot_rank_detail_realtime_em interface 1.4.16 fix: fix stock_hot_rank_detail_em interface 1.4.17 fix: fix stock_hot_rank_wc interface 1.4.18 fix: fix stock_hot_rank_wc interface 1.4.19 fix: fix stock_price_js interface 1.4.20 add: add index_awpr_cx interface 1.4.21 fix: fix stock_zt_pool_em interface 1.4.22 fix: fix option_sse_greeks_sina interface 1.4.23 fix: rename all interface in option_finance_sina.py 1.4.24 fix: fix stock_em_jgdy_tj interface 1.4.25 add: add index_ci_cx interface 1.4.26 fix: fix fund_purchase_em interface 1.4.27 add: add index_cci_cx interface 1.4.28 fix: fix stock_info_sz_name_code interface 1.4.29 fix: fix stock_gdfx_free_holding_statistics_em interface 1.4.30 add: add index_li_cx interface 1.4.31 fix: fix docs interface 1.4.32 add: add index_neaw_cx interface 1.4.33 fix: fix docs interface 1.4.34 add: add index_neaw_cx interface 1.4.35 fix: fix stock_yysj_em interface 1.4.36 add: add index_nei_cx interface 1.4.37 add: add index_ti_cx interface 1.4.38 fix: fix stock_fund_flow_individual interface 1.4.39 add: add index_zh_a_hist_min_em interface 1.4.40 add: add index_code_id_map_em interface 1.4.41 fix: fix stock_hk_ggt_components_em interface 1.4.42 add: add stock_hot_keyword_em interface 1.4.43 fix: fix stock_fhps_em interface 1.4.44 fix: fix stock_dxsyl_em interface 1.4.45 fix: fix air_quality_rank interface 1.4.46 fix: fix energy_oil_detail interface 1.4.47 add: add interface change log 1.4.48 fix: fix stock_sse_deal_daily interface 1.4.49 fix: fix stock_sse_deal_daily interface 1.4.50 add: add stock_hot_rank_detail_realtime_em interface 1.4.51 add: add stock_hot_keyword_em interface 1.4.52 add: add stock_hot_rank_latest_em interface 1.4.53 add: add stock_hot_rank_relate_em interface 1.4.54 fix: fix stock_hot_rank_relate_em interface 1.4.55 fix: fix energy_carbon interface 1.4.56 fix: fix index_detail_hist_cni and index_detail_cni interface 1.4.57 fix: fix bond_spot_quote interface 1.4.58 fix: fix stock_zh_kcb_daily interface 1.4.59 add: add stock_zh_a_hist_163 interface 1.4.60 fix: fix stock_zh_a_hist_163 interface 1.4.61 fix: fix get_dce_daily interface 1.4.62 fix: fix option_finance_board interface 1.4.63 fix: fix macro_china_swap_rate interface 1.4.64 fix: fix bond_china_close_return interface 1.4.65 fix: fix spot_hist_sge interface 1.4.66 fix: fix stock_gpzy_profile_em interface 1.4.67 fix: fix crypto_name_url_table interface 1.4.68 fix: fix crypto_hist interface 1.4.69 fix: fix crypto_js_spot interface 1.4.70 add: add stock_lhb_detail_em interface 1.4.71 add: add stock_lhb_stock_detail_em interface 1.4.72 add: add stock_lhb_stock_statistic_em interface 1.4.73 add: add stock_lhb_jgmmtj_em interface 1.4.74 fix: fix stock_lhb_stock_detail_em interface 1.4.75 fix: fix stock_lhb_stock_detail_em interface 1.4.76 add: add stock_lhb_stock_statistic_em interface 1.4.77 fix: fix stock_hk_ggt_components_em interface 1.4.78 add: add remove matplotlib module and support cache 1.4.79 add: add stock_board_industry_hist_min_em interface 1.4.80 add: add stock_board_concept_hist_min_em interface 1.4.81 add: add fund_portfolio_change_em interface 1.4.82 fix: fix stock_a_code_to_symbol interface 1.4.83 add: add stock_us_code_table_fu interface 1.4.84 fix: fix fund_portfolio_change_em interface 1.4.85 add: add fund_portfolio_bond_hold_em interface 1.4.86 fix: fix rename all interface in fund_aum_em.py 1.4.87 add: add fund_portfolio_industry_allocation_em interface 1.4.88 fix: fix fund_new_found_em interface 1.4.89 fix: fix stock_us_hist interface 1.4.90 add: add macro_china_bank_financing interface 1.4.91 fix: fix macro_china_new_financial_credit interface 1.4.92 add: add stock_lhb_hyyyb_em interface 1.4.93 add: add macro_china_insurance_income interface 1.4.94 add: add macro_china_mobile_number interface 1.4.95 add: add bond_zh_cov_value_analysis interface 1.4.96 fix: fix stock_sse_deal_daily interface 1.4.97 fix: fix bond_spot_deal interface 1.4.98 fix: fix stock_board_industry_hist_em interface 1.4.99 add: add macro_china_vegetable_basket interface 1.5.1 add: add macro_china_agricultural_product interface 1.5.2 add: add macro_china_agricultural_index interface 1.5.3 add: add macro_china_energy_index interface 1.5.4 add: add macro_china_commodity_price_index interface 1.5.5 add: add macro_global_sox_index interface 1.5.6 add: add macro_china_yw_electronic_index interface 1.5.7 add: add macro_china_construction_index interface 1.5.8 add: add macro_china_construction_price_index interface 1.5.9 fix: fix air_quality_hist interface 1.5.10 fix: fix stock_gpzy_pledge_ratio_em and stock_gpzy_profile_em interface 1.5.11 add: add index_bloomberg_billionaires_hist interface 1.5.12 fix: fix stock_gpzy_pledge_ratio_detail_em interface 1.5.13 add: add macro_china_lpi_index interface 1.5.14 add: add macro_china_bdti_index interface 1.5.15 fix: fix bond_cb_jsl interface 1.5.16 fix: fix stock_info_sh_delist interface 1.5.17 add: add macro_china_bsi_index interface 1.5.18 fix: fix fund_open_fund_rank_em interface 1.5.19 add: add futures_correlation_nh interface 1.5.20 add: add futures_board_index_nh interface 1.5.21 add: add futures_variety_index_nh interface 1.5.22 fix: fix futures_correlation_nh interface 1.5.23 fix: fix stock_board_concept_name_em interface 1.5.24 fix: fix stock_profit_forecast interface 1.5.25 fix: fix stock_analyst_rank_em and stock_analyst_detail_em interface 1.5.26 fix: fix stock_comment_em interface 1.5.27 fix: fix stock_comment_em interface 1.5.28 fix: fix bond_zh_cov interface 1.5.29 fix: fix index_zh_a_hist_min_em interface 1.5.30 fix: fix hurun_rank interface 1.5.31 fix: fix stock_individual_info_em interface 1.5.32 add: add stock_comment_detail_zlkp_jgcyd_em interface 1.5.33 fix: fix fund_fh_em interface 1.5.34 fix: fix stock_gpzy_industry_data_em interface 1.5.35 add: add stock_comment_detail_zhpj_lspf_em interface 1.5.36 add: add stock_comment_detail_scrd_focus_em interface 1.5.37 add: add stock_comment_detail_scrd_desire_em interface 1.5.38 add: add stock_comment_detail_scrd_cost_em interface 1.5.39 add: add stock_comment_detail_scrd_desire_daily_em interface 1.5.40 fix: fix js_news interface 1.5.41 fix: fix stock_margin_underlying_info_szse interface 1.5.42 fix: fix stock_zt_pool_dtgc_em interface 1.5.43 fix: fix stock_zt_pool_em interface 1.5.44 fix: fix futures_to_spot_czce interface 1.5.45 add: add stock_hot_deal_xq interface 1.5.46 fix: fix stock_yzxdr_em interface 1.5.47 fix: fix macro_china_lpr interface 1.5.48 fix: fix futures_return_index_nh interface 1.5.49 add: add stock_inner_trade_xq interface 1.5.50 fix: fix covid_19_baidu interface 1.5.51 fix: fix stock_zh_a_tick_163 interface 1.5.52 fix: fix stock_ggcg_em interface 1.5.53 fix: fix stock_zcfz_em interface 1.5.54 fix: fix stock_lrb_em interface 1.5.55 add: add stock_balance_sheet_by_report_em interface 1.5.56 add: add stock_balance_sheet_by_yearly_em interface 1.5.57 add: add stock_profit_sheet_by_report_em interface 1.5.58 add: add stock_profit_sheet_by_quarterly_em interface 1.5.59 add: add stock_profit_sheet_by_yearly_em interface 1.5.60 fix: fix sw_index_second_spot interface 1.5.61 add: add stock_cash_flow_sheet_by_report_em interface 1.5.62 add: add stock_cash_flow_sheet_by_quarterly_em interface 1.5.63 fix: fix import path problem 1.5.64 fix: fix stock_cash_flow_sheet_by_yearly_em interface 1.5.65 fix: fix stock_repurchase_em interface 1.5.66 fix: fix crypto_hist interface 1.5.67 add: add test function 1.5.68 fix: fix test function 1.5.69 fix: fix setup.py 1.5.70 fix: fix stock_zh_a_spot interface 1.5.71 fix: fix import path problem 1.5.72 add: add news_economic_baidu interface 1.5.73 fix: fix stock_notice_report interface 1.5.74 add: add news_trade_notify_suspend_baidu interface 1.5.75 fix: fix stock_financial_analysis_indicator interface 1.5.76 add: add news_report_time_baidu interface 1.5.77 fix: fix remove numpy dependency 1.5.78 fix: fix stock_szse_summary interface 1.5.79 add: add stock_szse_area_summary interface 1.5.80 add: add stock_szse_sector_summary interface 1.5.81 fix: fix macro_china_gdp_yearly interface 1.5.82 add: add option_risk_indicator_sse interface 1.5.83 fix: fix energy_oil_hist, energy_oil_detail interface 1.5.84 fix: fix stock_three_report_em interface 1.5.85 fix: fix stock_zh_a_hist interface 1.5.86 fix: fix stock_us_fundamental interface 1.5.87 fix: fix stock_tfp_em interface 1.5.88 fix: fix stock_board_concept_name_ths interface 1.5.89 fix: fix stock_info_sh_name_code interface 1.5.90 fix: fix macro_china_bond_public interface 1.5.91 add: add bond_cb_index_jsl interface 1.5.92 fix: fix rate_interbank interface 1.5.93 fix: fix stock_zh_a_hist interface 1.5.94 add: add bond_cb_redeem_jsl interface 1.5.95 fix: fix stock_zh_a_hist_163 interface 1.5.96 fix: fix macro_bank_usa_interest_rate interface 1.5.97 fix: fix stock_zh_a_hist interface 1.5.98 fix: fix news_cctv interface 1.5.99 fix: fix stock_zh_a_hist_163 interface 1.6.1 fix: fix stock_info_sh_name_code interface 1.6.2 fix: fix macro_china_cpi interface 1.6.3 fix: fix stock_info_a_code_name and stock_info_sh_delist interface 1.6.4 fix: fix stock_info_a_code_name interface 1.6.5 fix: fix stock_board_cons_ths interface 1.6.6 fix: fix fund_etf_hist_sina interface 1.6.7 add: add futures_zh_realtime interface 1.6.8 fix: fix futures_zh_spot interface 1.6.9 fix: fix stock_zh_a_spot_em interface 1.6.10 add: add stock_sh_a_spot_em interface 1.6.11 add: add stock_sz_a_spot_em interface 1.6.12 add: add stock_bj_a_spot_em interface 1.6.13 add: add stock_new_a_spot_em interface 1.6.14 fix: fix stock_hsgt_board_rank_em interface 1.6.15 fix: fix bond_zh_cov_info interface 1.6.16 fix: fix baidu_search_index interface 1.6.17 fix: fix stock_new_a_spot_em interface 1.6.18 fix: fix stock_zh_a_spot_em interface 1.6.19 fix: fix stock_comment_detail_zlkp_jgcyd_em interface 1.6.20 fix: fix stock_board_industry_name_em and code_id_map_em interface 1.6.21 fix: fix baidu_search_index interface 1.6.22 add: add stock_kc_a_spot_em interface 1.6.23 fix: fix bond_cb_index_jsl interface 1.6.24 fix: fix bond_cb_index_jsl interface 1.6.25 fix: fix bond_cb_index_jsl interface 1.6.26 fix: fix bond_cb_index_jsl interface 1.6.27 fix: fix currency_boc_sina interface 1.6.28 add: add currency_boc_safe interface 1.6.29 fix: fix stock_board_industry_name_em interface 1.6.30 fix: fix stock_info_a_code_name interface 1.6.31 fix: fix stock_gdfx_free_holding_detail_em interface 1.6.32 fix: fix get_czce_daily interface 1.6.33 fix: fix stock_report_fund_hold_detail interface 1.6.34 fix: fix fx_spot_quote interface 1.6.35 fix: fix stock_zh_index_hist_csindex interface 1.6.36 fix: fix option_finance_board interface 1.6.37 fix: remove futures_inventory_99 interface 1.6.38 add: add stock_zygc_ym interface 1.6.39 fix: fix futures_symbol_mark interface 1.6.40 add: add stock_mda_ym interface 1.6.41 add: add futures_inventory_99 interface 1.6.42 fix: fix stock_balance_sheet_by_yearly_em interface 1.6.43 fix: fix futures_inventory_99 interface 1.6.44 fix: fix futures_inventory_em interface 1.6.45 fix: fix stock_zh_index_hist_csindex interface 1.6.46 fix: fix fund_open_fund_info_em interface 1.6.47 fix: fix stock_zh_a_minute interface 1.6.48 fix: fix stock_report_disclosure interface 1.6.49 fix: fix stock_zh_a_alerts_cls interface 1.6.50 add: add stock_industry_category_cninfo interface 1.6.51 fix: fix stock_analyst_detail_em interface 1.6.52 fix: fix index_zh_a_hist interface 1.6.53 fix: fix fx_spot_quote interface 1.6.54 fix: fix stock_hsgt_hold_stock_em interface 1.6.55 fix: fix stock_gdfx_free_holding_analyse_em interface 1.6.56 fix: fix index_zh_a_hist interface 1.6.57 fix: fix stock_info_sh_name_code interface 1.6.58 fix: fix stock_gdfx_holding_analyse_em interface 1.6.59 add: add stock_industry_change_cninfo interface 1.6.60 add: add stock_telegraph_cls interface 1.6.61 fix: fix futures_shfe_warehouse_receipt interface 1.6.62 fix: fix futures_zh_spot interface 1.6.63 fix: fix fund_portfolio_em and futures_roll_yield interface 1.6.64 fix: fix index_investing_global interface 1.6.65 fix: fix bond_cb_redeem_jsl interface 1.6.66 fix: fix stock_balance_sheet_by_report_em interface 1.6.67 fix: fix stock_zh_a_alerts_cls interface 1.6.68 fix: fix stock_zh_a_minute interface 1.6.69 add: add fund_info_index_em interface 1.6.70 add: add bond_zh_hs_cov_pre_min interface 1.6.71 fix: fix bond_zh_hs_cov_pre_min interface 1.6.72 add: add futures_news_shmet interface 1.6.73 fix: fix macro_china_rmb interface 1.6.74 add: add option_cffex_zz1000_list_sina interface 1.6.75 add: add option_cffex_zz1000_spot_sina interface 1.6.76 add: add pycryptodomex library 1.6.77 fix: fix stock_telegraph_cls interface 1.6.78 fix: fix stock_telegraph_cls interface 1.6.79 fix: fix fund_rating_all interface 1.6.80 fix: fix index_investing_global interface 1.6.81 fix: fix currency_hist interface 1.6.82 fix: fix option_cffex_hs300_spot_sina interface 1.6.83 fix: fix option_dce_daily interface 1.6.84 fix: fix stock_zt_pool_em interface 1.6.85 fix: fix option_finance_board interface 1.6.86 fix: fix stock_gpzy_distribute_statistics_bank_em interface 1.6.87 fix: fix stock_ggcg_em interface 1.6.88 fix: fix option_cffex_zz1000_spot_sina interface 1.6.89 fix: fix stock_board_concept_name_ths interface 1.6.90 fix: fix macro_china_cpi_yearly interface 1.6.91 fix: fix forbes_rank interface 1.6.92 fix: fix hurun_rank interface 1.6.93 fix: fix index_vix interface 1.6.94 fix: fix macro_china_hk_market_info interface 1.6.95 fix: fix energy_oil_detail interface 1.6.96 fix: fix macro_china_bond_public interface 1.6.97 fix: fix macro_china_real_estate interface 1.6.98 fix: fix macro_china_real_estate interface 1.6.99 fix: fix macro_china_fx_gold interface 1.7.1 fix: fix fund_etf_fund_info_em interface 1.7.2 fix: fix futures_egg_price_yearly interface 1.7.3 fix: fix stock_profit_sheet_by_report_em interface 1.7.4 fix: fix stock_analyst_rank_em interface 1.7.5 fix: fix fund_fh_em interface 1.7.6 fix: fix covid_19_risk_area interface 1.7.7 add: add index_level_one_hist_sw interface 1.7.8 add: add index_style_index_hist_sw interface 1.7.9 add: add index_market_representation_hist_sw interface 1.7.10 fix: fix option_czce_daily interface 1.7.11 fix: fix bond_cash_summary_sse interface 1.7.12 fix: fix stock_repurchase_em interface 1.7.13 fix: fix stock_balance_sheet_by_yearly_em interface 1.7.14 fix: fix covid_19_risk_area interface 1.7.15 fix: fix news_economic_baidu interface 1.7.16 fix: fix crypto_js_spot interface 1.7.17 fix: fix bond_cb_jsl interface 1.7.18 fix: fix stock_lhb_jgmmtj_em interface 1.7.19 fix: fix index_value_name_funddb interface 1.7.20 fix: fix crypto_js_spot interface 1.7.21 fix: fix futures_hog_info interface 1.7.22 add: add index_investing_global_area_index_name_url interface 1.7.23 fix: fix rename futures_pig_info and futures_pig_rank interface 1.7.24 fix: fix amac_manager_classify_info interface 1.7.25 add: add news_trade_notify_dividend_baidu interface 1.7.26 add: add bond_new_composite_index_cbond interface 1.7.27 fix: fix stock_qsjy_em interface 1.7.28 fix: fix stock_info_sh_name_code interface 1.7.29 fix: fix stock_us_daily interface 1.7.30 fix: fix bond_cb_index_jsl interface 1.7.31 fix: fix stock_a_lg_indicator interface 1.7.32 fix: fix stock_a_ttm_lyr interface 1.7.33 fix: fix stock_zh_ah_daily interface 1.7.34 fix: fix bond_cb_jsl interface 1.7.35 fix: fix stock_market_fund_flow interface 1.7.36 fix: fix rename branch master to main 1.7.37 add: add sw_index_first_info interface 1.7.38 add: add sw_index_second_info interface 1.7.39 add: add stock_sgt_settlement_exchange_rate_szse interface 1.7.40 add: add stock_sgt_settlement_exchange_rate_sse interface 1.7.41 add: add stock_sgt_reference_exchange_rate_sse interface 1.7.42 add: add stock_sgt_reference_exchange_rate_szse interface 1.7.43 fix: fix stock_a_all_pb interface 1.7.44 add: add stock_allotment_cninfo interface 1.7.45 add: add stock_hk_valuation_baidu interface 1.7.46 fix: fix stock_hk_valuation_baidu interface 1.7.47 add: add stock_zh_valuation_baidu interface 1.7.48 add: add stock_zh_vote_baidu interface 1.7.49 add: add futures_news_baidu interface 1.7.50 add: add stock_hot_search_baidu interface 1.7.51 fix: fix stock_a_lg_indicator interface 1.7.52 fix: fix stock_sse_summary interface 1.7.53 add: add stock_buffett_index_lg interface 1.7.54 fix: fix stock_a_lg_indicator interface 1.7.55 add: add fx_quote_baidu interface 1.7.56 fix: fix stock_buffett_index_lg interface 1.7.57 fix: fix stock_a_high_low_statistics interface 1.7.58 fix: fix bond_cb_redeem_jsl interface 1.7.59 fix: fix stock_a_high_low_statistics interface 1.7.60 fix: fix stock_zh_a_spot_em interface 1.7.61 add: add option_50etf_qvix interface 1.7.62 add: add option_300etf_qvix interface 1.7.63 add: add option_300etf_min_qvix interface 1.7.64 add: add option_50etf_min_qvix interface 1.7.65 fix: fix futures_rule interface 1.7.66 add: add index_realtime_sw interface 1.7.67 fix: fix xincaifu_rank interface 1.7.68 fix: fix hurun_rank interface 1.7.69 add: add index_hist_sw interface 1.7.70 fix: fix index_hist_sw interface 1.7.71 add: add support for Python 3.11 1.7.72 add: add index_min_sw interface 1.7.73 fix: fix stock_zh_index_daily_tx interface 1.7.74 fix: fix futures_news_baidu interface 1.7.75 add: add index_component_sw interface 1.7.76 fix: fix macro_euro_gdp_yoy interface 1.7.77 fix: fix index_value_hist_funddb interface 1.7.78 add: add index_analysis_sw interface 1.7.79 fix: fix macro_germany interface 1.7.80 fix: fix stock_a_below_net_asset_statistics interface 1.7.81 fix: fix macro_swiss_svme interface 1.7.82 fix: fix index_analysis_daily_sw interface 1.7.83 fix: fix macro_japan interface 1.7.84 add: add bond_info_cm interface 1.7.85 fix: fix stock_board_industry_hist_em interface 1.7.86 fix: fix bond_info_cm interface 1.7.87 fix: fix macro_uk interface 1.7.88 fix: fix stock_news_em interface 1.7.89 fix: fix stock_zh_index_daily_tx interface 1.7.90 fix: fix stock_yjbb_em interface 1.7.91 fix: fix futures_price_index_nh interface 1.7.92 fix: fix fund_portfolio_hold_em interface 1.7.93 fix: fix sw_index_third_cons interface 1.7.94 fix: fix fund_portfolio_hold_em interface 1.7.95 fix: fix spot_golden_benchmark_sge interface 1.7.96 fix: fix futures_hog_info interface 1.7.97 add: add index_hog_spot_price interface 1.7.98 fix: fix stock_zh_a_gdhs interface 1.7.99 fix: fix stock_lhb_detail_daily_sina interface 1.8.1 fix: fix stock_dxsyl_em interface 1.8.2 fix: fix fund_portfolio_hold_em interface 1.8.3 fix: fix stock_pg_em interface 1.8.4 fix: fix macro_china_hgjck interface 1.8.5 fix: fix stock_a_lg_indicator interface 1.8.6 fix: fix stock_market_activity_legu interface 1.8.7 fix: fix stock_a_below_net_asset_statistics interface 1.8.8 fix: fix macro_china_gdp interface 1.8.9 fix: fix stock_a_ttm_lyr interface 1.8.10 fix: fix stock_a_all_pb interface 1.8.11 fix: fix macro_china_ppi interface 1.8.12 fix: fix stock_yjyg_em interface 1.8.13 fix: fix macro_china_new_house_price interface 1.8.14 add: add stock_board_industry_summary_ths interface 1.8.15 fix: fix stock_price_js interface 1.8.16 fix: fix macro_china_swap_rate interface 1.8.17 fix: fix macro_china_fdi interface 1.8.18 add: add stock_hsgt_fund_flow_summary_em interface 1.8.19 fix: fix stock_balance_sheet_by_yearly_em interface 1.8.20 fix: fix stock_board_concept_hist_em interface 1.8.21 fix: fix stock_board_concept_hist_em interface 1.8.22 fix: fix stock_margin_detail_szse interface 1.8.23 add: add stock_restricted_release_summary_em interface 1.8.24 fix: fix stock_ipo_benefit_ths interface 1.8.25 fix: fix stock_circulate_stock_holder interface 1.8.26 fix: fix bond_china_close_return_map interface 1.8.27 fix: fix fund_cf_em interface 1.8.28 fix: fix fund_fh_rank_em interface 1.8.29 fix: fix baidu_search_index interface 1.8.30 fix: fix index_value_name_funddb interface 1.8.31 fix: fix get_dce_daily interface 1.8.32 fix: fix js_news interface 1.8.33 fix: fix stock_hot_rank_em interface 1.8.34 add: add stock_a_gxl_lg interface 1.8.35 add: add stock_hk_gxl_lg interface 1.8.36 add: add stock_a_congestion_lg interface 1.8.37 add: add fund_stock_position_lg interface 1.8.38 fix: fix macro_cons_gold interface 1.8.39 add: add stock_board_change_em interface 1.8.40 add: add fund_balance_position_lg interface 1.8.41 add: add futures_index_ccidx interface 1.8.42 add: add get_gfex_daily interface 1.8.43 add: add stock_ebs_lg interface 1.8.44 fix: fix stock_info_bj_name_code interface 1.8.45 fix: fix calendar.json 1.8.46 fix: fix get_roll_yield_bar interface 1.8.47 add: add option_cffex_sz50_list_sina interface 1.8.48 add: add fund_etf_hist_em interface 1.8.49 fix: fix futures_comm_info interface 1.8.50 fix: fix stock_us_daily interface 1.8.51 fix: fix fortune_rank interface 1.8.52 fix: fix index_value_hist_funddb interface 1.8.53 fix: fix stock_hot_rank_wc interface 1.8.54 fix: fix get_roll_yield_bar interface 1.8.55 fix: fix macro_usa_pmi interface 1.8.56 fix: fix stock_hk_valuation_baidu interface 1.8.57 fix: fix stock_szse_summary interface 1.8.58 fix: fix get_calendar interface 1.8.59 fix: fix stock_zh_valuation_baidu interface 1.8.60 fix: fix hurun_rank interface 1.8.61 fix: fix futures_comm_info interface 1.8.62 fix: fix stock_board_industry_index_ths interface 1.8.63 fix: fix stock_cash_flow_sheet_by_report_em interface 1.8.64 fix: fix stock_ggcg_em interface 1.8.65 fix: fix get_roll_yield_bar interface 1.8.66 fix: fix python 3.7.x support 1.8.67 fix: fix python warning 3.7.x support 1.8.68 fix: fix stock_individual_fund_flow interface 1.8.69 fix: fix stock_individual_fund_flow_rank interface 1.8.70 add: add stock_market_pe_lg interface 1.8.71 add: add stock_zygc_em interface 1.8.72 fix: fix drewry_wci_index interface 1.8.73 add: add stock_zyjs_ths interface 1.8.74 fix: fix drewry_wci_index interface 1.8.75 add: add stock_cy_a_spot_em interface 1.8.76 remove: remove js_news and ws interface 1.8.77 fix: fix stock_analyst_rank_em interface 1.8.78 fix: fix stock_profit_forecast interface 1.8.79 fix: fix stock_hk_valuation_baidu interface 1.8.80 fix: fix stock_profit_forecast interface 1.8.81 fix: fix futures_hog_info interface 1.8.82 fix: fix stock_fund_stock_holder interface 1.8.83 fix: fix stock_info_sh_name_code interface 1.8.84 remove: remove stock_zh_a_scr_report interface 1.8.85 fix: fix stock_info_sh_name_code interface 1.8.86 fix: fix stock_info_sh_delist interface 1.8.87 fix: fix stock_info_sz_change_name interface 1.8.88 fix: fix stock_info_sz_delist interface 1.8.89 fix: fix sunrise_city_list interface 1.8.90 fix: fix bond_info_detail_cm interface 1.8.91 fix: fix sunrise_monthly interface 1.8.92 fix: fix stock_institute_hold interface 1.8.93 fix: fix stock_gdfx_holding_detail_em interface 1.8.94 fix: fix Dockerfile 1.8.95 fix: fix index_zh_a_hist interface 1.8.96 fix: fix option_finance_board interface 1.8.97 fix: fix futures_egg_price_yearly interface 1.8.98 fix: fix stock_info_sz_delist interface 1.8.99 add: add futures_news_shmet interface 1.9.1 fix: fix index_value_name_funddb interface 1.9.2 fix: fix stock_xgsglb_em interface 1.9.3 fix: fix fx_quote_baidu interface 1.9.4 fix: fix drewry_wci_index interface 1.9.5 fix: fix stock_info_a_code_name interface 1.9.6 fix: fix futures_hog_info interface 1.9.7 add: add stock_profit_forecast_ths interface 1.9.8 fix: fix stock_hk_valuation_baidu interface 1.9.9 add: add macro_shipping_bci interface 1.9.10 add: add macro_shipping_bcti interface 1.9.11 add: add stock_sector_fund_flow_hist interface 1.9.12 fix: fix stock_hot_rank_wc interface 1.9.13 fix: fix stock_zh_valuation_baidu interface 1.9.14 fix: fix option_risk_analysis_em interface 1.9.15 fix: fix stock_hk_daily interface 1.9.16 fix: fix stock_financial_abstract interface 1.9.17 add: add stock_board_industry_spot_em interface 1.9.18 fix: fix macro_china_market_margin_sh interface 1.9.19 fix: fix macro_cnbs interface 1.9.20 fix: fix fund_financial_fund_info_em interface 1.9.21 fix: fix fund_financial_fund_info_em interface 1.9.22 fix: fix fund_hk_fund_hist_em interface 1.9.23 fix: fix bond_cb_redeem_jsl interface 1.9.24 fix: fix bond_cb_adj_logs_jsl interface 1.9.25 add: add stock_hk_hot_rank_em interface 1.9.26 fix: fix bond_cb_jsl interface 1.9.27 fix: fix fund_exchange_rank_em interface 1.9.28 fix: fix stock_financial_report_sina interface 1.9.29 fix: fix stock_a_lg_indicator interface 1.9.30 fix: fix stock_a_lg_indicator interface 1.9.31 fix: fix amac_fund_info interface 1.9.32 fix: fix bank_fjcf_table_detail interface 1.9.33 add: add stock_hk_main_board_spot_em interface 1.9.34 fix: fix stock_zh_a_tick_tx_js interface 1.9.35 fix: fix stock_a_lg_indicator interface 1.9.36 fix: fix stock_market_pe_lg interface 1.9.37 fix: fix stock_hk_indicator_eniu interface 1.9.38 fix: fix stock_a_lg_indicator interface 1.9.39 fix: fix fund_stock_position_lg interface 1.9.40 fix: fix stock_profit_forecast_em interface 1.9.41 fix: fix stock_a_indicator_lg interface 1.9.42 add: add stock_bid_ask_em interface 1.9.43 fix: fix stock_a_congestion_lg interface 1.9.44 fix: fix stock_a_high_low_statistics interface 1.9.45 add: add stock_fhps_detail_ths interface 1.9.46 fix: fix stock_a_gxl_lg interface 1.9.47 fix: fix option_dce_daily interface 1.9.48 fix: fix index_stock_cons interface 1.9.49 add: add stock_lhb_yybph_em interface 1.9.50 fix: fix stock_a_all_pb interface 1.9.51 fix: fix get_shfe_daily interface 1.9.52 fix: fix get_shfe_rank_table interface 1.9.53 fix: fix get_ine_daily interface 1.9.54 fix: fix stock_board_concept_cons_ths interface 1.9.55 fix: fix stock_zh_valuation_baidu interface 1.9.56 fix: fix get_receipt interface 1.9.57 fix: fix stock_lhb_detail_em interface 1.9.58 add: add option_gfex_daily interface 1.9.59 fix: fix stock_hot_search_baidu interface 1.9.60 add: add stock_hk_fhpx_detail_ths interface 1.9.61 fix: fix stock_lhb_detail_daily_sina interface 1.9.62 fix: fix bond_zh_us_rate interface 1.9.63 fix: fix get_czce_rank_table interface 1.9.64 fix: fix stock_a_indicator_lg interface 1.9.65 fix: fix stock_hot_search_baidu interface 1.9.66 fix: fix match_main_contract interface 1.9.67 fix: fix futures_zh_daily_sina interface 1.9.68 fix: fix stock_lh_yyb_capital interface 1.9.69 fix: fix stock_lh_yyb_capital interface 1.9.70 fix: fix stock_szse_sector_summary interface 1.9.71 fix: fix stock_lh_yyb_most interface 1.9.72 fix: fix fund_manager interface 1.9.73 add: add bond_zh_cov_info_ths interface 1.9.74 fix: fix get_shfe_rank_table interface 1.9.75 fix: fix stock_board_industry_index_ths interface 1.9.76 fix: fix stock_sector_detail interface 1.9.77 fix: fix stock_hot_rank_wc interface 1.9.78 fix: fix macro_usa_gdp_monthly interface 1.9.79 fix: fix stock_sse_deal_daily interface 1.9.80 fix: fix futures_spot_price interface 1.9.81 add: add stock_hk_index_spot_sina interface 1.9.82 fix: fix currency_boc_safe interface 1.9.83 add: add stock_concept_fund_flow_hist interface 1.9.84 fix: fix stock_hk_fhpx_detail_ths interface 1.9.85 fix: fix option_dce_daily interface 1.9.86 fix: fix index_kq_fz interface 1.9.87 add: add option_minute_em interface 1.9.88 fix: fix setup.py 1.9.89 fix: fix index_kq_fz interface 1.9.90 fix: fix stock_sse_deal_daily interface 1.9.91 add: add stock_financial_abstract_ths interface 1.9.92 fix: fix article_ff_crr interface 1.9.93 fix: fix index_level_one_hist_sw interface 1.9.94 fix: fix stock_a_indicator_lg interface 1.9.95 fix: fix stock_zh_index_hist_csindex interface 1.9.96 fix: fix stock_hold_control_cninfo interface 1.9.97 fix: fix stock_industry_category_cninfo interface 1.9.98 fix: fix stock_hold_control_cninfo interface 1.9.99 fix: fix stock_hold_num_cninfo interface 1.10.1 fix: fix stock_hold_control_cninfo interface 1.10.2 fix: fix stock_gdfx_holding_detail_em interface 1.10.3 fix: fix stock_gdfx_holding_analyse_em interface 1.10.4 fix: fix futures_return_index_nh interface 1.10.5 fix: fix index_level_one_hist_sw interface 1.10.6 fix: fix futures_nh_volatility_index interface 1.10.7 fix: fix option_finance_board interface 1.10.8 fix: fix futures_volatility_index_nh interface 1.10.9 fix: fix bond_zh_hs_cov_min interface 1.10.10 fix: fix stock_zh_a_hist interface 1.10.11 fix: fix stock_zh_a_hist_pre_min_em interface 1.10.12 fix: fix bond_cb_adj_logs_jsl interface 1.10.13 fix: fix stock_share_change_cninfo interface 1.10.14 fix: fix bond_zh_hs_cov_min interface 1.10.15 fix: fix bond_zh_hs_cov_pre_min interface 1.10.16 fix: fix bond_zh_hs_cov_min interface 1.10.17 fix: fix stock_allotment_cninfo interface 1.10.18 fix: fix index_yw interface 1.10.19 fix: fix bond_treasure_issue_cninfo interface 1.10.20 fix: fix stock_new_gh_cninfo interface 1.10.21 fix: fix fund_report_stock_cninfo interface 1.10.22 fix: fix macro_china_cpi_monthly interface 1.10.23 fix: fix index_kq_fz interface 1.10.24 fix: fix stock_zh_a_daily interface 1.10.25 fix: fix index_sugar_msweet interface 1.10.26 add: add stock_hot_up_em interface 1.10.27 fix: fix stock_hot_up_em interface 1.10.28 fix: fix stock_hot_up_em interface 1.10.29 fix: fix stock_zh_index_daily_em interface 1.10.30 fix: fix stock_info_sz_name_code interface 1.10.31 fix: fix zh_subscribe_exchange_symbol interface 1.10.32 fix: fix get_cffex_daily interface 1.10.33 fix: fix index_sugar_msweet interface 1.10.34 fix: fix futures_display_main_sina interface 1.10.35 add: add get_gfex_receipt interface 1.10.36 fix: fix stock_sy_profile_em interface 1.10.37 rem: rem index_stock_hist interface 1.10.38 fix: fix stock_board_industry_hist_min_em interface 1.10.39 fix: fix stock_board_concept_hist_min_em interface 1.10.40 fix: fix futures_news_baidu interface 1.10.41 add: add fund_lof_hist_em interface 1.10.42 fix: fix fund_rating_all interface 1.10.43 rem: rem index_vix interface 1.10.44 fix: fix get_shfe_rank_table interface 1.10.45 fix: fix stock_zh_a_minute interface 1.10.46 fix: fix index_value_hist_funddb interface 1.10.47 add: add stock_esg_rate_sina interface 1.10.48 add: add stock_esg_hz_sina interface 1.10.49 fix: fix stock_hot_rank_em interface 1.10.50 fix: fix car_energy_sale_cpca interface 1.10.51 fix: fix fund_money_rank_em interface 1.10.52 fix: fix stock_financial_hk_report_em interface 1.10.53 fix: fix index_stock_cons_csindex interface 1.10.54 fix: fix macro_usa_core_cpi_monthly interface 1.10.55 fix: fix macro_usa_personal_spending interface 1.10.56 fix: fix stock_zh_b_daily interface 1.10.57 fix: fix stock_zh_valuation_baidu interface 1.10.58 fix: fix fund_etf_hist_em interface 1.10.59 add: add fund_announcement_personnel_em interface 1.10.60 add: add macro_usa_cpi_yoy interface 1.10.61 fix: fix macro_cnbs interface 1.10.62 fix: fix index_hist_sw interface 1.10.63 fix: fix stock_esg_hz_sina interface 1.10.64 fix: fix stock_zh_b_spot interface 1.10.65 fix: fix macro_china_lpr interface 1.10.66 fix: fix stock_financial_report_sina interface 1.10.67 rem: rem futures_egg_price_yearly interface 1.10.68 fix: fix option_gfex_daily interface 1.10.69 fix: fix currency_latest interface 1.10.70 fix: fix stock_zh_a_hist interface 1.10.71 fix: fix stock_us_hist interface 1.10.72 fix: fix stock_financial_hk_report_em interface 1.10.73 add: add stock_irm_cninfo interface 1.10.74 add: add stock_sns_sseinfo interface 1.10.75 add: add macro_china_urban_unemployment interface 1.10.76 fix: fix stock_notice_report interface 1.10.77 add: add bond_cb_profile_sina interface 1.10.78 fix: fix get_cffex_rank_table interface 1.10.79 add: add stock_hold_management_detail_em interface 1.10.80 fix: fix macro_china_gyzjz interface 1.10.81 fix: fix stock_bid_ask_em interface 1.10.82 fix: fix currency_boc_sina interface 1.10.83 add: add stock_industry_clf_hist_sw interface 1.10.84 fix: fix stock_us_fundamental interface 1.10.85 fix: fix stock_hot_rank_wc interface 1.10.86 add: add stock_gddh_em interface 1.10.87 add: add stock_zdhtmx_em interface 1.10.88 add: add stock_research_report_em interface 1.10.89 add: add stock_share_hold_change_bse interface 1.10.90 fix: fix futures_comex_inventory interface 1.10.91 fix: fix stock_share_hold_change_szse interface 1.10.92 fix: fix stock_individual_fund_flow interface 1.10.93 add: add stock_ipo_summary_cninfo interface 1.10.94 add: add macro_china_nbs_nation interface 1.10.95 fix: fix crypto_bitcoin_cme interface 1.10.96 fix: fix stock_hk_daily interface 1.10.97 fix: fix stock_financial_analysis_indicator interface 1.10.98 fix: fix get_cffex_rank_table interface 1.10.99 fix: fix crypto_bitcoin_cme interface 1.11.1 add: add index_us_stock_sina interface 1.11.2 fix: fix stock_a_below_net_asset_statistics interface 1.11.3 fix: fix stock_a_high_low_statistics interface 1.11.4 fix: fix bond_cb_profile_sina interface 1.11.5 fix: fix macro_china_hk_cpi interface 1.11.6 fix: fix futures_main_sina interface 1.11.7 fix: fix get_futures_daily interface 1.11.8 fix: fix news_economic_baidu interface 1.11.9 fix: fix currency_boc_safe interface 1.11.10 fix: fix bond_new_composite_index_cbond interface 1.11.11 fix: fix spot_hist_sge interface 1.11.12 fix: fix stock_board_concept_hist_ths interface 1.11.13 fix: fix futures_comm_info interface 1.11.14 fix: fix migration_area_baidu interface 1.11.15 fix: fix stock_dividend_cninfo interface 1.11.16 fix: fix stock_dividend_cninfo interface 1.11.17 fix: fix futures_spot_price_daily interface 1.11.18 fix: fix get_rank_sum_daily interface 1.11.19 fix: fix drewry_wci_index interface 1.11.20 fix: fix option_dce_daily interface 1.11.21 fix: fix get_dce_daily interface 1.11.22 fix: fix option_dce_daily interface 1.11.23 fix: fix macro_china_society_traffic_volume interface 1.11.24 fix: fix macro_china_postal_telecommunicational interface 1.11.25 fix: fix macro_china_central_bank_balance interface 1.11.26 fix: fix macro_china_supply_of_money interface 1.11.27 fix: fix stock_margin_detail_szse interface 1.11.28 fix: fix stock_margin_detail_szse interface 1.11.29 fix: fix bond_new_composite_index_cbond interface 1.11.30 fix: fix stock_zh_a_st_em interface 1.11.31 fix: fix futures_dce_warehouse_receipt interface 1.11.32 add: add stock_margin_ratio_pa interface 1.11.33 add: add stock_intraday_em interface 1.11.34 add: add stock_board_concept_graph_ths interface 1.11.35 fix: fix stock_board_concept_hist_ths interface 1.11.36 add: add stock_fear_greed_funddb interface 1.11.37 fix: fix index_fear_greed_funddb interface 1.11.38 fix: fix setup.py interface 1.11.39 fix: fix index_option_50etf_qvix interface 1.11.40 fix: fix index_option_300etf_qvix interface 1.11.41 fix: fix index_weibo_sina interface 1.11.42 fix: fix stock_gpzy_pledge_ratio_em interface 1.11.43 fix: fix get_futures_daily interface 1.11.44 add: add stock_cyq_em interface 1.11.45 add: add stock_balance_sheet_by_report_delisted_em interface 1.11.46 add: add akracer support 1.11.47 add: add akracer 0.0.8 support 1.11.48 fix: fix installation.md 1.11.49 add: add aarch64 support 1.11.50 fix: fix amac_fund_abs support 1.11.51 fix: fix stock_zh_a_daily interface 1.11.52 fix: fix fund_scale_change_em interface 1.11.53 add: add stock_zh_a_hist_tx interface 1.11.54 fix: fix fund_portfolio_hold_em interface 1.11.55 fix: fix fund_portfolio_bond_hold_em interface 1.11.56 fix: fix stock_balance_sheet_by_report_delisted_em interface 1.11.57 fix: fix stock_zt_pool_em interface 1.11.58 fix: fix bond_china_close_return interface 1.11.59 fix: fix fund_portfolio_change_em interface 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 1.11.64 fix: fix futures_settlement_price_sgx interface 1.11.65 fix: fix futures_index_ccidx interface 1.11.66 fix: fix fund_scale_structured_sina interface 1.11.67 fix: fix currency_boc_sina interface 1.11.68 fix: fix fund_aum_em interface 1.11.69 add: add futures_gfex_position_rank interface 1.11.70 fix: fix futures_gfex_position_rank interface 1.11.71 fix: fix stock_balance_sheet_by_report_em interface 1.11.72 fix: fix get_rank_sum_daily interface 1.11.73 fix: fix futures_comex_inventory interface 1.11.74 fix: fix stock_comment_em interface 1.11.75 fix: fix futures_comex_inventory interface 1.11.76 fix: fix option_czce_daily interface 1.11.77 fix: fix futures_zh_spot interface 1.11.78 add: add stock_financial_benefit_ths interface 1.11.79 fix: fix get_receipt interface 1.11.80 fix: fix stock_cash_flow_sheet_by_report_em interface 1.11.81 fix: fix stock_gdfx_free_holding_detail_em interface 1.11.82 fix: fix bond_zh_us_rate interface 1.11.83 fix: fix stock_zt_pool_strong_em interface 1.11.84 fix: fix fund_name_em interface 1.11.85 fix: fix stock_market_activity_legu interface 1.11.86 fix: fix stock_telegraph_cls interface 1.11.87 fix: fix futures_board_index_nh interface 1.11.88 fix: fix macro_china_swap_rate interface 1.11.89 fix: fix bond_zh_us_rate interface 1.11.90 fix: fix futures_rule interface 1.11.91 fix: remove stock_us_fundamental interface 1.11.92 fix: fix get_gfex_receipt interface 1.11.93 fix: fix stock_zh_a_hist_pre_min_em interface 1.11.94 fix: fix index_zh_a_hist_min_em interface 1.11.95 fix: fix fund_etf_hist_min_em interface 1.11.96 fix: fix fund_rating_all interface 1.11.97 add: add stock_zh_a_disclosure_report_cninfo interface 1.11.98 fix: fix stock_zh_a_disclosure_report_cninfo interface 1.11.99 fix: fix stock_zh_index_spot interface 1.12.1 fix: fix futures_comm_info interface 1.12.2 fix: fix hurun_rank interface 1.12.3 fix: fix stock_gdfx_free_holding_teamwork_em interface 1.12.4 fix: fix tool_trade_date_hist_sina interface 1.12.5 fix: fix stock_zh_a_gdhs interface 1.12.6 fix: fix fund_open_fund_info_em interface 1.12.7 fix: fix option_gfex_daily interface 1.12.8 fix: fix fund_open_fund_info_em interface 1.12.9 add: add fund_individual_basic_info_xq interface 1.12.10 fix: fix stock_add_stock interface 1.12.11 add: add stock_zh_index_spot_em interface 1.12.12 fix: fix stock_zh_index_daily interface 1.12.13 fix: fix index_stock_cons_csindex interface 1.12.14 add: add stock_hk_profit_forecast_et interface 1.12.15 fix: fix stock_hk_profit_forecast_et interface 1.12.16 fix: fix stock_hot_follow_xq interface 1.12.17 fix: fix option_current_em interface 1.12.18 fix: fix stock_board_industry_index_ths interface 1.12.19 fix: fix stock_hk_profit_forecast_et interface 1.12.20 fix: fix futures_inventory_99 interface 1.12.21 fix: fix stock_hsgt_hold_stock_em interface 1.12.22 fix: fix stock_hsgt_board_rank_em interface 1.12.23 fix: fix fund_etf_hist_min_em interface 1.12.24 fix: fix stock_hk_index_spot_em interface 1.12.25 fix: fix fund_individual_basic_info_xq interface 1.12.26 fix: fix index_stock_info interface 1.12.27 fix: fix stock_hk_fhpx_detail_ths interface 1.12.28 fix: fix futures_foreign_commodity_realtime interface 1.12.29 add: add stock_individual_spot_xq interface 1.12.30 fix: fix futures_settlement_price_sgx interface 1.12.31 add: add futures_global_em interface 1.12.32 fix: fix energy_oil_hist interface 1.12.33 fix: fix futures_global_em interface 1.12.34 fix: fix repo_rate_hist interface 1.12.35 fix: fix article_epu_index interface 1.12.36 fix: fix bond_china_close_return interface 1.12.37 fix: fix futures_delivery_shfe interface 1.12.38 fix: fix futures_to_spot_dce interface 1.12.39 fix: fix futures_gfex_warehouse_receipt interface 1.12.40 fix: fix futures_to_spot_dce interface 1.12.41 fix: fix sw_index_third_cons interface 1.12.42 fix: fix stock_news_em interface 1.12.43 fix: fix macro_china_market_margin_sh interface 1.12.44 fix: fix stock_zh_ah_daily interface 1.12.45 fix: fix stock_individual_spot_xq interface 1.12.46 fix: fix futures_contract_detail interface 1.12.47 fix: fix stock_zh_ah_daily interface 1.12.48 fix: fix option_minute_em interface 1.12.49 fix: fix stock_dxsyl_em interface 1.12.50 fix: fix bond_china_close_return interface 1.12.51 add: add stock_hsgt_fund_min_em interface 1.12.52 fix: fix stock_rank_cxg_ths interface 1.12.53 fix: fix stock_rank_xzjp_ths interface 1.12.54 fix: fix stock_gpzy_pledge_ratio_detail_em interface 1.12.55 fix: fix stock_us_hist interface 1.12.56 fix: fix stock_a_indicator_lg interface 1.12.57 fix: fix bank_fjcf_table_detail interface 1.12.58 fix: fix stock_ipo_summary_cninfo interface 1.12.59 fix: fix movie_boxoffice_realtime interface 1.12.60 fix: fix movie_boxoffice_daily interface 1.12.61 fix: fix stock_bid_ask_em interface 1.12.62 fix: fix stock_fund_flow_individual interface 1.12.63 add: add akqmt interface 1.12.64 fix: fix stock_board_industry_index_ths interface 1.12.65 fix: fix futures_foreign_commodity_realtime interface 1.12.66 fix: fix stock_board_industry_hist_em interface 1.12.67 fix: fix index_hist_sw interface 1.12.68 fix: fix option_finance_board interface 1.12.69 fix: fix futures_hold_pos_sina interface 1.12.70 fix: fix stock_lhb_detail_daily_sina interface 1.12.71 fix: fix stock_zh_ah_spot interface 1.12.72 fix: fix stock_hot_rank_wc interface 1.12.73 fix: fix stock_individual_spot_xq interface 1.12.74 add: add futures_contract_info_czce interface 1.12.75 add: add futures_contract_info_ine interface 1.12.76 fix: fix bond_zh_hs_spot interface 1.12.77 fix: fix futures_contract_info_shfe interface 1.12.78 fix: fix stock_info_sh_delist interface 1.12.79 fix: fix futures_main_sina interface 1.12.80 fix: fix get_czce_daily interface 1.12.81 fix: fix macro_china_bond_public interface 1.12.82 fix: fix stock_tfp_em interface 1.12.83 fix: fix stock_sector_fund_flow_rank interface 1.12.84 fix: fix stock_market_fund_flow interface 1.12.85 fix: fix stock_sector_fund_flow_summary interface 1.12.86 fix: fix fund_etf_spot_em interface 1.12.87 fix: fix fortune_rank interface 1.12.88 fix: fix fund_etf_spot_em interface 1.12.89 fix: fix bond_china_yield interface 1.12.90 fix: fix fund_etf_spot_em interface 1.12.91 add: add stock_info_global_em interface 1.12.92 fix: fix fund_etf_hist_min_em interface 1.12.93 fix: fix bond_debt_nafmii interface 1.12.94 fix: fix stock_hk_index_daily_em interface 1.12.95 add: add futures_hog_core interface 1.12.96 fix: fix stock_bid_ask_em interface 1.12.97 fix: fix stock_zh_a_hist_min_em interface 1.12.98 fix: fix bond_zh_cov interface 1.12.99 fix: fix index_hog_spot_price interface 1.13.1 fix: fix futures_spot_stock interface 1.13.2 add: add stock_main_fund_flow interface 1.13.3 fix: fix stock_main_fund_flow interface 1.13.4 fix: fix stock_individual_spot_xq interface 1.13.5 fix: fix stock_main_fund_flow interface 1.13.6 fix: fix stock_board_concept_name_ths interface 1.13.7 add: add futures_fees_info interface 1.13.8 fix: fix fund_etf_hist_em interface 1.13.9 chore: remove pyarrow deps 1.13.10 fix: fix news_trade_notify_dividend_baidu interface 1.13.11 fix: fix option_minute_em interface 1.13.12 fix: fix stock_zyjs_ths interface 1.13.13 fix: fix car_market_cpca interface 1.13.14 fix: fix futures_fees_info interface 1.13.15 add: add car_market_man_rank_cpca interface 1.13.16 add: add car_market_cate_cpca interface 1.13.17 fix: fix stock_zcfz_em interface 1.13.18 fix: fix macro_china_pmi_yearly interface 1.13.19 add: add car_market_country_cpca interface 1.13.20 fix: fix stock_zh_a_disclosure_report_cninfo interface 1.13.21 fix: fix stock_yjkb_em interface 1.13.22 fix: fix amac_manager_cancelled_info interface 1.13.23 add: add macro_usa_cme_merchant_goods_holding interface 1.13.24 fix: fix futures_spot_sys interface 1.13.25 fix: fix futures_zh_daily_sina interface 1.13.26 fix: fix option_sse_minute_sina interface 1.13.27 add: add stock_esg_msci_sina interface 1.13.28 fix: fix stock_restricted_release_queue_em interface 1.13.29 fix: fix stock_esg_msci_sina interface 1.13.30 fix: fix futures_contract_info_shfe interface 1.13.31 fix: fix stock_individual_spot_xq interface 1.13.32 fix: fix futures_contract_info_czce interface 1.13.33 fix: fix index_realtime_fund_sw interface 1.13.34 fix: fix bank_fjcf_table_detail interface 1.13.35 fix: fix stock_margin_szse interface 1.13.36 fix: fix stock_hsgt_hist_em interface 1.13.37 fix: fix stock_hk_index_daily_sina interface 1.13.38 fix: fix stock_market_activity_legu interface 1.13.39 add: add index_news_sentiment_scope interface 1.13.40 fix: fix index_fear_greed_funddb interface 1.13.41 fix: fix stock_sy_hy_em interface 1.13.42 fix: fix index_fear_greed_funddb interface 1.13.43 fix: fix stock_account_statistics_em interface 1.13.44 fix: fix stock_lhb_stock_statistic_em interface 1.13.45 fix: fix futures_stock_shfe_js interface 1.13.46 fix: fix futures_stock_shfe_js interface 1.13.47 fix: fix stock_a_indicator_lg interface 1.13.48 fix: fix stock_hk_indicator_eniu interface 1.13.49 fix: fix stock_ipo_summary_cninfo interface 1.13.50 fix: fix news_cctv interface 1.13.51 fix: fix stock_market_activity_legu interface 1.13.52 fix: fix stock_market_pb_lg interface 1.13.53 fix: fix stock_index_pe_lg interface 1.13.54 fix: fix stock_tfp_em interface 1.13.55 fix: fix sunrise_monthly interface 1.13.56 fix: fix currency_boc_safe interface 1.13.57 fix: fix stock_a_below_net_asset_statistics interface 1.13.58 fix: fix stock_lhb_jgmmtj_em interface 1.13.59 fix: fix stock_lhb_jgstatistic_em interface 1.13.60 fix: fix stock_zh_a_disclosure_report_cninfo interface 1.13.61 fix: fix stock_lhb_hyyyb_em interface 1.13.62 fix: fix index_fear_greed_funddb interface 1.13.63 fix: fix index_detail_hist_cni interface 1.13.64 fix: fix stock_lh_yyb_most interface 1.13.65 fix: fix stock_financial_report_sina interface 1.13.66 fix: fix stock_lhb_yytj_sina interface 1.13.67 fix: fix bond_info_cm interface 1.13.68 fix: fix rate_interbank interface 1.13.69 fix: fix get_shfe_rank_table interface 1.13.70 fix: fix stock_irm_cninfo interface 1.13.71 fix: fix stock_fhps_detail_ths interface 1.13.72 fix: fix futures_contract_info_shfe interface 1.13.73 fix: fix futures_shfe_warehouse_receipt interface 1.13.74 add: add macro_info_ws interface 1.13.75 add: add spot_price_qh interface 1.13.76 fix: fix macro_china_lpr interface 1.13.77 fix: fix stock_news_em interface 1.13.78 fix: fix futures_gfex_position_rank interface 1.13.79 fix: fix stock_industry_category_cninfo interface 1.13.80 fix: fix stock_irm_cninfo interface 1.13.81 fix: fix futures_dce_position_rank interface 1.13.82 fix: fix futures_dce_position_rank interface 1.13.83 fix: fix stock_balance_sheet_by_report_em interface 1.13.84 fix: fix index_hist_sw interface 1.13.85 fix: fix stock_news_em interface 1.13.86 fix: fix futures_foreign_commodity_realtime interface 1.13.87 fix: fix index_detail_cni interface 1.13.88 fix: fix index_price_cflp interface 1.13.89 fix: fix stock_zh_index_daily interface 1.13.90 fix: fix stock_zh_valuation_baidu interface 1.13.91 fix: fix stock_buffett_index_lg interface 1.13.92 fix: fix bond_china_close_return interface 1.13.93 add: add index_neei_cx interface 1.13.94 fix: fix stock_share_change_cninfo interface 1.13.95 fix: fix stock_allotment_cninfo interface 1.13.96 fix: fix stock_dividend_cninfo interface 1.13.97 fix: fix fund_portfolio_hold_em interface 1.13.98 fix: fix stock_financial_analysis_indicator interface 1.13.99 fix: fix macro_china_swap_rate interface 1.14.1 fix: fix energy_carbon_hb interface 1.14.2 fix: fix fund_portfolio_hold_em interface 1.14.3 fix: fix stock_industry_clf_hist_sw interface 1.14.4 add: add stock_margin_account_info interface 1.14.5 fix: fix stock_margin_account_info interface 1.14.6 fix: fix stock_register_kcb interface 1.14.7 fix: fix index_stock_info interface 1.14.8 add: add stock_register_sz interface 1.14.9 fix: fix bond_zh_hs_spot interface 1.14.10 fix: fix bond_cov_issue_cninfo interface 1.14.11 fix: fix bond_treasure_issue_cninfo interface 1.14.12 fix: fix get_tqdm function 1.14.13 fix: fix option_minute_em interface 1.14.14 fix: fix option_shfe_daily interface 1.14.15 fix: fix energy_carbon_domestic interface 1.14.16 fix: fix index_hist_sw interface 1.14.17 fix: fix stock_board_industry_summary_ths interface 1.14.18 fix: fix currency_pair_map interface 1.14.19 fix: fix bond_china_close_return interface 1.14.20 fix: fix option_risk_indicator_sse interface 1.14.21 fix: fix stock_info_global_cls interface 1.14.22 fix: fix macro_china_nbs_nation interface 1.14.23 fix: fix macro_china_nbs_nation interface 1.14.24 fix: fix macro_china_bond_public interface 1.14.25 add: add option_comm_info interface 1.14.26 fix: fix futures_fees_info interface 1.14.27 fix: fix nlp_ownthink interface 1.14.28 fix: fix news_trade_notify_dividend_baidu interface 1.14.29 fix: fix stock_individual_spot_xq interface 1.14.30 fix: fix stock_us_hist_min_em interface 1.14.31 fix: fix option_shfe_daily interface 1.14.32 add: add stock_concept_cons_futu interface 1.14.33 fix: fix stock_concept_cons_futu interface 1.14.34 add: add macro_rmb_loan interface 1.14.35 add: add macro_rmb_deposit interface 1.14.36 fix: fix option_czce_daily interface 1.14.37 fix: fix stock_zh_kcb_report_em interface 1.14.38 fix: fix stock_industry_clf_hist_sw interface 1.14.39 fix: fix stock_zh_b_daily interface 1.14.40 fix: fix fund_open_fund_rank_em interface 1.14.41 fix: fix fund_report_asset_allocation_cninfo interface 1.14.42 fix: fix stock_new_gh_cninfo interface 1.14.43 fix: fix stock_share_change_cninfo interface 1.14.44 fix: fix stock_hk_famous_spot_em interface 1.14.45 fix: fix option_lhb_em interface 1.14.46 add: add spot_hog_soozhu interface 1.14.47 fix: fix spot_hog_soozhu interface 1.14.48 add: add spot_hog_year_trend_soozhu interface 1.14.49 fix: fix fortune_rank interface 1.14.50 add: add spot_hog_lean_price_soozhu interface 1.14.51 add: add stock_news_main_cx interface 1.14.52 fix: fix stock_esg_hz_sina interface 1.14.53 add: add spot_hog_three_way_soozhu interface 1.14.54 fix: fix stock_individual_info_em interface 1.14.55 add: add spot_hog_crossbred_soozhu interface 1.14.56 add: add spot_corn_price_soozhu interface 1.14.57 add: add spot_soybean_price_soozhu interface 1.14.58 add: add spot_mixed_feed_soozhu interface 1.14.59 fix: fix macro_cnbs interface 1.14.60 fix: fix bond_zh_cov_info_ths interface 1.14.61 fix: fix stock_fund_flow_individual interface 1.14.62 fix: fix stock_zt_pool_em interface 1.14.63 add: add spot_quotations_sge interface 1.14.64 fix: fix stock_board_industry_spot_em interface 1.14.65 fix: fix option_dce_daily interface 1.14.66 fix: fix stock_profit_forecast_ths interface 1.14.67 fix: fix futures_foreign_commodity_realtime interface 1.14.68 fix: fix fund_scale_open_sina interface 1.14.69 fix: fix stock_zygc_ym interface 1.14.70 fix: fix setup.py 1.14.71 fix: fix stock_mda_ym interface 1.14.72 fix: fix fund_etf_hist_min_em interface 1.14.73 fix: fix stock_gpzy_profile_em interface 1.14.74 fix: fix stock_gpzy_pledge_ratio_em interface 1.14.75 fix: fix stock_sy_hy_em interface 1.14.76 fix: fix stock_sy_em interface 1.14.77 fix: fix stock_zh_b_daily interface 1.14.78 fix: fix stock_analyst_rank_em interface 1.14.79 add: add stock_zcfz_bj_em interface 1.14.80 fix: fix stock_hot_rank_wc interface 1.14.81 fix: fix stock_hsgt_hist_em interface 1.14.82 fix: fix stock_comment_detail_scrd_desire_daily_em interface 1.14.83 fix: fix stock_comment_detail_zhpj_lspf_em interface 1.14.84 fix: fix drewry_wci_index interface 1.14.85 fix: fix stock_profit_forecast_em interface 1.14.86 fix: fix stock_comment_detail_scrd_focus_em interface 1.14.87 fix: fix stock_hot_search_baidu interface 1.14.88 fix: fix stock_hot_rank_relate_em interface 1.14.89 fix: fix bond_spot_deal interface 1.14.90 fix: fix stock_board_change_em interface 1.14.91 fix: fix stock_history_dividend interface 1.14.92 add: add qdii_a_index_jsl interface 1.14.93 fix: fix stock_zt_pool_em interface 1.14.94 fix: fix stock_zt_pool_strong_em interface 1.14.95 fix: fix stock_zt_pool_sub_new_em interface 1.14.96 fix: fix stock_zt_pool_sub_new_em interface 1.14.97 fix: fix stock_profile_cninfo interface 1.14.98 fix: fix futures_hold_pos_sina interface 1.14.99 fix: fix stock_a_ttm_lyr interface 1.15.1 fix: fix stock_a_all_pb interface 1.15.2 fix: fix stock_index_pe_lg interface 1.15.3 fix: fix stock_share_change_cninfo interface 1.15.4 fix: fix stock_allotment_cninfo interface 1.15.5 fix: fix stock_individual_spot_xq interface 1.15.6 fix: fix qdii_e_index_jsl interface 1.15.7 fix: fix index_hist_sw interface 1.15.8 fix: fix fund_individual_basic_info_xq interface 1.15.9 fix: fix index_analysis_weekly_sw interface 1.15.10 add: add volatility_yz_rv indicator 1.15.11 fix: fix stock_individual_spot_xq interface 1.15.12 fix: fix stock_shareholder_change_ths interface 1.15.13 fix: fix stock_inner_trade_xq interface 1.15.14 fix: fix macro_bank_usa_interest_rate interface 1.15.15 add: add macro_bank_china_interest_rate interface 1.15.16 fix: fix macro_bank_usa_interest_rate interface 1.15.17 fix: fix news_trade_notify_dividend_baidu interface 1.15.18 fix: fix stock_share_hold_change_sse interface 1.15.19 fix: fix stock_share_hold_change_szse interface 1.15.20 fix: fix rv_from_stock_zh_a_hist_min_em interface 1.15.21 fix: fix get_futures_daily interface 1.15.22 fix: fix air_quality_hebei interface 1.15.23 fix: fix stock_sector_fund_flow_summary interface 1.15.24 fix: fix get_dce_daily interface 1.15.25 fix: fix stock_news_main_cx interface 1.15.26 fix: fix option_dce_daily interface 1.15.27 fix: fix stock_zh_index_spot_em interface 1.15.28 fix: fix stock_hk_valuation_baidu interface 1.15.29 fix: fix option_dce_daily interface 1.15.30 fix: fix fund_etf_category_sina interface 1.15.31 fix: fix stock_zt_pool_strong_em interface 1.15.32 fix: fix stock_info_global_cls interface 1.15.33 add: add stock_value_em interface 1.15.34 fix: fix fund_open_fund_rank_em interface 1.15.35 fix: fix futures_spot_price_daily interface 1.15.36 fix: fix futures_global_em interface 1.15.37 fix: fix stock_individual_spot_xq interface 1.15.38 fix: fix futures_contract_info_ine interface 1.15.39 fix: fix macro_china_new_house_price interface 1.15.40 fix: fix macro_china_fdi interface 1.15.41 fix: fix macro_china_fdi interface 1.15.42 fix: fix get_roll_yield_bar interface 1.15.43 fix: fix macro_china_urban_unemployment interface 1.15.44 fix: fix index_detail_hist_adjust_cni interface 1.15.45 fix: fix stock_jgdy_detail_em interface 1.15.46 fix: fix fund_etf_fund_info_em interface 1.15.47 fix: fix stock_individual_spot_xq interface 1.15.48 fix: fix stock_mda_ym interface 1.15.49 fix: fix option_dce_daily interface 1.15.50 fix: fix stock_gpzy_profile_em interface 1.15.51 fix: fix stock_gpzy_pledge_ratio_em interface 1.15.52 fix: fix stock_zh_index_hist_csindex interface 1.15.53 fix: fix futures_inventory_99 interface 1.15.54 fix: fix stock_sy_profile_em interface 1.15.55 fix: fix fund_etf_spot_em interface 1.15.56 fix: fix spot_goods interface 1.15.57 fix: fix add 2025 trade date 1.15.58 fix: fix futures_hold_pos_sina interface 1.15.59 fix: fix stock_sy_hy_em interface 1.15.60 fix: fix stock_hot_keyword_em interface 1.15.61 fix: fix stock_zt_pool_strong_em interface 1.15.62 fix: fix stock_zt_pool_sub_new_em interface 1.15.63 fix: fix stock_financial_abstract interface 1.15.64 fix: fix stock_zh_index_value_csindex interface 1.15.65 fix: fix option_czce_daily interface 1.15.66 fix: fix fund_etf_dividend_sina interface 1.15.67 fix: fix stock_hold_change_cninfo interface 1.15.68 fix: fix stock_research_report_em interface 1.15.69 fix: fix index_zh_a_hist_min_em interface 1.15.70 fix: fix stock_research_report_em interface 1.15.71 fix: fix stock_dzjy_sctj interface 1.15.72 fix: fix stock_us_spot interface 1.15.73 fix: fix stock_dzjy_hygtj interface 1.15.74 fix: fix macro_australia_retail_rate_monthly interface 1.15.75 feat: add futures_hist_em interface 1.15.76 fix: fix futures_zh_minute_sina interface 1.15.77 fix: fix option_czce_daily interface 1.15.78 fix: fix stock_yzxdr_em interface 1.15.79 fix: fix stock_new_a_spot_em interface 1.15.80 fix: fix option_gfex_vol_daily interface 1.15.81 fix: fix bank_fjcf_table_detail interface 1.15.82 fix: fix stock_individual_spot_xq interface 1.15.83 fix: fix stock_szse_sector_summary interface 1.15.84 fix: fix option_dce_daily interface 1.15.85 fix: fix stock_gddh_em interface 1.15.86 fix: fix stock_zdhtmx_em interface 1.15.87 fix: fix futures_index_ccidx interface 1.15.88 fix: fix stock_zh_a_spot_em interface 1.15.89 fix: fix stock_individual_info_em interface 1.15.90 fix: fix stock_financial_analysis_indicator interface 1.15.91 fix: fix stock_board_concept_cons_em interface 1.15.92 fix: fix stock_main_fund_flow interface 1.15.93 fix: fix fund_etf_spot_em interface 1.15.94 fix: fix stock_zh_index_spot_em interface 1.15.95 fix: fix stock_us_spot_em interface 1.15.96 fix: fix bond_cov_comparison interface 1.15.97 fix: fix stock_intraday_em interface 1.15.98 fix: fix stock_board_concept_name_em interface 1.15.99 fix: fix stock_esg_zd_sina interface 1.16.1 fix: fix stock_main_fund_flow interface 1.16.2 fix: fix stock_board_industry_hist_em interface 1.16.3 fix: fix stock_zh_index_spot_em interface 1.16.4 fix: fix stock_hk_ggt_components_em interface 1.16.5 fix: fix stock_sector_fund_flow_rank interface 1.16.6 fix: fix stock_sgt_reference_exchange_rate_sse interface 1.16.7 fix: fix fund_lof_hist_em interface 1.16.8 fix: fix option_czce_daily interface 1.16.9 fix: fix stock_sse_deal_daily interface 1.16.10 fix: fix option_risk_analysis_em interface 1.16.11 fix: fix stock_intraday_em interface 1.16.12 fix: fix bond_zh_hs_cov_daily interface 1.16.13 fix: fix futures_inventory_99 interface 1.16.14 fix: fix stock_info_global_cls interface 1.16.15 fix: fix stock_board_concept_name_em interface 1.16.16 fix: fix stock_board_concept_spot_em interface 1.16.17 fix: fix stock_research_report_em interface 1.16.18 fix: fix stock_board_concept_spot_em interface 1.16.19 fix: fix stock_profit_forecast_ths interface 1.16.20 fix: fix stock_lhb_detail_em interface 1.16.21 fix: fix stock_hk_index_daily_em interface 1.16.22 fix: fix fund_money_fund_info_em interface 1.16.23 fix: fix stock_board_industry_cons_em interface 1.16.24 fix: fix stock_financial_hk_report_em interface 1.16.25 fix: fix stock_financial_abstract_ths interface 1.16.26 add: add stock_hsgt_sh_hk_spot_em interface 1.16.27 fix: fix futures_global_em interface 1.16.28 fix: fix futures_global_hist_em interface 1.16.29 fix: fix futures_global_hist_em interface 1.16.30 add: add forex_hist_em interface 1.16.31 add: add index_global_hist_em interface 1.16.32 fix: fix news_economic_baidu interface 1.16.33 fix: fix fund_open_fund_daily_em interface 1.16.34 fix: fix stock_individual_fund_flow_rank interface 1.16.35 fix: fix futures_global_spot_em interface 1.16.36 fix: fix stock_intraday_em interface 1.16.37 fix: fix stock_board_concept_hist_em interface 1.16.38 fix: fix fund_etf_hist_em interface 1.16.39 fix: fix option_current_em interface 1.16.40 add: add stock_individual_basic_info_xq interface 1.16.41 fix: fix stock_individual_fund_flow_rank interface 1.16.42 fix: fix stock_concept_fund_flow_hist interface 1.16.43 fix: fix option_value_analysis_em interface 1.16.44 fix: fix stock_board_concept_hist_em interface 1.16.45 fix: fix option_risk_analysis_em interface 1.16.46 fix: fix stock_hk_index_spot_em interface 1.16.47 fix: fix stock_hsgt_stock_statistics_em interface 1.16.48 fix: fix stock_individual_basic_info_xq interface 1.16.49 fix: fix index_zh_a_hist_min_em interface 1.16.50 fix: fix futures_inventory_99 interface 1.16.51 fix: fix stock_individual_basic_info_xq interface 1.16.52 fix: fix stock_zh_a_spot_em interface 1.16.53 fix: fix stock_yjbb_em interface 1.16.54 fix: fix stock_zh_a_spot_em interface 1.16.55 fix: fix stock_zh_a_spot_em interface 1.16.56 fix: fix stock_zh_a_daily interface 1.16.57 fix: fix stock_market_pe_lg interface 1.16.58 fix: fix stock_zh_a_spot interface 1.16.59 fix: fix option_czce_hist interface 1.16.60 fix: fix stock_individual_fund_flow_rank interface 1.16.61 fix: fix stock_board_concept_index_ths interface 1.16.62 fix: fix stock_gdfx_free_holding_change_em interface 1.16.63 fix: fix stock_board_concept_name_ths interface 1.16.64 add: add reits_hist_em interface 1.16.65 fix: fix stock_dzjy_yybph interface 1.16.66 fix: fix macro_cons_silver interface 1.16.67 fix: fix stock_individual_basic_info_xq interface 1.16.68 fix: fix option_dce_daily interface 1.16.69 fix: fix stock_individual_spot_xq interface 1.16.70 fix: fix stock_zh_ah_spot_em interface 1.16.71 add: add stock_zh_a_gbjg_em interface 1.16.72 add: add bond_sh_buy_back_em interface 1.16.73 fix: fix stock_board_industry_hist_em interface 1.16.74 fix: fix stock_individual_spot_xq interface 1.16.75 fix: fix get_qhkc_index interface 1.16.76 fix: fix spot_quotations_sge interface 1.16.77 add: add stock_lhb_yyb_detail_em interface 1.16.78 fix: fix stock_zh_a_spot_em interface 1.16.79 fix: fix stock_individual_basic_info_xq interface 1.16.80 fix: fix stock_zh_a_disclosure_report_cninfo interface 1.16.81 fix: fix option_shfe_daily interface 1.16.82 fix: fix index_global_spot_em interface 1.16.83 fix: fix stock_individual_info_em interface 1.16.84 fix: fix stock_fhps_detail_ths interface 1.16.85 fix: fix stock_dividend_cninfo interface 1.16.86 fix: fix index_yw interface 1.16.87 fix: fix stock_zygc_em interface 1.16.88 fix: fix futures_inventory_99 interface 1.16.89 fix: fix stock_balance_sheet_by_yearly_em interface 1.16.90 fix: fix stock_hk_company_profile_em interface 1.16.91 fix: fix stock_sse_deal_daily interface 1.16.92 fix: fix bond_cb_jsl interface 1.16.93 fix: fix stock_hsgt_individual_em interface 1.16.94 fix: fix futures_fees_info interface 1.16.95 fix: fix option_shfe_daily interface 1.16.96 fix: fix stock_individual_spot_xq interface 1.16.97 fix: fix fund_open_fund_info_em interface 1.16.98 fix: fix fund_open_fund_info_em interface 1.16.99 fix: fix stock_info_sz_delist interface 1.17.1 fix: fix stock_gdfx_holding_detail_em interface 1.17.2 fix: fix stock_ggcg_em interface 1.17.3 fix: fix stock_hot_search_baidu interface 1.17.4 fix: fix stock_news_em interface 1.17.5 fix: fix stock_us_pink_spot_em interface 1.17.6 fix: fix stock_tfp_em interface 1.17.7 fix: fix futures_spot_price_daily interface 1.17.8 fix: fix forex_spot_em interface 1.17.9 fix: fix stock_zh_ab_comparison_em interface 1.17.10 fix: fix get_shfe_daily interface 1.17.11 fix: fix stock_individual_spot_xq interface 1.17.12 fix: fix get_receipt interface 1.17.13 fix: fix futures_shfe_warehouse_receipt interface 1.17.14 fix: fix forex_spot_em interface 1.17.15 fix: fix stock_comment_em interface 1.17.16 fix: fix bond_zh_cov interface 1.17.17 fix: fix stock_hk_spot interface 1.17.18 fix: fix option_dce_daily interface 1.17.19 fix: fix futures_spot_price_daily interface 1.17.20 fix: fix stock_news_em interface 1.17.21 fix: fix stock_sector_fund_flow_hist interface 1.17.22 fix: fix stock_individual_spot_xq interface 1.17.23 fix: fix get_roll_yield interface 1.17.24 fix: fix futures_inventory_99 interface 1.17.25 fix: fix get_receipt interface 1.17.26 fix: fix stock_hot_rank_detail_em interface 1.17.27 fix: fix index_csindex_all interface 1.17.28 fix: fix stock_financial_analysis_indicator_em interface 1.17.29 fix: fix air_quality_watch_point interface 1.17.30 fix: fix get_receipt interface 1.17.31 fix: fix index_neei_cx interface 1.17.32 fix: fix macro_china_shrzgm interface 1.17.33 fix: fix stock_comment_em interface 1.17.34 fix: fix option_czce_daily interface 1.17.35 fix: fix option_dce_daily interface 1.17.36 fix: fix futures_hist_em interface 1.17.37 fix: fix stock_zh_index_daily_em interface 1.17.38 fix: fix futures_inventory_99 interface 1.17.39 fix: fix bond_zh_cov_value_analysis interface 1.17.40 fix: fix stock_gdfx_free_holding_change_em interface 1.17.41 fix: fix stock_info_global_ths interface 1.17.42 fix: fix reits_realtime_em interface 1.17.43 fix: fix fund_rating_all interface 1.17.44 fix: fix stock_individual_spot_xq interface 1.17.45 fix: fix stock_dxsyl_em interface 1.17.46 fix: fix stock_financial_us_analysis_indicator_em interface 1.17.47 fix: fix get_receipt interface 1.17.48 fix: fix stock_hk_dividend_payout_em interface 1.17.49 fix: fix option_czce_daily interface 1.17.50 fix: fix option_current_day_szse interface 1.17.51 fix: fix fund_manager_em interface 1.17.52 fix: fix fund_overview_em interface 1.17.53 fix: fix reits_hist_min_em interface 1.17.54 fix: fix fund_announcement_dividend_em interface 1.17.55 fix: fix stock_zh_growth_comparison_em interface 1.17.56 fix: fix stock_balance_sheet_by_report_delisted_em interface 1.17.57 fix: fix stock_szse_summary interface 1.17.58 fix: fix fund_etf_fund_daily_em interface 1.17.59 fix: fix fx_c_swap_cm interface 1.17.60 fix: fix stock_intraday_sina interface 1.17.61 fix: fix stock_individual_spot_xq interface 1.17.62 fix: fix futures_dce_warehouse_receipt interface 1.17.63 fix: fix stock_financial_analysis_indicator_em interface 1.17.64 fix: fix stock_individual_spot_xq interface 1.17.65 fix: fix futures_dce_warehouse_receipt interface 1.17.66 fix: fix futures_delivery_czce interface 1.17.67 fix: fix stock_zh_a_hist_tx interface 1.17.68 fix: fix option_hist_dce interface 1.17.69 fix: fix fund_etf_hist_sina interface 1.17.70 fix: fix macro_stock_finance interface 1.17.71 fix: fix futures_inventory_99 interface 1.17.72 fix: fix futures_warehouse_receipt_dce interface 1.17.73 fix: fix get_receipt interface 1.17.74 fix: fix futures_dce_position_rank interface 1.17.75 fix: fix stock_a_ttm_lyr interface 1.17.76 fix: fix futures_index_ccidx interface 1.17.77 fix: fix get_dce_daily interface 1.17.78 fix: fix update python 3.14 support 1.17.79 fix: fix futures_contract_info_dce interface 1.17.80 fix: fix futures_contract_detail_em interface 1.17.81 fix: fix get_receipt interface 1.17.82 fix: fix stock_notice_report interface 1.17.83 fix: fix stock_cyq_em interface 1.17.84 fix: fix stock_individual_spot_xq interface 1.17.85 fix: fix news_trade_notify_dividend_baidu interface 1.17.86 fix: fix stock_news_em interface 1.17.87 fix: fix stock_dividend_cninfo interface 1.17.88 fix: fix stock_zh_a_minute interface 1.17.89 fix: fix news_trade_notify_dividend_baidu interface 1.17.90 fix: fix stock_individual_spot_xq interface 1.17.91 fix: fix news_economic_baidu interface 1.17.92 fix: fix currency_boc_sina interface 1.17.93 fix: fix stock_news_em interface 1.17.94 fix: fix index_detail_cni interface 1.17.95 fix: fix stock_info_sh_name_code interface 1.17.96 fix: fix stock_info_sh_name_code interface 1.17.97 fix: fix stock_financial_debt_new_ths interface 1.17.98 fix: fix stock_jgdy_tj_em interface 1.17.99 fix: fix stock_news_em interface 1.18.1 fix: fix stock_us_valuation_baidu interface 1.18.2 fix: fix stock_ipo_declare_em interface 1.18.3 fix: fix stock_ipo_tutor_em interface 1.18.4 fix: fix stock_zh_a_daily interface 1.18.5 fix: fix futures_inventory_99 interface 1.18.6 fix: fix fund_fee_em interface 1.18.7 fix: fix stock_us_valuation_baidu interface 1.18.8 fix: fix stock_zh_valuation_comparison_em interface 1.18.9 fix: fix fx_quote_baidu interface 1.18.10 fix: fix futures_comm_info interface 1.18.11 fix: fix stock_individual_spot_xq interface 1.18.12 fix: fix news_economic_baidu interface 1.18.13 fix: fix futures_spot_price_daily interface 1.18.14 fix: fix fund_etf_scale_szse interface 1.18.15 fix: fix fund_etf_scale_sse interface 1.18.16 fix: fix news_economic_baidu interface 1.18.17 fix: fix stock_individual_spot_xq interface 1.18.18 fix: fix stock_individual_spot_xq interface 1.18.19 fix: fix github action 1.18.20 fix: fix stock_individual_spot_xq interface 1.18.21 fix: fix get_receipt interface 1.18.22 fix: fix bond_gb_zh_sina interface 1.18.23 fix: fix fund_fee_em interface 1.18.24 fix: fix stock_individual_spot_xq interface 1.18.25 fix: fix qdii_e_comm_jsl interface 1.18.26 fix: fix fund_fh_em interface 1.18.27 fix: fix futures_comm_js interface 1.18.28 fix: fix futures_spot_price_daily interface 1.18.29 fix: fix stock_individual_basic_info_xq interface 1.18.30 fix: fix futures_inventory_99 interface 1.18.31 fix: fix stock_hk_dividend_payout_em interface 1.18.32 fix: fix fund_new_found_ths interface 1.18.33 fix: fix futures_spot_price_daily interface 1.18.34 fix: fix fund_fh_em interface 1.18.35 fix: fix stock_ipo_ths interface 1.18.36 fix: fix stock_zygc_em interface 1.18.37 fix: fix fund_etf_dividend_sina interface 1.18.38 fix: fix stock_hk_index_daily_sina interface 1.18.39 fix: fix stock_hk_daily interface 1.18.40 fix: fix stock_hk_daily interface 1.18.41 fix: fix stock_zh_a_minute interface 1.18.42 fix: fix stock_zh_a_minute interface 1.18.43 fix: fix stock_financial_abstract_new_ths interface 1.18.44 fix: fix index_option_50etf_qvix interface 1.18.45 fix: fix stock_a_high_low_statistics interface 1.18.46 fix: fix stock_a_all_pb interface 1.18.47 fix: fix stock_margin_underlying_info_szse interface 1.18.48 fix: fix stock_individual_spot_xq interface 1.18.49 fix: fix macro_china_urban_unemployment interface 1.18.50 fix: fix stock_gpzy_individual_pledge_ratio_detail_em interface """ from akshare._version import __version__ __author__ = "AKFamily" """ 期货结算 """ from akshare.futures.futures_settle import ( futures_settle, futures_settle_gfex, futures_settle_ine, futures_settle_czce, futures_settle_cffex, futures_settle_shfe, ) """ 国债收益率 """ from akshare.bond.bond_gb_sina import bond_gb_zh_sina, bond_gb_us_sina """ openctp-合约信息接口 """ from akshare.option.option_contract_info_ctp import option_contract_info_ctp """ 中国外汇交易中心暨全国银行间同业拆借中心-基准-外汇市场-外汇掉期曲线-外汇掉漆 C-Swap 定盘曲线 """ from akshare.fx.fx_c_swap_cm import fx_c_swap_cm """ 上海证券交易所-产品-股票期权-信息披露-当日合约 """ from akshare.option.option_current_sse import option_current_day_sse """ 深圳证券交易所-期权子网-行情数据-当日合约 """ from akshare.option.option_current_szse import option_current_day_szse """ 东方财富-A股-财务分析-主要指标 """ from akshare.stock_fundamental.stock_finance_sina import stock_financial_analysis_indicator_em """ 期权保证金 """ from akshare.option.option_margin import option_margin, option_margin_symbol """ 东方财富-港股-证券资料 """ from akshare.stock.stock_profile_em import stock_hk_company_profile_em, stock_hk_security_profile_em """ 东方财富-港股-核心必读 """ from akshare.stock.stock_profile_em import stock_hk_dividend_payout_em, stock_hk_financial_indicator_em """ 东方财富-港股-行业对比 """ from akshare.stock.stock_hk_comparison_em import ( stock_hk_growth_comparison_em, stock_hk_valuation_comparison_em, stock_hk_scale_comparison_em ) """ 东方财富-行情中心-同行比较 """ from akshare.stock.stock_zh_comparison_em import (stock_zh_growth_comparison_em, stock_zh_valuation_comparison_em, stock_zh_dupont_comparison_em, stock_zh_scale_comparison_em ) """ 东方财富网-行情中心-债券市场-质押式回购 """ from akshare.bond.bond_buy_back_em import bond_sh_buy_back_em, bond_sz_buy_back_em, bond_buy_back_hist_em """ 东方财富-A股数据-股本结构 """ from akshare.stock_fundamental.stock_gbjg_em import stock_zh_a_gbjg_em """ 雪球-个股-公司概况-公司简介 """ from akshare.stock_fundamental.stock_basic_info_xq import ( stock_individual_basic_info_xq, stock_individual_basic_info_hk_xq, stock_individual_basic_info_us_xq, ) """ 新浪财经-行情中心-环球市场 """ from akshare.index.index_global_sina import index_global_hist_sina, index_global_name_table """ 东方财富网-行情中心-全球指数 """ from akshare.index.index_global_em import index_global_hist_em, index_global_spot_em """ 东方财富网-行情中心-外汇市场-所有汇率 """ from akshare.forex.forex_em import forex_hist_em, forex_spot_em """ 东方财富网-行情中心-沪深港通 """ from akshare.stock.stock_hsgt_em import stock_zh_ah_spot_em, stock_hsgt_sh_hk_spot_em """ 东方财富-美股-财务分析-三大报表 """ from akshare.stock_fundamental.stock_finance_us_em import ( stock_financial_us_report_em, stock_financial_us_analysis_indicator_em, ) """ 期货行情-内盘-历史行情数据-东财 """ from akshare.futures.futures_hist_em import futures_hist_table_em, futures_hist_em """ 巨潮资讯-数据中心-专题统计-股东股本-股本变动 """ from akshare.stock.stock_hold_control_cninfo import stock_hold_change_cninfo """ 天天基金-基金档案-基金基本概况 """ from akshare.fund.fund_overview_em import fund_overview_em """ 基金费率 """ from akshare.fund.fund_fee_em import fund_fee_em """ 东方财富网-数据中心-估值分析-每日互动-每日互动-估值分析 """ from akshare.stock_feature.stock_value_em import stock_value_em """ 已实现波动率 """ from akshare.cal.rv import volatility_yz_rv, rv_from_futures_zh_minute_sina, rv_from_stock_zh_a_hist_min_em """ QDII """ from akshare.qdii.qdii_jsl import qdii_a_index_jsl, qdii_e_index_jsl, qdii_e_comm_jsl """ 财新网-财新数据通 """ from akshare.stock.stock_news_cx import stock_news_main_cx """ 搜猪-生猪大数据-各省均价实时排行榜 """ from akshare.spot.spot_hog_soozhu import ( spot_hog_soozhu, spot_hog_year_trend_soozhu, spot_hog_lean_price_soozhu, spot_hog_three_way_soozhu, spot_hog_crossbred_soozhu, spot_corn_price_soozhu, spot_soybean_price_soozhu, spot_mixed_feed_soozhu, ) """ 知名港股 """ from akshare.stock.stock_hk_famous import stock_hk_famous_spot_em """ 同花顺-数据中心-宏观数据-股票筹资 """ from akshare.economic.macro_finance_ths import macro_stock_finance, macro_rmb_loan, macro_rmb_deposit """ 富途牛牛-主题投资-概念板块-成分股 """ from akshare.stock_feature.stock_concept_futu import stock_concept_cons_futu """ 商品期权手续费 """ from akshare.option.option_comm_qihuo import option_comm_info, option_comm_symbol """ 上海证券交易所-产品-股票期权-每日统计 """ from akshare.option.option_daily_stats_sse_szse import option_daily_stats_sse, option_daily_stats_szse """ 同花顺理财-基金数据-每日净值-ETF """ from akshare.fund.fund_etf_ths import fund_etf_spot_ths, fund_etf_category_ths """ 东方财富网-数据中心-融资融券-融资融券账户统计-两融账户信息 """ from akshare.stock_feature.stock_margin_em import stock_margin_account_info """ 现货走势 """ from akshare.spot.spot_price_qh import spot_price_qh, spot_price_table_qh """ 华尔街见闻-日历-宏观 """ from akshare.economic.macro_info_ws import macro_info_ws """ 数库-A股新闻情绪指数 """ from akshare.index.index_zh_a_scope import index_news_sentiment_scope """ 申万宏源研究-申万指数-指数发布-基金指数-实时行情 """ from akshare.index.index_research_fund_sw import index_hist_fund_sw, index_realtime_fund_sw """ 东方财富-财经早餐 """ from akshare.stock_feature.stock_info import ( stock_info_cjzc_em, stock_info_global_em, stock_info_global_ths, stock_info_global_futu, stock_info_global_sina, stock_info_global_cls, ) """ 期货交易-参数汇总查询 """ from akshare.futures_derivative.futures_contract_info_shfe import futures_contract_info_shfe from akshare.futures_derivative.futures_contract_info_dce import futures_contract_info_dce from akshare.futures_derivative.futures_contract_info_czce import futures_contract_info_czce from akshare.futures_derivative.futures_contract_info_gfex import futures_contract_info_gfex from akshare.futures_derivative.futures_contract_info_cffex import futures_contract_info_cffex from akshare.futures_derivative.futures_contract_info_ine import futures_contract_info_ine """ 上海期货交易所-指定交割仓库-库存周报 """ from akshare.futures.futures_stock_js import futures_stock_shfe_js """ 金十数据-期货手续费 """ from akshare.futures.futures_comm_js import futures_comm_js """ 东方财富-数据中心-沪深港通-市场概括-分时数据 """ from akshare.stock_feature.stock_hsgt_min_em import stock_hsgt_fund_min_em """ 东方财富网-行情中心-期货市场-国际期货 """ from akshare.futures.futures_hf_em import futures_global_spot_em, futures_global_hist_em """ 雪球行情数据 """ from akshare.stock.stock_xq import ( stock_individual_spot_xq, ) """ 港股盈利预测 """ from akshare.stock_fundamental.stock_profit_forecast_hk_etnet import stock_hk_profit_forecast_et """ 巨潮资讯-首页-公告查询-信息披露 """ from akshare.stock_feature.stock_disclosure_cninfo import ( stock_zh_a_disclosure_relation_cninfo, stock_zh_a_disclosure_report_cninfo, ) """ 东财财富-分时数据 """ from akshare.stock.stock_intraday_sina import stock_intraday_sina """ 股票日行情 """ from akshare.stock_feature.stock_hist_tx import stock_zh_a_hist_tx """ 筹码分布 """ from akshare.stock_feature.stock_cyq_em import stock_cyq_em """ 东财财富-分时数据 """ from akshare.stock.stock_intraday_em import stock_intraday_em """ 美股指数行情 """ from akshare.index.index_stock_us_sina import index_us_stock_sina """ 董监高及相关人员持股变动 """ from akshare.stock.stock_share_hold import ( stock_share_hold_change_bse, stock_share_hold_change_sse, stock_share_hold_change_szse, ) """ 东方财富网-数据中心-研究报告-个股研报 """ from akshare.stock_feature.stock_research_report_em import stock_research_report_em """ 东方财富网-数据中心-重大合同-重大合同明细 """ from akshare.stock_feature.stock_zdhtmx_em import stock_zdhtmx_em """ 东方财富网-数据中心-股东大会 """ from akshare.stock_feature.stock_gddh_em import stock_gddh_em """ 东方财富网-数据中心-股市日历 """ from akshare.stock.stock_gsrl_em import stock_gsrl_gsdt_em """ 东方财富网-数据中心-特色数据-高管持股 """ from akshare.stock.stock_hold_control_em import ( stock_hold_management_detail_em, stock_hold_management_person_em, ) """ 新浪财经-债券-可转债 """ from akshare.bond.bond_cb_sina import bond_cb_profile_sina, bond_cb_summary_sina """ 上证e互动 """ from akshare.stock_feature.stock_sns_sseinfo import stock_sns_sseinfo """ 互动易-提问与回答 """ from akshare.stock_feature.stock_irm_cninfo import ( stock_irm_cninfo, stock_irm_ans_cninfo, ) """ 基金公告-分红配送 """ from akshare.fund.fund_announcement_em import fund_announcement_dividend_em """ 基金公告-定期报告 """ from akshare.fund.fund_announcement_em import fund_announcement_report_em """ 基金公告-人事公告 """ from akshare.fund.fund_announcement_em import fund_announcement_personnel_em """ 新浪财经-ESG评级中心 """ from akshare.stock_feature.stock_esg_sina import ( stock_esg_msci_sina, stock_esg_rft_sina, stock_esg_rate_sina, stock_esg_zd_sina, stock_esg_hz_sina, ) """ LOF 行情数据 """ from akshare.fund.fund_lof_em import ( fund_lof_hist_em, fund_lof_spot_em, fund_lof_hist_min_em, ) """ 同花顺-财务指标-主要指标 """ from akshare.stock_fundamental.stock_finance_ths import ( stock_financial_abstract_ths, stock_financial_debt_ths, stock_financial_benefit_ths, stock_financial_cash_ths, stock_financial_abstract_new_ths, stock_financial_debt_new_ths, stock_financial_benefit_new_ths, stock_financial_cash_new_ths, stock_management_change_ths, stock_shareholder_change_ths, ) """ 港股股票指数数据-新浪-东财 """ from akshare.index.index_stock_hk import ( stock_hk_index_spot_sina, stock_hk_index_daily_em, stock_hk_index_spot_em, stock_hk_index_daily_sina, ) """ 同花顺-数据中心-可转债 """ from akshare.bond.bond_cb_ths import bond_zh_cov_info_ths """ 同花顺-港股-分红派息 """ from akshare.stock.stock_hk_fhpx_ths import stock_hk_fhpx_detail_ths """ 同花顺-分红融资 """ from akshare.stock_feature.stock_fhps_ths import stock_fhps_detail_ths """ 东方财富-行情报价 """ from akshare.stock.stock_ask_bid_em import stock_bid_ask_em """ 同花顺-盈利预测 """ from akshare.stock_fundamental.stock_profit_forecast_ths import ( stock_profit_forecast_ths, ) """ 期货资讯 """ from akshare.futures.futures_news_shmet import futures_news_shmet """ 主营介绍 """ from akshare.stock_fundamental.stock_zyjs_ths import stock_zyjs_ths """ 东方财富-ETF 行情 """ from akshare.fund.fund_etf_em import ( fund_etf_hist_em, fund_etf_hist_min_em, fund_etf_spot_em, ) """ 上海证券交易所-ETF基金份额数据 """ from akshare.fund.fund_etf_sse import fund_etf_scale_sse """ 深圳证券交易所-ETF基金份额数据 """ from akshare.fund.fund_etf_szse import fund_etf_scale_szse """ 乐咕乐股-股债利差 """ from akshare.stock_feature.stock_ebs_lg import stock_ebs_lg """ 乐咕乐股-基金仓位 """ from akshare.fund.fund_position_lg import ( fund_stock_position_lg, fund_balance_position_lg, fund_linghuo_position_lg, ) """ 乐咕乐股-大盘拥挤度 """ from akshare.stock_feature.stock_congestion_lg import stock_a_congestion_lg """ 乐咕乐股-股息率-A 股股息率 """ from akshare.stock_feature.stock_gxl_lg import stock_a_gxl_lg, stock_hk_gxl_lg """ 东方财富-限售解禁股 """ from akshare.stock_fundamental.stock_restricted_em import ( stock_restricted_release_stockholder_em, stock_restricted_release_summary_em, stock_restricted_release_detail_em, stock_restricted_release_queue_em, ) """ 同花顺行业一览表 """ from akshare.stock_feature.stock_board_industry_ths import ( stock_board_industry_summary_ths, ) """ 生猪市场价格指数 """ from akshare.index.index_hog import index_hog_spot_price """ 债券信息查询 """ from akshare.bond.bond_info_cm import ( bond_info_detail_cm, bond_info_cm, bond_info_cm_query, ) """ 申万宏源研究-指数系列 """ from akshare.index.index_research_sw import ( index_realtime_sw, index_hist_sw, index_component_sw, index_min_sw, index_analysis_daily_sw, index_analysis_weekly_sw, index_analysis_monthly_sw, index_analysis_week_month_sw, ) """ 50ETF 期权波动率指数 """ from akshare.index.index_option_qvix import ( index_option_50etf_qvix, index_option_300etf_min_qvix, index_option_300etf_qvix, index_option_50etf_min_qvix, index_option_1000index_min_qvix, index_option_1000index_qvix, index_option_100etf_min_qvix, index_option_100etf_qvix, index_option_300index_min_qvix, index_option_300index_qvix, index_option_500etf_min_qvix, index_option_500etf_qvix, index_option_50index_min_qvix, index_option_50index_qvix, index_option_cyb_min_qvix, index_option_cyb_qvix, index_option_kcb_min_qvix, index_option_kcb_qvix, ) """ 百度股市通-外汇-行情榜单 """ from akshare.fx.fx_quote_baidu import fx_quote_baidu """ 乐估乐股-底部研究-巴菲特指标 """ from akshare.stock_feature.stock_buffett_index_lg import stock_buffett_index_lg """ 百度股市通-热搜股票 """ from akshare.stock.stock_hot_search_baidu import stock_hot_search_baidu """ 百度股市通- A 股或指数-股评-投票 """ from akshare.stock_feature.stock_zh_vote_baidu import stock_zh_vote_baidu """ 百度股市通-A 股-财务报表-估值数据 """ from akshare.stock_feature.stock_zh_valuation_baidu import stock_zh_valuation_baidu """ 百度股市通-港股-财务报表-估值数据 """ from akshare.stock_feature.stock_hk_valuation_baidu import stock_hk_valuation_baidu """ 百度股市通-美股-财务报表-估值数据 """ from akshare.stock_feature.stock_us_valuation_baidu import stock_us_valuation_baidu """ 巨潮资讯-个股-公司概况 """ from akshare.stock.stock_profile_cninfo import stock_profile_cninfo """ 巨潮资讯-个股-上市相关 """ from akshare.stock.stock_ipo_summary_cninfo import stock_ipo_summary_cninfo """ 巨潮资讯-数据浏览器-筹资指标-公司配股实施方案 """ from akshare.stock.stock_allotment_cninfo import stock_allotment_cninfo """ 沪深港股通-参考汇率和结算汇率 """ from akshare.stock_feature.stock_hsgt_exchange_rate import ( stock_sgt_reference_exchange_rate_sse, stock_sgt_settlement_exchange_rate_sse, stock_sgt_reference_exchange_rate_szse, stock_sgt_settlement_exchange_rate_szse, ) """ 中国债券信息网-中债指数-中债指数族系-总指数-综合类指数 """ from akshare.bond.bond_cbond import ( bond_new_composite_index_cbond, bond_composite_index_cbond, ) """ 行业板块 """ from akshare.stock_feature.stock_classify_sina import stock_classify_sina """ 主营构成 """ from akshare.stock_fundamental.stock_zygc import stock_zygc_em """ 人民币汇率中间价 """ from akshare.currency.currency_safe import currency_boc_safe """ 期权-上海证券交易所-风险指标 """ from akshare.option.option_risk_indicator_sse import option_risk_indicator_sse """ 期权-上海证券交易所-当日合约 """ from akshare.option.option_risk_indicator_sse import option_risk_indicator_sse """ 全球宏观事件 """ from akshare.news.news_baidu import ( news_economic_baidu, news_trade_notify_suspend_baidu, news_report_time_baidu, news_trade_notify_dividend_baidu, ) """ 东方财富-股票-财务分析 """ from akshare.stock_feature.stock_three_report_em import ( stock_balance_sheet_by_report_em, stock_balance_sheet_by_yearly_em, stock_profit_sheet_by_report_em, stock_profit_sheet_by_quarterly_em, stock_profit_sheet_by_yearly_em, stock_cash_flow_sheet_by_report_em, stock_cash_flow_sheet_by_quarterly_em, stock_cash_flow_sheet_by_yearly_em, stock_balance_sheet_by_report_delisted_em, stock_profit_sheet_by_report_delisted_em, stock_cash_flow_sheet_by_report_delisted_em, ) """ 内部交易 """ from akshare.stock_feature.stock_inner_trade_xq import stock_inner_trade_xq """ 股票热度-雪球 """ from akshare.stock_feature.stock_hot_xq import ( stock_hot_deal_xq, stock_hot_follow_xq, stock_hot_tweet_xq, ) """ 东方财富-股票数据-龙虎榜 """ from akshare.stock_feature.stock_lhb_em import ( stock_lhb_hyyyb_em, stock_lhb_detail_em, stock_lhb_stock_detail_em, stock_lhb_jgmmtj_em, stock_lhb_stock_statistic_em, stock_lhb_stock_detail_date_em, stock_lhb_yybph_em, stock_lhb_jgstatistic_em, stock_lhb_traderstatistic_em, stock_lhb_yyb_detail_em, ) """ 指数行情数据 """ from akshare.index.index_zh_em import ( index_zh_a_hist, index_zh_a_hist_min_em, index_code_id_map_em, ) """ 东方财富个股人气榜-A股 """ from akshare.stock.stock_hot_rank_em import ( stock_hot_rank_detail_em, stock_hot_rank_em, stock_hot_rank_detail_realtime_em, stock_hot_rank_relate_em, stock_hot_keyword_em, stock_hot_rank_latest_em, ) from akshare.stock.stock_hot_up_em import stock_hot_up_em """ 东方财富个股人气榜-港股 """ from akshare.stock.stock_hk_hot_rank_em import ( stock_hk_hot_rank_detail_em, stock_hk_hot_rank_latest_em, stock_hk_hot_rank_detail_realtime_em, stock_hk_hot_rank_em, ) """ 财新指数 """ from akshare.index.index_cx import ( index_pmi_com_cx, index_pmi_man_cx, index_pmi_ser_cx, index_dei_cx, index_ii_cx, index_si_cx, index_fi_cx, index_bi_cx, index_ci_cx, index_awpr_cx, index_cci_cx, index_li_cx, index_neaw_cx, index_nei_cx, index_ti_cx, index_ai_cx, index_neei_cx, index_bei_cx, index_qli_cx, ) """ 期权折溢价分析 """ from akshare.option.option_premium_analysis_em import ( option_premium_analysis_em, ) """ 期权风险分析 """ from akshare.option.option_risk_analysis_em import option_risk_analysis_em """ 期权价值分析 """ from akshare.option.option_value_analysis_em import option_value_analysis_em """ 期权龙虎榜 """ from akshare.option.option_lhb_em import option_lhb_em """ 东方财富网-数据中心-股东分析 """ from akshare.stock_feature.stock_gdfx_em import ( stock_gdfx_holding_analyse_em, stock_gdfx_free_holding_analyse_em, stock_gdfx_free_top_10_em, stock_gdfx_top_10_em, stock_gdfx_free_holding_detail_em, stock_gdfx_holding_detail_em, stock_gdfx_free_holding_change_em, stock_gdfx_holding_change_em, stock_gdfx_free_holding_statistics_em, stock_gdfx_holding_statistics_em, stock_gdfx_free_holding_teamwork_em, stock_gdfx_holding_teamwork_em, ) """ 中国食糖指数 """ from akshare.index.index_sugar import ( index_sugar_msweet, index_inner_quote_sugar_msweet, index_outer_quote_sugar_msweet, ) """ 东方财富-个股信息 """ from akshare.stock.stock_info_em import stock_individual_info_em """ 上海黄金交易所-数据资讯-行情走势 """ from akshare.spot.spot_sge import ( spot_hist_sge, spot_symbol_table_sge, spot_silver_benchmark_sge, spot_golden_benchmark_sge, spot_quotations_sge, ) """ 股票回购 """ from akshare.stock.stock_repurchase_em import stock_repurchase_em """ 东方财富-行业板块 """ from akshare.stock.stock_board_industry_em import ( stock_board_industry_cons_em, stock_board_industry_hist_em, stock_board_industry_hist_min_em, stock_board_industry_name_em, stock_board_industry_spot_em, ) """ 天天基金网-基金数据-规模变动 """ from akshare.fund.fund_scale_em import ( fund_scale_change_em, fund_hold_structure_em, ) """ 天天基金网-基金数据-分红送配 """ from akshare.fund.fund_fhsp_em import fund_cf_em, fund_fh_rank_em, fund_fh_em """ 艺恩-艺人 """ from akshare.movie.artist_yien import ( online_value_artist, business_value_artist, ) """ 艺恩-视频放映 """ from akshare.movie.video_yien import video_variety_show, video_tv """ 同花顺-数据中心-技术选股 """ from akshare.stock_feature.stock_technology_ths import ( stock_rank_cxg_ths, stock_rank_cxd_ths, stock_rank_lxsz_ths, stock_rank_lxxd_ths, stock_rank_cxfl_ths, stock_rank_cxsl_ths, stock_rank_xstp_ths, stock_rank_xxtp_ths, stock_rank_ljqd_ths, stock_rank_ljqs_ths, stock_rank_xzjp_ths, ) """ 沪深港通持股 """ from akshare.stock_feature.stock_hsgt_em import ( stock_hsgt_individual_em, stock_hsgt_individual_detail_em, stock_hsgt_fund_flow_summary_em, ) """ 基金规模 """ from akshare.fund.fund_scale_sina import ( fund_scale_open_sina, fund_scale_close_sina, fund_scale_structured_sina, ) """ 巨潮资讯-数据中心-专题统计-基金报表 """ from akshare.fund.fund_report_cninfo import ( fund_report_stock_cninfo, fund_report_industry_allocation_cninfo, fund_report_asset_allocation_cninfo, ) """ 巨潮资讯-数据中心-专题统计-债券报表-债券发行 """ from akshare.bond.bond_issue_cninfo import ( bond_treasure_issue_cninfo, bond_local_government_issue_cninfo, bond_corporate_issue_cninfo, bond_cov_issue_cninfo, bond_cov_stock_issue_cninfo, ) """ 巨潮资讯-数据中心-专题统计-公司治理-股权质押 """ from akshare.stock.stock_cg_equity_mortgage import ( stock_cg_equity_mortgage_cninfo, ) """ 巨潮资讯-数据中心-专题统计-公司治理-公司诉讼 """ from akshare.stock.stock_cg_lawsuit import stock_cg_lawsuit_cninfo """ 巨潮资讯-数据中心-专题统计-公司治理-对外担保 """ from akshare.stock.stock_cg_guarantee import stock_cg_guarantee_cninfo """ B 股 """ from akshare.stock.stock_zh_b_sina import ( stock_zh_b_spot, stock_zh_b_daily, stock_zh_b_minute, ) """ 期货手续费 """ from akshare.futures.futures_comm_qihuo import futures_comm_info from akshare.futures.futures_comm_ctp import futures_fees_info """ 实际控制人持股变动 """ from akshare.stock.stock_hold_control_cninfo import ( stock_hold_control_cninfo, stock_hold_management_detail_cninfo, ) """ 股东人数及持股集中度 """ from akshare.stock.stock_hold_num_cninfo import stock_hold_num_cninfo """ 新股过会 """ from akshare.stock.stock_new_cninfo import ( stock_new_gh_cninfo, stock_new_ipo_cninfo, ) """ 个股分红 """ from akshare.stock.stock_dividend_cninfo import stock_dividend_cninfo """ 公司股本变动 """ from akshare.stock.stock_share_changes_cninfo import stock_share_change_cninfo """ 行业分类数据 """ from akshare.stock.stock_industry_cninfo import ( stock_industry_category_cninfo, stock_industry_change_cninfo, ) """ 行业市盈率 """ from akshare.stock.stock_industry_pe_cninfo import ( stock_industry_pe_ratio_cninfo, ) """ 申万宏源行业分类数据 """ from akshare.stock.stock_industry_sw import stock_industry_clf_hist_sw """ 投资评级 """ from akshare.stock.stock_rank_forecast import stock_rank_forecast_cninfo """ 美股-知名美股 """ from akshare.stock.stock_us_famous import stock_us_famous_spot_em """ 美股-粉单市场 """ from akshare.stock.stock_us_pink import stock_us_pink_spot_em """ REITs """ from akshare.reits.reits_basic import reits_realtime_em, reits_hist_em, reits_hist_min_em """ 全部 A 股-等权重市盈率、中位数市盈率 全部 A 股-等权重、中位数市净率 """ from akshare.stock_feature.stock_ttm_lyr import stock_a_ttm_lyr from akshare.stock_feature.stock_all_pb import stock_a_all_pb """ 宏观-加拿大 """ from akshare.economic.macro_canada import ( macro_canada_cpi_monthly, macro_canada_core_cpi_monthly, macro_canada_bank_rate, macro_canada_core_cpi_yearly, macro_canada_cpi_yearly, macro_canada_gdp_monthly, macro_canada_new_house_rate, macro_canada_retail_rate_monthly, macro_canada_trade, macro_canada_unemployment_rate, ) """ 猪肉价格信息 """ from akshare.futures_derivative.futures_hog import ( futures_hog_core, futures_hog_cost, futures_hog_supply, ) """ 宏观-澳大利亚 """ from akshare.economic.macro_australia import ( macro_australia_bank_rate, macro_australia_unemployment_rate, macro_australia_trade, macro_australia_cpi_quarterly, macro_australia_cpi_yearly, macro_australia_ppi_quarterly, macro_australia_retail_rate_monthly, ) """ 融资融券-深圳 """ from akshare.stock_feature.stock_margin_szse import ( stock_margin_underlying_info_szse, stock_margin_detail_szse, stock_margin_szse, ) """ 英国-宏观 """ from akshare.economic.macro_uk import ( macro_uk_gdp_yearly, macro_uk_gdp_quarterly, macro_uk_retail_yearly, macro_uk_rightmove_monthly, macro_uk_rightmove_yearly, macro_uk_unemployment_rate, macro_uk_halifax_monthly, macro_uk_bank_rate, macro_uk_core_cpi_monthly, macro_uk_core_cpi_yearly, macro_uk_cpi_monthly, macro_uk_cpi_yearly, macro_uk_halifax_yearly, macro_uk_retail_monthly, macro_uk_trade, ) """ 日本-宏观 """ from akshare.economic.macro_japan import ( macro_japan_bank_rate, macro_japan_core_cpi_yearly, macro_japan_cpi_yearly, macro_japan_head_indicator, macro_japan_unemployment_rate, ) """ 瑞士-宏观 """ from akshare.economic.macro_swiss import ( macro_swiss_trade, macro_swiss_svme, macro_swiss_cpi_yearly, macro_swiss_gbd_yearly, macro_swiss_gbd_bank_rate, macro_swiss_gdp_quarterly, ) """ 东方财富-概念板块 """ from akshare.stock.stock_board_concept_em import ( stock_board_concept_cons_em, stock_board_concept_hist_em, stock_board_concept_hist_min_em, stock_board_concept_name_em, stock_board_concept_spot_em, ) """ 德国-经济指标 """ from akshare.economic.macro_germany import ( macro_germany_gdp, macro_germany_ifo, macro_germany_cpi_monthly, macro_germany_retail_sale_monthly, macro_germany_trade_adjusted, macro_germany_retail_sale_yearly, macro_germany_cpi_yearly, macro_germany_zew, ) """ 基金规模和规模趋势 """ from akshare.fund.fund_aum_em import ( fund_aum_em, fund_aum_trend_em, fund_aum_hist_em, ) """ CME 比特币成交量 """ from akshare.crypto.crypto_bitcoin_cme import crypto_bitcoin_cme """ 盘口异动 """ from akshare.stock_feature.stock_pankou_em import ( stock_changes_em, stock_board_change_em, ) """ A 股东方财富 """ from akshare.stock_feature.stock_hist_em import ( stock_zh_a_spot_em, stock_bj_a_spot_em, stock_new_a_spot_em, stock_kc_a_spot_em, stock_cy_a_spot_em, stock_sh_a_spot_em, stock_sz_a_spot_em, stock_zh_b_spot_em, stock_zh_ab_comparison_em, stock_zh_a_hist, stock_hk_spot_em, stock_hk_main_board_spot_em, stock_hk_hist, stock_us_spot_em, stock_us_hist, stock_zh_a_hist_min_em, stock_zh_a_hist_pre_min_em, stock_hk_hist_min_em, stock_us_hist_min_em, ) """ 中行人民币牌价历史数据查询 """ from akshare.currency.currency_china_bank_sina import currency_boc_sina """ 期货持仓 """ from akshare.futures_derivative.futures_cot_sina import futures_hold_pos_sina """ 股东户数 """ from akshare.stock_feature.stock_gdhs import ( stock_zh_a_gdhs, stock_zh_a_gdhs_detail_em, ) """ 两网及退市 """ from akshare.stock.stock_stop import stock_staq_net_stop """ 涨停板行情 """ from akshare.stock_feature.stock_ztb_em import ( stock_zt_pool_em, stock_zt_pool_previous_em, stock_zt_pool_dtgc_em, stock_zt_pool_zbgc_em, stock_zt_pool_strong_em, stock_zt_pool_sub_new_em, ) """ 中国-香港-宏观 """ from akshare.economic.macro_china_hk import ( macro_china_hk_cpi, macro_china_hk_cpi_ratio, macro_china_hk_trade_diff_ratio, macro_china_hk_gbp_ratio, macro_china_hk_building_amount, macro_china_hk_building_volume, macro_china_hk_gbp, macro_china_hk_ppi, macro_china_hk_rate_of_unemployment, ) """ 增发和配股 """ from akshare.stock_feature.stock_zf_pg import stock_qbzf_em, stock_pg_em """ 汽车销量 """ from akshare.other.other_car_gasgoo import car_sale_rank_gasgoo from akshare.other.other_car_cpca import ( car_market_cate_cpca, car_market_fuel_cpca, car_market_segment_cpca, car_market_country_cpca, car_market_man_rank_cpca, car_market_total_cpca, ) """ 中国公路物流运价、运量指数 """ from akshare.index.index_cflp import index_price_cflp, index_volume_cflp """ 赚钱效应分析 """ from akshare.stock_feature.stock_market_legu import stock_market_activity_legu """ 浙江省排污权交易指数 """ from akshare.index.index_eri import index_eri """ Drewry 集装箱指数 """ from akshare.index.index_drewry import drewry_wci_index """ 柯桥指数 """ from akshare.index.index_kq_fz import index_kq_fz from akshare.index.index_kq_ss import index_kq_fashion """ 新发基金 """ from akshare.fund.fund_init_em import fund_new_found_em from akshare.fund.fund_init_ths import fund_new_found_ths """ 高管持股 """ from akshare.stock_feature.stock_gdzjc_em import stock_ggcg_em """ 同花顺-数据中心-资金流向-概念资金流 """ from akshare.stock_feature.stock_fund_flow import ( stock_fund_flow_concept, stock_fund_flow_industry, stock_fund_flow_big_deal, stock_fund_flow_individual, ) """ 比特币持仓 """ from akshare.crypto.crypto_hold import crypto_bitcoin_hold_report """ 证券交易营业部排行 """ from akshare.stock_feature.stock_lh_yybpm import ( stock_lh_yyb_capital, stock_lh_yyb_most, stock_lh_yyb_control, ) """ 沪深 A 股公告 """ from akshare.stock_fundamental.stock_notice import stock_notice_report """ 首发企业申报 """ from akshare.stock_fundamental.stock_ipo_declare import stock_ipo_declare_em """ 辅导备案信息 """ from akshare.stock_fundamental.stock_ipo_tutor import stock_ipo_tutor_em """ 三大报表 """ from akshare.stock_feature.stock_report_em import ( stock_zcfz_em, stock_zcfz_bj_em, stock_lrb_em, stock_xjll_em, ) """ 业绩报告 """ from akshare.stock_feature.stock_yjbb_em import stock_yjbb_em """ 同花顺-概念板块 """ from akshare.stock_feature.stock_board_concept_ths import ( stock_board_concept_info_ths, stock_board_concept_summary_ths, stock_board_concept_index_ths, stock_board_concept_name_ths, ) """ 同花顺-行业板块 """ from akshare.stock_feature.stock_board_industry_ths import ( stock_board_industry_name_ths, stock_board_industry_info_ths, stock_board_industry_index_ths, stock_ipo_benefit_ths, stock_xgsr_ths, ) """ 分红配送 """ from akshare.stock_feature.stock_fhps_em import stock_fhps_em, stock_fhps_detail_em """ 中美国债收益率 """ from akshare.bond.bond_em import bond_zh_us_rate """ 盈利预测 """ from akshare.stock_fundamental.stock_profit_forecast_em import ( stock_profit_forecast_em, ) """ 基金经理 """ from akshare.fund.fund_manager import fund_manager_em """ 基金评级 """ from akshare.fund.fund_rating import ( fund_rating_sh, fund_rating_zs, fund_rating_ja, fund_rating_all, ) """ 融资融券数据 """ from akshare.stock_feature.stock_margin_sse import ( stock_margin_detail_sse, stock_margin_sse, stock_margin_ratio_pa, ) """ 期货交割和期转现 """ from akshare.futures.futures_to_spot import ( futures_to_spot_czce, futures_to_spot_shfe, futures_to_spot_dce, futures_delivery_dce, futures_delivery_shfe, futures_delivery_czce, futures_delivery_match_dce, futures_delivery_match_czce, ) """ 基金持仓 """ from akshare.fund.fund_portfolio_em import ( fund_portfolio_hold_em, fund_portfolio_change_em, fund_portfolio_bond_hold_em, fund_portfolio_industry_allocation_em, ) """ 债券概览 """ from akshare.bond.bond_summary import ( bond_deal_summary_sse, bond_cash_summary_sse, ) """ 新闻-个股新闻 """ from akshare.news.news_stock import stock_news_em """ 股票数据-一致行动人 """ from akshare.stock_feature.stock_yzxdr_em import stock_yzxdr_em """ 大宗交易 """ from akshare.stock.stock_dzjy_em import ( stock_dzjy_sctj, stock_dzjy_mrmx, stock_dzjy_mrtj, stock_dzjy_hygtj, stock_dzjy_yybph, stock_dzjy_hyyybtj, ) """ 国证指数 """ from akshare.index.index_cni import ( index_hist_cni, index_all_cni, index_detail_cni, index_detail_hist_cni, index_detail_hist_adjust_cni, ) """ 东方财富-期权 """ from akshare.option.option_em import option_current_em """ 科创板报告 """ from akshare.stock.stock_zh_kcb_report import stock_zh_kcb_report_em """ 期货合约详情 """ from akshare.futures.futures_contract_detail import futures_contract_detail, futures_contract_detail_em """ 胡润排行榜 """ from akshare.fortune.fortune_hurun import hurun_rank """ 新财富富豪榜 """ from akshare.fortune.fortune_xincaifu_500 import xincaifu_rank """ 福布斯中国榜单 """ from akshare.fortune.fortune_forbes_500 import forbes_rank """ 回购定盘利率 """ from akshare.rate.repo_rate import repo_rate_hist, repo_rate_query """ 公募基金排行 """ from akshare.fund.fund_rank_em import ( fund_exchange_rank_em, fund_money_rank_em, fund_open_fund_rank_em, fund_hk_rank_em, fund_lcx_rank_em, ) """ 电影票房 """ from akshare.movie.movie_yien import ( movie_boxoffice_cinema_daily, movie_boxoffice_cinema_weekly, movie_boxoffice_weekly, movie_boxoffice_daily, movie_boxoffice_monthly, movie_boxoffice_realtime, movie_boxoffice_yearly, movie_boxoffice_yearly_first_week, ) """ 新闻联播文字稿 """ from akshare.news.news_cctv import news_cctv """ 债券收盘收益率曲线历史数据 """ from akshare.bond.bond_china_money import ( bond_china_close_return, macro_china_bond_public, macro_china_swap_rate, bond_china_close_return_map, ) """ COMEX黄金-白银库存 """ from akshare.futures.futures_comex_em import futures_comex_inventory """ A 股-特别标的 """ from akshare.stock.stock_zh_a_special import ( stock_zh_a_new, stock_zh_a_st_em, stock_zh_a_new_em, stock_zh_a_stop_em, ) """ 东方财富-注册制审核 """ from akshare.stock_fundamental.stock_register_em import ( stock_register_all_em, stock_register_kcb, stock_register_cyb, stock_register_bj, stock_register_db, stock_register_sh, stock_register_sz ) """ 东方财富-过会企业信息 """ from akshare.stock_fundamental.stock_ipo_review import stock_ipo_review_em """ 同花顺-新股申购与中签 """ from akshare.stock_fundamental.stock_ipo_ths import ( stock_ipo_ths, stock_ipo_hk_ths, ) """ 新浪财经-龙虎榜 """ from akshare.stock_feature.stock_lhb_sina import ( stock_lhb_detail_daily_sina, stock_lhb_ggtj_sina, stock_lhb_jgmx_sina, stock_lhb_jgzz_sina, stock_lhb_yytj_sina, ) """ 中证指数 """ from akshare.index.index_stock_zh_csindex import ( stock_zh_index_hist_csindex, stock_zh_index_value_csindex, ) """ 股票基金持仓数据 """ from akshare.stock.stock_fund_hold import ( stock_report_fund_hold, stock_report_fund_hold_detail, ) """ 期货分钟数据 """ from akshare.futures.futures_zh_sina import ( futures_zh_minute_sina, futures_zh_daily_sina, futures_zh_realtime, futures_symbol_mark, match_main_contract, futures_zh_spot, ) """ 股票财务报告预约披露 """ from akshare.stock_feature.stock_yjyg_cninfo import stock_report_disclosure """ 基金行情 """ from akshare.fund.fund_etf_sina import ( fund_etf_hist_sina, fund_etf_category_sina, fund_etf_dividend_sina, ) """ 交易日历 """ from akshare.tool.trade_date_hist import tool_trade_date_hist_sina """ commodity option """ from akshare.option.option_commodity_sina import ( option_commodity_contract_table_sina, option_commodity_contract_sina, option_commodity_hist_sina, ) """ A 股PE和PB """ from akshare.stock_feature.stock_a_pe_and_pb import ( stock_market_pb_lg, stock_index_pb_lg, stock_market_pe_lg, stock_index_pe_lg, ) from akshare.stock_feature.stock_a_indicator import ( stock_hk_indicator_eniu, ) from akshare.stock_feature.stock_a_high_low import stock_a_high_low_statistics from akshare.stock_feature.stock_a_below_net_asset_statistics import ( stock_a_below_net_asset_statistics, ) """ 彭博亿万富豪指数 """ from akshare.fortune.fortune_bloomberg import ( index_bloomberg_billionaires, index_bloomberg_billionaires_hist, ) """ stock-券商业绩月报 """ from akshare.stock_feature.stock_qsjy_em import stock_qsjy_em """ futures-warehouse-receipt """ from akshare.futures.futures_warehouse_receipt import ( futures_warehouse_receipt_czce, futures_warehouse_receipt_dce, futures_shfe_warehouse_receipt, futures_gfex_warehouse_receipt, ) """ stock-js """ from akshare.stock.stock_us_js import stock_price_js """ stock-summary """ from akshare.stock.stock_summary import ( stock_sse_summary, stock_szse_summary, stock_sse_deal_daily, stock_szse_area_summary, stock_szse_sector_summary, ) """ 股票-机构推荐池 """ from akshare.stock_fundamental.stock_recommend import ( stock_institute_recommend, stock_institute_recommend_detail, ) """ 股票-机构持股 """ from akshare.stock_fundamental.stock_hold import ( stock_institute_hold_detail, stock_institute_hold, ) """ stock-info """ from akshare.stock.stock_info import ( stock_info_sh_delist, stock_info_sz_delist, stock_info_a_code_name, stock_info_sh_name_code, stock_info_bj_name_code, stock_info_sz_name_code, stock_info_sz_change_name, stock_info_change_name, ) """ stock-sector """ from akshare.stock.stock_industry import stock_sector_spot, stock_sector_detail """ stock-fundamental """ from akshare.stock_fundamental.stock_finance_sina import ( stock_financial_abstract, stock_financial_report_sina, stock_financial_analysis_indicator, stock_add_stock, stock_ipo_info, stock_history_dividend_detail, stock_history_dividend, stock_circulate_stock_holder, stock_restricted_release_queue_sina, stock_fund_stock_holder, stock_main_stock_holder, ) """ stock-HK-fundamental """ from akshare.stock_fundamental.stock_finance_hk_em import ( stock_financial_hk_analysis_indicator_em, stock_financial_hk_report_em, ) """ stock_fund """ from akshare.stock.stock_fund_em import ( stock_individual_fund_flow, stock_market_fund_flow, stock_sector_fund_flow_rank, stock_individual_fund_flow_rank, stock_sector_fund_flow_summary, stock_sector_fund_flow_hist, stock_concept_fund_flow_hist, stock_main_fund_flow, ) """ air-quality """ from akshare.air.air_zhenqi import ( air_quality_hist, air_quality_rank, air_quality_watch_point, air_city_table, ) """ hf """ from akshare.hf.hf_sp500 import hf_sp_500 """ stock_yjyg_em """ from akshare.stock_feature.stock_yjyg_em import ( stock_yjyg_em, stock_yysj_em, stock_yjkb_em, ) """ stock """ from akshare.stock_feature.stock_dxsyl_em import ( stock_dxsyl_em, stock_xgsglb_em, ) """ article """ from akshare.article.fred_md import fred_md, fred_qd """ 中证商品指数 """ from akshare.futures.futures_index_ccidx import futures_index_ccidx """ futures_em_spot_stock """ from akshare.futures.futures_spot_stock_em import futures_spot_stock """ energy_oil """ from akshare.energy.energy_oil_em import energy_oil_detail, energy_oil_hist """ futures-foreign """ from akshare.futures.futures_foreign import ( futures_foreign_detail, futures_foreign_hist, ) """ stock-em-tfp """ from akshare.stock_feature.stock_tfp_em import stock_tfp_em """ stock-em-hsgt """ from akshare.stock_feature.stock_hsgt_em import ( stock_hk_ggt_components_em, stock_hsgt_hold_stock_em, stock_hsgt_hist_em, stock_hsgt_institution_statistics_em, stock_hsgt_stock_statistics_em, stock_hsgt_board_rank_em, ) """ stock-em-comment """ from akshare.stock_feature.stock_comment_em import ( stock_comment_em, stock_comment_detail_zlkp_jgcyd_em, stock_comment_detail_scrd_focus_em, stock_comment_detail_zhpj_lspf_em, stock_comment_detail_scrd_desire_em, ) """ stock-em-analyst """ from akshare.stock_feature.stock_analyst_em import ( stock_analyst_detail_em, stock_analyst_rank_em, ) """ 新加坡期货交易所 """ from akshare.futures.futures_settlement_price_sgx import futures_settlement_price_sgx """ currency interface """ from akshare.currency.currency import ( currency_convert, currency_currencies, currency_history, currency_latest, currency_time_series, ) """ 知识图谱 """ from akshare.nlp.nlp_interface import nlp_ownthink, nlp_answer """ 微博舆情报告 """ from akshare.stock.stock_weibo_nlp import ( stock_js_weibo_nlp_time, stock_js_weibo_report, ) """ 金融期权-新浪 """ from akshare.option.option_finance_sina import ( option_cffex_sz50_list_sina, option_cffex_sz50_spot_sina, option_cffex_sz50_daily_sina, option_cffex_hs300_list_sina, option_cffex_hs300_spot_sina, option_cffex_hs300_daily_sina, option_cffex_zz1000_list_sina, option_cffex_zz1000_spot_sina, option_cffex_zz1000_daily_sina, option_sse_list_sina, option_sse_expire_day_sina, option_sse_codes_sina, option_sse_spot_price_sina, option_sse_underlying_spot_price_sina, option_sse_greeks_sina, option_sse_minute_sina, option_sse_daily_sina, option_finance_minute_sina, option_minute_em, ) """ 债券-沪深债券 """ from akshare.bond.bond_zh_sina import bond_zh_hs_daily, bond_zh_hs_spot from akshare.bond.bond_zh_cov import ( bond_zh_hs_cov_daily, bond_zh_hs_cov_spot, bond_cov_comparison, bond_zh_cov, bond_zh_cov_info, bond_zh_hs_cov_min, bond_zh_hs_cov_pre_min, bond_zh_cov_value_analysis, ) from akshare.bond.bond_convert import ( bond_cb_jsl, bond_cb_adj_logs_jsl, bond_cb_index_jsl, bond_cb_redeem_jsl, ) """ 基金数据接口 """ from akshare.fund.fund_em import ( fund_open_fund_daily_em, fund_open_fund_info_em, fund_etf_fund_daily_em, fund_etf_fund_info_em, fund_financial_fund_daily_em, fund_financial_fund_info_em, fund_name_em, fund_info_index_em, fund_graded_fund_daily_em, fund_graded_fund_info_em, fund_money_fund_daily_em, fund_money_fund_info_em, fund_value_estimation_em, fund_hk_fund_hist_em, fund_purchase_em, ) """ 百度迁徙地图接口 """ from akshare.event.migration import ( migration_area_baidu, migration_scale_baidu, ) """ 英为财情-外汇-货币对历史数据 """ from akshare.fx.currency_investing import ( currency_pair_map, ) """ 商品期权-郑州商品交易所-期权-历史数据 """ from akshare.option.option_czce import option_hist_yearly_czce """ 宏观-经济数据-银行间拆借利率 """ from akshare.interest_rate.interbank_rate_em import rate_interbank """ 金十数据中心-外汇情绪 """ from akshare.economic.macro_other import macro_fx_sentiment """ 金十数据中心-经济指标-欧元区 """ from akshare.economic.macro_euro import ( macro_euro_gdp_yoy, macro_euro_cpi_mom, macro_euro_cpi_yoy, macro_euro_current_account_mom, macro_euro_employment_change_qoq, macro_euro_industrial_production_mom, macro_euro_manufacturing_pmi, macro_euro_ppi_mom, macro_euro_retail_sales_mom, macro_euro_sentix_investor_confidence, macro_euro_services_pmi, macro_euro_trade_balance, macro_euro_unemployment_rate_mom, macro_euro_zew_economic_sentiment, macro_euro_lme_holding, macro_euro_lme_stock, ) """ 金十数据中心-经济指标-央行利率-主要央行利率 """ from akshare.economic.macro_bank import ( macro_bank_australia_interest_rate, macro_bank_brazil_interest_rate, macro_bank_brazil_interest_rate, macro_bank_china_interest_rate, macro_bank_english_interest_rate, macro_bank_euro_interest_rate, macro_bank_india_interest_rate, macro_bank_japan_interest_rate, macro_bank_newzealand_interest_rate, macro_bank_russia_interest_rate, macro_bank_switzerland_interest_rate, macro_bank_usa_interest_rate, ) """ 义乌小商品指数 """ from akshare.index.index_yw import index_yw """ 股票指数-股票指数-中证指数列表 """ from akshare.index.index_csindex import index_csindex_all """ 股票指数-股票指数-成份股 """ from akshare.index.index_cons import ( index_stock_info, index_stock_cons, index_stock_cons_sina, index_stock_cons_csindex, index_stock_cons_weight_csindex, stock_a_code_to_symbol, ) """ 东方财富-股票账户 """ from akshare.stock_feature.stock_account_em import stock_account_statistics_em """ 期货规则 """ from akshare.futures.futures_rule import futures_rule """ 东方财富-商誉专题 """ from akshare.stock_feature.stock_sy_em import ( stock_sy_profile_em, stock_sy_yq_em, stock_sy_jz_em, stock_sy_em, stock_sy_hy_em, ) """ 东方财富-股票质押 """ from akshare.stock_feature.stock_gpzy_em import ( stock_gpzy_pledge_ratio_em, stock_gpzy_profile_em, stock_gpzy_distribute_statistics_bank_em, stock_gpzy_distribute_statistics_company_em, stock_gpzy_industry_data_em, stock_gpzy_pledge_ratio_detail_em, stock_gpzy_individual_pledge_ratio_detail_em, ) """ 东方财富-机构调研 """ from akshare.stock_feature.stock_jgdy_em import ( stock_jgdy_tj_em, stock_jgdy_detail_em, ) """ 新浪主力连续接口 """ from akshare.futures_derivative.futures_index_sina import ( futures_main_sina, futures_display_main_sina, ) """ 中国宏观杠杆率数据 """ from akshare.economic.marco_cnbs import macro_cnbs """ 大宗商品-现货价格指数 """ from akshare.index.index_spot import spot_goods """ 能源-碳排放权 """ from akshare.energy.energy_carbon import ( energy_carbon_domestic, energy_carbon_bj, energy_carbon_eu, energy_carbon_gz, energy_carbon_hb, energy_carbon_sz, ) """ 中国证券投资基金业协会-信息公示 """ from akshare.fund.fund_amac import ( amac_manager_info, amac_member_info, amac_member_sub_info, amac_aoin_info, amac_fund_account_info, amac_fund_info, amac_fund_sub_info, amac_futures_info, amac_manager_cancelled_info, amac_securities_info, amac_fund_abs, amac_manager_classify_info, amac_person_fund_org_list, amac_person_bond_org_list, ) """ 申万行业一级 """ from akshare.index.index_sw import ( sw_index_third_cons, sw_index_first_info, sw_index_second_info, sw_index_third_info, ) """ 经济政策不确定性指数 """ from akshare.article.epu_index import article_epu_index """ 空气-河北 """ from akshare.air.air_hebei import air_quality_hebei """ 日出和日落 """ from akshare.air.sunrise_tad import sunrise_daily, sunrise_monthly """ 新浪-指数实时行情和历史行情 """ from akshare.stock.stock_zh_a_tick_tx import ( stock_zh_a_tick_tx_js, ) """ 新浪-指数实时行情和历史行情 """ from akshare.index.index_stock_zh import ( stock_zh_index_daily, stock_zh_index_spot_sina, stock_zh_index_spot_em, stock_zh_index_daily_tx, stock_zh_index_daily_em, ) """ 外盘期货实时行情 """ from akshare.futures.futures_hq_sina import ( futures_foreign_commodity_realtime, futures_foreign_commodity_subscribe_exchange_symbol, futures_hq_subscribe_exchange_symbol, ) """ FF多因子数据接口 """ from akshare.article.ff_factor import article_ff_crr """ Realized Library 接口 """ from akshare.article.risk_rv import ( article_oman_rv, article_oman_rv_short, article_rlab_rv, ) """ 银保监分局本级行政处罚数据 """ from akshare.bank.bank_cbirc_2020 import bank_fjcf_table_detail """ 科创板股票 """ from akshare.stock.stock_zh_kcb_sina import ( stock_zh_kcb_spot, stock_zh_kcb_daily, ) """ A股 """ from akshare.stock.stock_zh_a_sina import ( stock_zh_a_spot, stock_zh_a_daily, stock_zh_a_minute, stock_zh_a_cdr_daily, ) """ A+H股 """ from akshare.stock.stock_zh_ah_tx import ( stock_zh_ah_spot, stock_zh_ah_daily, stock_zh_ah_name, ) """ 加密货币 """ from akshare.economic.macro_other import crypto_js_spot """ 金融期权 """ from akshare.option.option_finance import ( option_finance_board, option_finance_sse_underlying, ) """ 新浪-美股实时行情数据和历史行情数据(前复权) """ from akshare.stock.stock_us_sina import ( stock_us_daily, stock_us_spot, get_us_stock_name, ) """ 新浪-港股实时行情数据和历史数据(前复权和后复权因子) """ from akshare.stock.stock_hk_sina import stock_hk_daily, stock_hk_spot """ 生意社-商品与期货-现期图数据 """ from akshare.futures_derivative.futures_spot_sys import futures_spot_sys """ 全球宏观-机构宏观 """ from akshare.economic.macro_constitute import ( macro_cons_gold, macro_cons_silver, macro_cons_opec_month, ) """ 全球宏观-美国宏观 """ from akshare.economic.macro_usa import ( macro_usa_eia_crude_rate, macro_usa_non_farm, macro_usa_unemployment_rate, macro_usa_adp_employment, macro_usa_core_pce_price, macro_usa_cpi_monthly, macro_usa_cpi_yoy, macro_usa_crude_inner, macro_usa_gdp_monthly, macro_usa_initial_jobless, macro_usa_lmci, macro_usa_api_crude_stock, macro_usa_building_permits, macro_usa_business_inventories, macro_usa_cb_consumer_confidence, macro_usa_core_cpi_monthly, macro_usa_core_ppi, macro_usa_current_account, macro_usa_durable_goods_orders, macro_usa_trade_balance, macro_usa_spcs20, macro_usa_services_pmi, macro_usa_rig_count, macro_usa_retail_sales, macro_usa_real_consumer_spending, macro_usa_ppi, macro_usa_pmi, macro_usa_personal_spending, macro_usa_pending_home_sales, macro_usa_nfib_small_business, macro_usa_new_home_sales, macro_usa_nahb_house_market_index, macro_usa_michigan_consumer_sentiment, macro_usa_exist_home_sales, macro_usa_export_price, macro_usa_factory_orders, macro_usa_house_price_index, macro_usa_house_starts, macro_usa_import_price, macro_usa_industrial_production, macro_usa_ism_non_pmi, macro_usa_ism_pmi, macro_usa_job_cuts, macro_usa_cftc_nc_holding, macro_usa_cftc_c_holding, macro_usa_cftc_merchant_currency_holding, macro_usa_cftc_merchant_goods_holding, macro_usa_cme_merchant_goods_holding, macro_usa_phs, ) """ 全球宏观-中国宏观 """ from akshare.economic.macro_china import ( macro_china_bank_financing, macro_china_insurance_income, macro_china_mobile_number, macro_china_vegetable_basket, macro_china_agricultural_product, macro_china_agricultural_index, macro_china_energy_index, macro_china_commodity_price_index, macro_global_sox_index, macro_china_yw_electronic_index, macro_china_construction_index, macro_china_construction_price_index, macro_china_lpi_index, macro_china_bdti_index, macro_china_bsi_index, macro_china_cpi_monthly, macro_china_cpi_yearly, macro_china_m2_yearly, macro_china_fx_reserves_yearly, macro_china_cx_pmi_yearly, macro_china_pmi_yearly, macro_china_daily_energy, macro_china_non_man_pmi, macro_china_rmb, macro_china_gdp_yearly, macro_china_shrzgm, macro_china_ppi_yearly, macro_china_cx_services_pmi_yearly, macro_china_market_margin_sh, macro_china_market_margin_sz, macro_china_au_report, macro_china_exports_yoy, macro_china_hk_market_info, macro_china_imports_yoy, macro_china_trade_balance, macro_china_shibor_all, macro_china_industrial_production_yoy, macro_china_gyzjz, macro_china_lpr, macro_china_new_house_price, macro_china_enterprise_boom_index, macro_china_national_tax_receipts, macro_china_new_financial_credit, macro_china_fx_gold, macro_china_money_supply, macro_china_stock_market_cap, macro_china_cpi, macro_china_gdp, macro_china_ppi, macro_china_pmi, macro_china_gdzctz, macro_china_hgjck, macro_china_czsr, macro_china_whxd, macro_china_wbck, macro_china_xfzxx, macro_china_reserve_requirement_ratio, macro_china_consumer_goods_retail, macro_china_society_electricity, macro_china_society_traffic_volume, macro_china_postal_telecommunicational, macro_china_international_tourism_fx, macro_china_passenger_load_factor, macro_china_freight_index, macro_china_central_bank_balance, macro_china_insurance, macro_china_supply_of_money, macro_china_foreign_exchange_gold, macro_china_retail_price_index, macro_china_real_estate, macro_china_qyspjg, macro_china_fdi, macro_shipping_bci, macro_shipping_bcti, macro_shipping_bdi, macro_shipping_bpi, macro_china_urban_unemployment, ) """ 全球宏观-中国宏观-国家统计局 """ from akshare.economic.macro_china_nbs import ( macro_china_nbs_nation, macro_china_nbs_region ) """ 外汇 """ from akshare.fx.fx_quote import fx_pair_quote, fx_spot_quote, fx_swap_quote """ 债券行情 """ from akshare.bond.bond_china import ( bond_spot_quote, bond_spot_deal, bond_china_yield, ) """ 商品期权 """ from akshare.option.option_commodity import ( option_hist_dce, option_hist_czce, option_hist_shfe, option_vol_gfex, option_hist_gfex, option_vol_shfe, ) """ 99期货-期货库存数据 """ from akshare.futures.futures_inventory_99 import futures_inventory_99 """ 东方财富-期货库存数据 """ from akshare.futures.futures_inventory_em import futures_inventory_em """ 中国银行间市场交易商协会 """ from akshare.bond.bond_nafmii import bond_debt_nafmii """ 奇货可查-工具模块 """ from akshare.qhkc_web.qhkc_tool import qhkc_tool_foreign, qhkc_tool_gdp """ 奇货可查-指数模块 """ from akshare.qhkc_web.qhkc_index import ( get_qhkc_index, get_qhkc_index_trend, get_qhkc_index_profit_loss, ) """ 奇货可查-资金模块 """ from akshare.qhkc_web.qhkc_fund import ( get_qhkc_fund_money_change, get_qhkc_fund_bs, get_qhkc_fund_position, ) """ 大宗商品现货价格及基差 """ from akshare.futures.futures_basis import ( futures_spot_price_daily, futures_spot_price, futures_spot_price_previous, ) """ 期货持仓成交排名数据 """ from akshare.futures.cot import ( get_rank_sum_daily, get_rank_sum, get_shfe_rank_table, get_rank_table_czce, get_dce_rank_table, get_cffex_rank_table, futures_dce_position_rank, futures_dce_position_rank_other, futures_gfex_position_rank, ) """ 大宗商品期货仓单数据 """ from akshare.futures.receipt import get_receipt """ 大宗商品期货展期收益率数据 """ from akshare.futures.futures_roll_yield import ( get_roll_yield_bar, get_roll_yield, ) """ 交易所日线行情数据 """ from akshare.futures.futures_daily_bar import ( get_cffex_daily, get_czce_daily, get_shfe_daily, get_dce_daily, get_futures_daily, get_ine_daily, get_gfex_daily, ) """ 雪球基金数据 """ from akshare.fund.fund_xq import ( fund_individual_basic_info_xq, fund_individual_achievement_xq, fund_individual_analysis_xq, fund_individual_profit_probability_xq, fund_individual_detail_info_xq, fund_individual_detail_hold_xq, ) """ 异常处理模块 """ from .exceptions import ( AkshareException, APIError, DataParsingError, InvalidParameterError, NetworkError, RateLimitError, ) """ Pro API 设置 """ from akshare.pro.data_pro import pro_api from akshare.utils.token_process import set_token, get_token """ AKQMT 设置 """ try: from akqmt import xt_api except ImportError as e: pass ================================================ FILE: akshare/_version.py ================================================ __version__ = "1.18.50" ================================================ FILE: akshare/air/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/9/30 13:58 Desc: """ ================================================ FILE: akshare/air/air_hebei.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/25 17:20 Desc: 河北省空气质量预报信息发布系统 https://110.249.223.67/publish 每日 17 时发布 等级划分 1. 空气污染指数为0-50,空气质量级别为一级,空气质量状况属于优。此时,空气质量令人满意,基本无空气污染,各类人群可正常活动。 2. 空气污染指数为51-100,空气质量级别为二级,空气质量状况属于良。此时空气质量可接受,但某些污染物可能对极少数异常敏感人群健康有较弱影响,建议极少数异常敏感人群应减少户外活动。 3. 空气污染指数为101-150,空气质量级别为三级,空气质量状况属于轻度污染。此时,易感人群症状有轻度加剧,健康人群出现刺激症状。建议儿童、老年人及心脏病、呼吸系统疾病患者应减少长时间、高强度的户外锻炼。 4. 空气污染指数为151-200,空气质量级别为四级,空气质量状况属于中度污染。此时,进一步加剧易感人群症状,可能对健康人群心脏、呼吸系统有影响,建议疾病患者避免长时间、高强度的户外锻练,一般人群适量减少户外运动。 5. 空气污染指数为201-300,空气质量级别为五级,空气质量状况属于重度污染。此时,心脏病和肺病患者症状显著加剧,运动耐受力降低,健康人群普遍出现症状,建议儿童、老年人和心脏病、肺病患者应停留在室内,停止户外运动,一般人群减少户外运动。 6. 空气污染指数大于300,空气质量级别为六级,空气质量状况属于严重污染。此时,健康人群运动耐受力降低,有明显强烈症状,提前出现某些疾病,建议儿童、老年人和病人应当留在室内,避免体力消耗,一般人群应避免户外活动。 发布单位:河北省环境应急与重污染天气预警中心 技术支持:中国科学院大气物理研究所 中科三清科技有限公司 """ import pandas as pd import requests from bs4 import BeautifulSoup def air_quality_hebei() -> pd.DataFrame: """ 河北省空气质量预报信息发布系统-空气质量预报, 未来 6 天 http://218.11.10.130:8080/#/application/home :return: city = "", 返回所有地区的数据; city="唐山市", 返回唐山市的数据 :rtype: pandas.DataFrame """ url = "http://218.11.10.130:8080/api/hour/130000.xml" r = requests.get(url) soup = BeautifulSoup(r.content, features="xml") data = [] cities = soup.find_all("City") for city in cities: pointers = city.find_all("Pointer") for pointer in pointers: row = { "City": city.Name.text if city.Name else None, "Region": pointer.Region.text if pointer.Region else None, "Station": pointer.Name.text if pointer.Name else None, "DateTime": pointer.DataTime.text if pointer.DataTime else None, "AQI": pointer.AQI.text if pointer.AQI else None, "Level": pointer.Level.text if pointer.Level else None, "MaxPoll": pointer.MaxPoll.text if pointer.MaxPoll else None, "Longitude": pointer.CLng.text if pointer.CLng else None, "Latitude": pointer.CLat.text if pointer.CLat else None, } polls = pointer.find_all("Poll") for poll in polls: poll_name = poll.Name.text if poll.Name else None poll_value = poll.Value.text if poll.Value else None row[f"{poll_name}_Value"] = poll_value row[f"{poll_name}_IAQI"] = poll.IAQI.text if poll.IAQI else None data.append(row) df = pd.DataFrame(data) numeric_columns = ["AQI", "Longitude", "Latitude"] + [ col for col in df.columns if col.endswith("_Value") or col.endswith("_IAQI") ] for col in numeric_columns: df[col] = pd.to_numeric(df[col], errors="coerce") column_names = { "City": "城市", "Region": "区域", "Station": "监测点", "DateTime": "时间", "Level": "空气质量等级", "MaxPoll": "首要污染物", "Longitude": "经度", "Latitude": "纬度", "SO2_Value": "二氧化硫_浓度", "SO2_IAQI": "二氧化硫_IAQI", "CO_Value": "一氧化碳_浓度", "CO_IAQI": "一氧化碳_IAQI", "NO2_Value": "二氧化氮_浓度", "NO2_IAQI": "二氧化氮_IAQI", "O3-1H_Value": "臭氧1小时_浓度", "O3-1H_IAQI": "臭氧1小时_IAQI", "O3-8H_Value": "臭氧8小时_浓度", "O3-8H_IAQI": "臭氧8小时_IAQI", "PM2.5_Value": "PM2.5_浓度", "PM2.5_IAQI": "PM2.5_IAQI", "PM10_Value": "PM10_浓度", "PM10_IAQI": "PM10_IAQI", } df = df.rename(columns=column_names) basic_columns = [ "城市", "区域", "监测点", "时间", "AQI", "空气质量等级", "首要污染物", "经度", "纬度", ] pollutant_columns = [col for col in df.columns if col not in basic_columns] df = df[basic_columns + sorted(pollutant_columns)] return df if __name__ == "__main__": air_quality_hebei_df = air_quality_hebei() print(air_quality_hebei_df) ================================================ FILE: akshare/air/air_zhenqi.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/2 22:40 Desc: 真气网-空气质量 https://www.zq12369.com/environment.php 空气质量在线监测分析平台的空气质量数据 https://www.aqistudy.cn/ """ import json import os import re from io import StringIO import pandas as pd import requests from py_mini_racer import MiniRacer from akshare.utils import demjson def _get_js_path(name: str = None, module_file: str = None) -> str: """ 获取 JS 文件的路径(从模块所在目录查找) :param name: 文件名 :type name: str :param module_file: 模块路径 :type module_file: str :return: 路径 :rtype: str """ module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file))) module_json_path = os.path.join(module_folder, "air", name) return module_json_path def _get_file_content(file_name: str = "crypto.js") -> str: """ 获取 JS 文件的内容 :param file_name: JS 文件名 :type file_name: str :return: 文件内容 :rtype: str """ setting_file_name = file_name setting_file_path = _get_js_path(setting_file_name, __file__) with open(setting_file_path) as f: file_data = f.read() return file_data def has_month_data(href): """ Deal with href node :param href: href :type href: str :return: href result :rtype: str """ return href and re.compile("monthdata.php").search(href) def air_city_table() -> pd.DataFrame: """ 真气网-空气质量历史数据查询-全部城市列表 https://www.zq12369.com/environment.php?date=2019-06-05&tab=rank&order=DESC&type=DAY#rank :return: 城市映射 :rtype: pandas.DataFrame """ url = "https://www.zq12369.com/environment.php" date = "2020-05-01" temp_df = None if len(date.split("-")) == 3: params = { "date": date, "tab": "rank", "order": "DESC", "type": "DAY", } r = requests.get(url, params=params) temp_df = pd.read_html(StringIO(r.text))[1].iloc[1:, :] del temp_df["降序"] temp_df.reset_index(inplace=True) temp_df["index"] = temp_df.index + 1 temp_df.columns = [ "序号", "省份", "城市", "AQI", "空气质量", "PM2.5浓度", "首要污染物", ] temp_df["AQI"] = pd.to_numeric(temp_df["AQI"]) return temp_df def air_quality_watch_point( city: str = "杭州", start_date: str = "20220408", end_date: str = "20220409" ) -> pd.DataFrame: """ 真气网-监测点空气质量-细化到具体城市的每个监测点 指定之间段之间的空气质量数据 https://www.zq12369.com/ :param city: 调用 ak.air_city_table() 接口获取 :type city: str :param start_date: e.g., "20190327" :type start_date: str :param end_date: e.g., ""20200327"" :type end_date: str :return: 指定城市指定日期区间的观测点空气质量 :rtype: pandas.DataFrame """ start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]]) end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]]) url = "https://www.zq12369.com/api/zhenqiapi.php" file_data = _get_file_content(file_name="crypto.js") ctx = MiniRacer() ctx.eval(file_data) method = "GETCITYPOINTAVG" city_param = ctx.call("encode_param", city) payload = { "appId": "a01901d3caba1f362d69474674ce477f", "method": ctx.call("encode_param", method), "city": city_param, "startTime": ctx.call("encode_param", start_date), "endTime": ctx.call("encode_param", end_date), "secret": ctx.call("encode_secret", method, city_param, start_date, end_date), } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.122 Safari/537.36" } r = requests.post(url, data=payload, headers=headers) data_text = r.text data_json = demjson.decode(ctx.call("decode_result", data_text)) temp_df = pd.DataFrame(data_json["rows"]) return temp_df def air_quality_hist( city: str = "杭州", period: str = "day", start_date: str = "20190327", end_date: str = "20200427", ) -> pd.DataFrame: """ 真气网-空气历史数据 https://www.zq12369.com/ :param city: 调用 ak.air_city_table() 接口获取所有城市列表 :type city: str :param period: "hour": 每小时一个数据, 由于数据量比较大, 下载较慢; "day": 每天一个数据; "month": 每个月一个数据 :type period: str :param start_date: e.g., "20190327" :type start_date: str :param end_date: e.g., "20200327" :type end_date: str :return: 指定城市和数据频率下在指定时间段内的空气质量数据 :rtype: pandas.DataFrame """ start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]]) end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]]) url = "https://www.zq12369.com/api/newzhenqiapi.php" file_data = _get_file_content(file_name="outcrypto.js") ctx = MiniRacer() ctx.eval(file_data) app_id = "4f0e3a273d547ce6b7147bfa7ceb4b6e" method = "CETCITYPERIOD" timestamp = ctx.eval("timestamp = new Date().getTime()") p_text = json.dumps( { "city": city, "endTime": f"{end_date} 23:45:39", "startTime": f"{start_date} 00:00:00", "type": period.upper(), }, ensure_ascii=False, indent=None, ).replace(' "', '"') secret = ctx.call("hex_md5", app_id + method + str(timestamp) + "WEB" + p_text) payload = { "appId": "4f0e3a273d547ce6b7147bfa7ceb4b6e", "method": "CETCITYPERIOD", "timestamp": int(timestamp), "clienttype": "WEB", "object": { "city": city, "type": period.upper(), "startTime": f"{start_date} 00:00:00", "endTime": f"{end_date} 23:45:39", }, "secret": secret, } need = ( json.dumps(payload, ensure_ascii=False, indent=None, sort_keys=False) .replace(' "', '"') .replace("\\", "") .replace('p": ', 'p":') .replace('t": ', 't":') ) headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" "Chrome/100.0.4896.75 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = {"param": ctx.call("encode_param", need)} r = requests.post(url, data=params, headers=headers) temp_text = ctx.call("decryptData", r.text) data_json = demjson.decode(ctx.call("b.decode", temp_text)) temp_df = pd.DataFrame(data_json["result"]["data"]["rows"]) temp_df.index = temp_df["time"] del temp_df["time"] temp_df = temp_df.astype(float, errors="ignore") return temp_df def air_quality_rank(date: str = "") -> pd.DataFrame: """ 真气网-168 城市 AQI 排行榜 https://www.zq12369.com/environment.php?date=2020-03-12&tab=rank&order=DESC&type=DAY#rank :param date: "": 当前时刻空气质量排名; "20200312": 当日空气质量排名; "202003": 当月空气质量排名; "2019": 当年空气质量排名; :type date: str :return: 指定 date 类型的空气质量排名数据 :rtype: pandas.DataFrame """ if len(date) == 4: date = date elif len(date) == 6: date = "-".join([date[:4], date[4:6]]) elif date == "": date = "实时" else: date = "-".join([date[:4], date[4:6], date[6:]]) url = "https://www.zq12369.com/environment.php" if len(date.split("-")) == 3: params = { "date": date, "tab": "rank", "order": "DESC", "type": "DAY", } r = requests.get(url, params=params) return pd.read_html(StringIO(r.text))[1].iloc[1:, :] elif len(date.split("-")) == 2: params = { "month": date, "tab": "rank", "order": "DESC", "type": "MONTH", } r = requests.get(url, params=params) return pd.read_html(StringIO(r.text))[2].iloc[1:, :] elif len(date.split("-")) == 1 and date != "实时": params = { "year": date, "tab": "rank", "order": "DESC", "type": "YEAR", } r = requests.get(url, params=params) return pd.read_html(StringIO(r.text))[3].iloc[1:, :] if date == "实时": params = { "tab": "rank", "order": "DESC", "type": "MONTH", } r = requests.get(url, params=params) return pd.read_html(StringIO(r.text))[0].iloc[1:, :] if __name__ == "__main__": air_city_table_df = air_city_table() print(air_city_table_df) air_quality_watch_point_df = air_quality_watch_point( city="杭州", start_date="20220408", end_date="20220409" ) print(air_quality_watch_point_df) air_quality_hist_df = air_quality_hist( city="北京", period="day", start_date="20220801", end_date="20240402", ) print(air_quality_hist_df) air_quality_rank_df = air_quality_rank() print(air_quality_rank_df) ================================================ FILE: akshare/air/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/11/25 20:45 Desc: 空气质量接口配置文件 """ city_chinese_list = [ "北京", "重庆", "福州", "广州", "杭州", "昆明", "南昌", "南京", "南宁", "南通", "宁波", "上海", "深圳", "苏州", "徐州", "银川", ] city_english_list = [ "beijing", "chongqing", "foochow", "guangzhou", "hangzhou", "kunming", "nanchang", "nanjing", "nanning", "nantong", "ningbo", "shanghai", "shenzhen", "suzhou", "xuzhou", "yinchuan", ] city_code_dict = { "北京": "110000", "天津": "120000", "石家庄": "130100", "唐山": "130200", "秦皇岛": "130300", "邯郸": "130400", "邢台": "130500", "保定": "130600", "承德": "130800", "沧州": "130900", "廊坊": "131000", "衡水": "131100", "张家口": "131200", "太原": "140100", "大同": "140200", "阳泉": "140300", "长治": "140400", "晋城": "140500", "朔州": "140600", "晋中": "140700", "运城": "140800", "忻州": "140900", "临汾": "141000", "吕梁": "141100", "呼和浩特": "150100", "包头": "150200", "乌海": "150300", "赤峰": "150400", "通辽": "150500", "鄂尔多斯": "150600", "呼伦贝尔": "150700", "巴彦淖尔": "150800", "乌兰察布": "150900", "兴安盟": "152200", "锡林郭勒盟": "152500", "阿拉善盟": "152900", "沈阳": "210100", "大连": "210200", "瓦房店": "210281", "鞍山": "210300", "抚顺": "210400", "本溪": "210500", "丹东": "210600", "锦州": "210700", "营口": "210800", "阜新": "210900", "辽阳": "211000", "盘锦": "211100", "铁岭": "211200", "朝阳": "211300", "葫芦岛": "211400", "长春": "220100", "吉林": "220200", "四平": "220300", "辽源": "220400", "通化": "220500", "白山": "220600", "松原": "220700", "白城": "220800", "延边州": "222400", "哈尔滨": "230100", "齐齐哈尔": "230200", "鸡西": "230300", "鹤岗": "230400", "双鸭山": "230500", "大庆": "230600", "伊春": "230700", "佳木斯": "230800", "七台河": "230900", "牡丹江": "231000", "黑河": "231100", "绥化": "231200", "大兴安岭地区": "232700", "上海": "310000", "南京": "320100", "无锡": "320200", "江阴": "320281", "宜兴": "320282", "徐州": "320300", "常州": "320400", "溧阳": "320481", "金坛": "320482", "苏州": "320500", "常熟": "320581", "张家港": "320582", "昆山": "320583", "吴江": "320584", "太仓": "320585", "南通": "320600", "海门": "320684", "连云港": "320700", "淮安": "320800", "盐城": "320900", "扬州": "321000", "镇江": "321100", "句容": "321183", "泰州": "321200", "宿迁": "321300", "杭州": "330100", "富阳": "330183", "临安": "330185", "宁波": "330200", "温州": "330300", "嘉兴": "330400", "湖州": "330500", "诸暨": "330681", "金华": "330700", "义乌": "330782", "衢州": "330800", "舟山": "330900", "台州": "331000", "丽水": "331100", "绍兴": "331300", "合肥": "340100", "芜湖": "340200", "蚌埠": "340300", "淮南": "340400", "马鞍山": "340500", "淮北": "340600", "铜陵": "340700", "安庆": "340800", "黄山": "341000", "滁州": "341100", "阜阳": "341200", "宿州": "341300", "六安": "341500", "亳州": "341600", "池州": "341700", "宣城": "341800", "福州": "350100", "厦门": "350200", "莆田": "350300", "三明": "350400", "泉州": "350500", "漳州": "350600", "南平": "350700", "龙岩": "350800", "宁德": "350900", "南昌": "360100", "景德镇": "360200", "萍乡": "360300", "九江": "360400", "新余": "360500", "鹰潭": "360600", "赣州": "360700", "吉安": "360800", "宜春": "360900", "抚州": "361000", "上饶": "361100", "济南": "370100", "章丘": "370181", "青岛": "370200", "胶州": "370281", "即墨": "370282", "平度": "370283", "胶南": "370284", "莱西": "370285", "淄博": "370300", "枣庄": "370400", "东营": "370500", "烟台": "370600", "莱州": "370683", "蓬莱": "370684", "招远": "370685", "潍坊": "370700", "寿光": "370783", "济宁": "370800", "泰安": "370900", "威海": "371000", "文登": "371081", "荣成": "371082", "乳山": "371083", "日照": "371100", "莱芜": "371200", "临沂": "371300", "德州": "371400", "聊城": "371500", "滨州": "371600", "菏泽": "371700", "郑州": "410100", "开封": "410200", "洛阳": "410300", "平顶山": "410400", "安阳": "410500", "鹤壁": "410600", "新乡": "410700", "焦作": "410800", "濮阳": "410900", "许昌": "411000", "漯河": "411100", "三门峡": "411200", "南阳": "411300", "商丘": "411400", "信阳": "411500", "周口": "411600", "驻马店": "411700", "武汉": "420100", "黄石": "420200", "十堰": "420300", "宜昌": "420500", "襄阳": "420600", "鄂州": "420700", "荆门": "420800", "孝感": "420900", "荆州": "421000", "黄冈": "421100", "咸宁": "421200", "随州": "421300", "恩施州": "422800", "长沙": "430100", "株洲": "430200", "湘潭": "430300", "衡阳": "430400", "邵阳": "430500", "岳阳": "430600", "常德": "430700", "张家界": "430800", "益阳": "430900", "郴州": "431000", "永州": "431100", "怀化": "431200", "娄底": "431300", "湘西州": "433100", "广州": "440100", "韶关": "440200", "深圳": "440300", "珠海": "440400", "汕头": "440500", "佛山": "440600", "江门": "440700", "湛江": "440800", "茂名": "440900", "肇庆": "441200", "惠州": "441300", "梅州": "441400", "汕尾": "441500", "河源": "441600", "阳江": "441700", "清远": "441800", "东莞": "441900", "中山": "442000", "潮州": "445100", "揭阳": "445200", "云浮": "445300", "南宁": "450100", "柳州": "450200", "桂林": "450300", "梧州": "450400", "北海": "450500", "防城港": "450600", "钦州": "450700", "贵港": "450800", "玉林": "450900", "百色": "451000", "贺州": "451100", "河池": "451200", "来宾": "451300", "崇左": "451400", "海口": "460100", "三亚": "460200", "重庆": "500000", "成都": "510100", "自贡": "510300", "攀枝花": "510400", "泸州": "510500", "德阳": "510600", "绵阳": "510700", "广元": "510800", "遂宁": "510900", "内江": "511000", "乐山": "511100", "南充": "511300", "眉山": "511400", "宜宾": "511500", "广安": "511600", "达州": "511700", "雅安": "511800", "巴中": "511900", "资阳": "512000", "阿坝州": "513200", "甘孜州": "513300", "凉山州": "513400", "贵阳": "520100", "六盘水": "520200", "遵义": "520300", "安顺": "520400", "铜仁地区": "522200", "黔西南州": "522300", "毕节": "522400", "黔东南州": "522600", "黔南州": "522700", "昆明": "530100", "曲靖": "530300", "玉溪": "530400", "保山": "530500", "昭通": "530600", "丽江": "530700", "普洱": "530800", "临沧": "530900", "红河州": "532522", "文山州": "532621", "西双版纳州": "532801", "大理州": "532901", "德宏州": "533103", "怒江州": "533300", "迪庆州": "533421", "拉萨": "540100", "昌都": "542100", "山南": "542200", "日喀则": "542300", "那曲地区": "542400", "阿里地区": "542500", "林芝": "542600", "西安": "610100", "铜川": "610200", "宝鸡": "610300", "咸阳": "610400", "渭南": "610500", "延安": "610600", "汉中": "610700", "榆林": "610800", "安康": "610900", "商洛": "611000", "兰州": "620100", "嘉峪关": "620200", "金昌": "620300", "白银": "620400", "天水": "620500", "武威": "620600", "张掖": "620700", "平凉": "620800", "酒泉": "620900", "庆阳": "621000", "定西": "621100", "陇南": "621200", "临夏州": "622900", "甘南州": "623000", "西宁": "630100", "海东地区": "632100", "海北州": "632200", "黄南州": "632300", "海南州": "632500", "果洛州": "632600", "玉树州": "632700", "海西州": "632800", "银川": "640100", "石嘴山": "640200", "吴忠": "640300", "固原": "640400", "中卫": "640500", "乌鲁木齐": "650100", "克拉玛依": "650200", "吐鲁番地区": "652100", "哈密地区": "652200", "昌吉州": "652300", "博州": "652700", "库尔勒": "652800", "阿克苏地区": "652900", "克州": "653000", "喀什地区": "653100", "和田地区": "653200", "伊犁哈萨克州": "654000", "塔城地区": "654200", "阿勒泰地区": "654300", "石河子": "659001", "五家渠": "659004", } ================================================ FILE: akshare/air/crypto.js ================================================ function Base64() { _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", this.encode = function(a) { var c, d, e, f, g, h, i, b = "", j = 0; for (a = _utf8_encode(a); j < a.length;) c = a.charCodeAt(j++), d = a.charCodeAt(j++), e = a.charCodeAt(j++), f = c >> 2, g = (3 & c) << 4 | d >> 4, h = (15 & d) << 2 | e >> 6, i = 63 & e, isNaN(d) ? h = i = 64 : isNaN(e) && (i = 64), b = b + _keyStr.charAt(f) + _keyStr.charAt(g) + _keyStr.charAt(h) + _keyStr.charAt(i); return b }, this.decode = function(a) { var c, d, e, f, g, h, i, b = "", j = 0; for (a = a.replace(/[^A-Za-z0-9\+\/\=]/g, ""); j < a.length;) f = _keyStr.indexOf(a.charAt(j++)), g = _keyStr.indexOf(a.charAt(j++)), h = _keyStr.indexOf(a.charAt(j++)), i = _keyStr.indexOf(a.charAt(j++)), c = f << 2 | g >> 4, d = (15 & g) << 4 | h >> 2, e = (3 & h) << 6 | i, b += String.fromCharCode(c), 64 != h && (b += String.fromCharCode(d)), 64 != i && (b += String.fromCharCode(e)); return b = _utf8_decode(b) }, _utf8_encode = function(a) { var b, c, d; for (a = a.replace(/\r\n/g, "\n"), b = "", c = 0; c < a.length; c++) d = a.charCodeAt(c), 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(192 | d >> 6), b += String.fromCharCode(128 | 63 & d)) : (b += String.fromCharCode(224 | d >> 12), b += String.fromCharCode(128 | 63 & d >> 6), b += String.fromCharCode(128 | 63 & d)); return b }, _utf8_decode = function(a) { for (var b = "", c = 0, d = c1 = c2 = 0; c < a.length;) d = a.charCodeAt(c), 128 > d ? (b += String.fromCharCode(d), c++) : d > 191 && 224 > d ? (c2 = a.charCodeAt(c + 1), b += String.fromCharCode((31 & d) << 6 | 63 & c2), c += 2) : (c2 = a.charCodeAt(c + 1), c3 = a.charCodeAt(c + 2), b += String.fromCharCode((15 & d) << 12 | (63 & c2) << 6 | 63 & c3), c += 3); return b } } function hex_md5(a) { return binl2hex(core_md5(str2binl(a), a.length * chrsz)) } function b64_md5(a) { return binl2b64(core_md5(str2binl(a), a.length * chrsz)) } function str_md5(a) { return binl2str(core_md5(str2binl(a), a.length * chrsz)) } function hex_hmac_md5(a, b) { return binl2hex(core_hmac_md5(a, b)) } function b64_hmac_md5(a, b) { return binl2b64(core_hmac_md5(a, b)) } function str_hmac_md5(a, b) { return binl2str(core_hmac_md5(a, b)) } function md5_vm_test() { return "900150983cd24fb0d6963f7d28e17f72" == hex_md5("abc") } function core_md5(a, b) { var c, d, e, f, g, h, i, j, k; for (a[b >> 5] |= 128 << b % 32, a[(b + 64 >>> 9 << 4) + 14] = b, c = 1732584193, d = -271733879, e = -1732584194, f = 271733878, g = 0; g < a.length; g += 16) h = c, i = d, j = e, k = f, c = md5_ff(c, d, e, f, a[g + 0], 7, -680876936), f = md5_ff(f, c, d, e, a[g + 1], 12, -389564586), e = md5_ff(e, f, c, d, a[g + 2], 17, 606105819), d = md5_ff(d, e, f, c, a[g + 3], 22, -1044525330), c = md5_ff(c, d, e, f, a[g + 4], 7, -176418897), f = md5_ff(f, c, d, e, a[g + 5], 12, 1200080426), e = md5_ff(e, f, c, d, a[g + 6], 17, -1473231341), d = md5_ff(d, e, f, c, a[g + 7], 22, -45705983), c = md5_ff(c, d, e, f, a[g + 8], 7, 1770035416), f = md5_ff(f, c, d, e, a[g + 9], 12, -1958414417), e = md5_ff(e, f, c, d, a[g + 10], 17, -42063), d = md5_ff(d, e, f, c, a[g + 11], 22, -1990404162), c = md5_ff(c, d, e, f, a[g + 12], 7, 1804603682), f = md5_ff(f, c, d, e, a[g + 13], 12, -40341101), e = md5_ff(e, f, c, d, a[g + 14], 17, -1502002290), d = md5_ff(d, e, f, c, a[g + 15], 22, 1236535329), c = md5_gg(c, d, e, f, a[g + 1], 5, -165796510), f = md5_gg(f, c, d, e, a[g + 6], 9, -1069501632), e = md5_gg(e, f, c, d, a[g + 11], 14, 643717713), d = md5_gg(d, e, f, c, a[g + 0], 20, -373897302), c = md5_gg(c, d, e, f, a[g + 5], 5, -701558691), f = md5_gg(f, c, d, e, a[g + 10], 9, 38016083), e = md5_gg(e, f, c, d, a[g + 15], 14, -660478335), d = md5_gg(d, e, f, c, a[g + 4], 20, -405537848), c = md5_gg(c, d, e, f, a[g + 9], 5, 568446438), f = md5_gg(f, c, d, e, a[g + 14], 9, -1019803690), e = md5_gg(e, f, c, d, a[g + 3], 14, -187363961), d = md5_gg(d, e, f, c, a[g + 8], 20, 1163531501), c = md5_gg(c, d, e, f, a[g + 13], 5, -1444681467), f = md5_gg(f, c, d, e, a[g + 2], 9, -51403784), e = md5_gg(e, f, c, d, a[g + 7], 14, 1735328473), d = md5_gg(d, e, f, c, a[g + 12], 20, -1926607734), c = md5_hh(c, d, e, f, a[g + 5], 4, -378558), f = md5_hh(f, c, d, e, a[g + 8], 11, -2022574463), e = md5_hh(e, f, c, d, a[g + 11], 16, 1839030562), d = md5_hh(d, e, f, c, a[g + 14], 23, -35309556), c = md5_hh(c, d, e, f, a[g + 1], 4, -1530992060), f = md5_hh(f, c, d, e, a[g + 4], 11, 1272893353), e = md5_hh(e, f, c, d, a[g + 7], 16, -155497632), d = md5_hh(d, e, f, c, a[g + 10], 23, -1094730640), c = md5_hh(c, d, e, f, a[g + 13], 4, 681279174), f = md5_hh(f, c, d, e, a[g + 0], 11, -358537222), e = md5_hh(e, f, c, d, a[g + 3], 16, -722521979), d = md5_hh(d, e, f, c, a[g + 6], 23, 76029189), c = md5_hh(c, d, e, f, a[g + 9], 4, -640364487), f = md5_hh(f, c, d, e, a[g + 12], 11, -421815835), e = md5_hh(e, f, c, d, a[g + 15], 16, 530742520), d = md5_hh(d, e, f, c, a[g + 2], 23, -995338651), c = md5_ii(c, d, e, f, a[g + 0], 6, -198630844), f = md5_ii(f, c, d, e, a[g + 7], 10, 1126891415), e = md5_ii(e, f, c, d, a[g + 14], 15, -1416354905), d = md5_ii(d, e, f, c, a[g + 5], 21, -57434055), c = md5_ii(c, d, e, f, a[g + 12], 6, 1700485571), f = md5_ii(f, c, d, e, a[g + 3], 10, -1894986606), e = md5_ii(e, f, c, d, a[g + 10], 15, -1051523), d = md5_ii(d, e, f, c, a[g + 1], 21, -2054922799), c = md5_ii(c, d, e, f, a[g + 8], 6, 1873313359), f = md5_ii(f, c, d, e, a[g + 15], 10, -30611744), e = md5_ii(e, f, c, d, a[g + 6], 15, -1560198380), d = md5_ii(d, e, f, c, a[g + 13], 21, 1309151649), c = md5_ii(c, d, e, f, a[g + 4], 6, -145523070), f = md5_ii(f, c, d, e, a[g + 11], 10, -1120210379), e = md5_ii(e, f, c, d, a[g + 2], 15, 718787259), d = md5_ii(d, e, f, c, a[g + 9], 21, -343485551), c = safe_add(c, h), d = safe_add(d, i), e = safe_add(e, j), f = safe_add(f, k); return Array(c, d, e, f) } function md5_cmn(a, b, c, d, e, f) { return safe_add(bit_rol(safe_add(safe_add(b, a), safe_add(d, f)), e), c) } function md5_ff(a, b, c, d, e, f, g) { return md5_cmn(b & c | ~b & d, a, b, e, f, g) } function md5_gg(a, b, c, d, e, f, g) { return md5_cmn(b & d | c & ~d, a, b, e, f, g) } function md5_hh(a, b, c, d, e, f, g) { return md5_cmn(b ^ c ^ d, a, b, e, f, g) } function md5_ii(a, b, c, d, e, f, g) { return md5_cmn(c ^ (b | ~d), a, b, e, f, g) } function core_hmac_md5(a, b) { var d, e, f, g, c = str2binl(a); for (c.length > 16 && (c = core_md5(c, a.length * chrsz)), d = Array(16), e = Array(16), f = 0; 16 > f; f++) d[f] = 909522486 ^ c[f], e[f] = 1549556828 ^ c[f]; return g = core_md5(d.concat(str2binl(b)), 512 + b.length * chrsz), core_md5(e.concat(g), 640) } function safe_add(a, b) { var c = (65535 & a) + (65535 & b), d = (a >> 16) + (b >> 16) + (c >> 16); return d << 16 | 65535 & c } function bit_rol(a, b) { return a << b | a >>> 32 - b } function str2binl(a) { var d, b = Array(), c = (1 << chrsz) - 1; for (d = 0; d < a.length * chrsz; d += chrsz) b[d >> 5] |= (a.charCodeAt(d / chrsz) & c) << d % 32; return b } function binl2str(a) { var d, b = "", c = (1 << chrsz) - 1; for (d = 0; d < 32 * a.length; d += chrsz) b += String.fromCharCode(a[d >> 5] >>> d % 32 & c); return b } function binl2hex(a) { var d, b = hexcase ? "0123456789ABCDEF" : "0123456789abcdef", c = ""; for (d = 0; d < 4 * a.length; d++) c += b.charAt(15 & a[d >> 2] >> 8 * (d % 4) + 4) + b.charAt(15 & a[d >> 2] >> 8 * (d % 4)); return c } function binl2b64(a) { var d, e, f, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = ""; for (d = 0; d < 4 * a.length; d += 3) for (e = (255 & a[d >> 2] >> 8 * (d % 4)) << 16 | (255 & a[d + 1 >> 2] >> 8 * ((d + 1) % 4)) << 8 | 255 & a[d + 2 >> 2] >> 8 * ((d + 2) % 4), f = 0; 4 > f; f++) c += 8 * d + 6 * f > 32 * a.length ? b64pad : b.charAt(63 & e >> 6 * (3 - f)); return c } function encode_param(a) { var b = new Base64; return b.encode(a) } function encode_secret() { var b, a = appId; for (b = 0; b < arguments.length; b++) a += arguments[b]; return a = a.replace(/\s/g, ""), hex_md5(a) } function decode_result(a) { var b = new Base64; return b.decode(b.decode(b.decode(a))) } var hexcase = 0, b64pad = "", chrsz = 8, appId = "a01901d3caba1f362d69474674ce477f"; ================================================ FILE: akshare/air/outcrypto.js ================================================ function Base64() { _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", this.encode = function(a) { var c, d, e, f, g, h, i, b = "", j = 0; for (a = _utf8_encode(a); j < a.length;) c = a.charCodeAt(j++), d = a.charCodeAt(j++), e = a.charCodeAt(j++), f = c >> 2, g = (3 & c) << 4 | d >> 4, h = (15 & d) << 2 | e >> 6, i = 63 & e, isNaN(d) ? h = i = 64 : isNaN(e) && (i = 64), b = b + _keyStr.charAt(f) + _keyStr.charAt(g) + _keyStr.charAt(h) + _keyStr.charAt(i); return b }, this.decode = function(a) { var c, d, e, f, g, h, i, b = "", j = 0; for (a = a.replace(/[^A-Za-z0-9\+\/\=]/g, ""); j < a.length;) f = _keyStr.indexOf(a.charAt(j++)), g = _keyStr.indexOf(a.charAt(j++)), h = _keyStr.indexOf(a.charAt(j++)), i = _keyStr.indexOf(a.charAt(j++)), c = f << 2 | g >> 4, d = (15 & g) << 4 | h >> 2, e = (3 & h) << 6 | i, b += String.fromCharCode(c), 64 != h && (b += String.fromCharCode(d)), 64 != i && (b += String.fromCharCode(e)); return b = _utf8_decode(b) }, _utf8_encode = function(a) { var b, c, d; for (a = a.replace(/\r\n/g, "\n"), b = "", c = 0; c < a.length; c++) d = a.charCodeAt(c), 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(192 | d >> 6), b += String.fromCharCode(128 | 63 & d)) : (b += String.fromCharCode(224 | d >> 12), b += String.fromCharCode(128 | 63 & d >> 6), b += String.fromCharCode(128 | 63 & d)); return b }, _utf8_decode = function(a) { for (var b = "", c = 0, d = c1 = c2 = 0; c < a.length;) d = a.charCodeAt(c), 128 > d ? (b += String.fromCharCode(d), c++) : d > 191 && 224 > d ? (c2 = a.charCodeAt(c + 1), b += String.fromCharCode((31 & d) << 6 | 63 & c2), c += 2) : (c2 = a.charCodeAt(c + 1), c3 = a.charCodeAt(c + 2), b += String.fromCharCode((15 & d) << 12 | (63 & c2) << 6 | 63 & c3), c += 3); return b } } function hex_md5(a) { return binl2hex(core_md5(str2binl(a), a.length * chrsz)); } function b64_md5(a) { return binl2b64(core_md5(str2binl(a), a.length * chrsz)); } function str_md5(a) { return binl2str(core_md5(str2binl(a), a.length * chrsz)); } function hex_hmac_md5(a, b) { return binl2hex(core_hmac_md5(a, b)); } function b64_hmac_md5(a, b) { return binl2b64(core_hmac_md5(a, b)); } function str_hmac_md5(a, b) { return binl2str(core_hmac_md5(a, b)); } function md5_vm_test() { return "900150983cd24fb0d6963f7d28e17f72" == hex_md5("abc"); } function core_md5(a, b) { var c, d, e, f, g, h, i, j, k; for ( a[b >> 5] |= 128 << b % 32, a[(((b + 64) >>> 9) << 4) + 14] = b, c = 1732584193, d = -271733879, e = -1732584194, f = 271733878, g = 0; g < a.length; g += 16 ) (h = c), (i = d), (j = e), (k = f), (c = md5_ff(c, d, e, f, a[g + 0], 7, -680876936)), (f = md5_ff(f, c, d, e, a[g + 1], 12, -389564586)), (e = md5_ff(e, f, c, d, a[g + 2], 17, 606105819)), (d = md5_ff(d, e, f, c, a[g + 3], 22, -1044525330)), (c = md5_ff(c, d, e, f, a[g + 4], 7, -176418897)), (f = md5_ff(f, c, d, e, a[g + 5], 12, 1200080426)), (e = md5_ff(e, f, c, d, a[g + 6], 17, -1473231341)), (d = md5_ff(d, e, f, c, a[g + 7], 22, -45705983)), (c = md5_ff(c, d, e, f, a[g + 8], 7, 1770035416)), (f = md5_ff(f, c, d, e, a[g + 9], 12, -1958414417)), (e = md5_ff(e, f, c, d, a[g + 10], 17, -42063)), (d = md5_ff(d, e, f, c, a[g + 11], 22, -1990404162)), (c = md5_ff(c, d, e, f, a[g + 12], 7, 1804603682)), (f = md5_ff(f, c, d, e, a[g + 13], 12, -40341101)), (e = md5_ff(e, f, c, d, a[g + 14], 17, -1502002290)), (d = md5_ff(d, e, f, c, a[g + 15], 22, 1236535329)), (c = md5_gg(c, d, e, f, a[g + 1], 5, -165796510)), (f = md5_gg(f, c, d, e, a[g + 6], 9, -1069501632)), (e = md5_gg(e, f, c, d, a[g + 11], 14, 643717713)), (d = md5_gg(d, e, f, c, a[g + 0], 20, -373897302)), (c = md5_gg(c, d, e, f, a[g + 5], 5, -701558691)), (f = md5_gg(f, c, d, e, a[g + 10], 9, 38016083)), (e = md5_gg(e, f, c, d, a[g + 15], 14, -660478335)), (d = md5_gg(d, e, f, c, a[g + 4], 20, -405537848)), (c = md5_gg(c, d, e, f, a[g + 9], 5, 568446438)), (f = md5_gg(f, c, d, e, a[g + 14], 9, -1019803690)), (e = md5_gg(e, f, c, d, a[g + 3], 14, -187363961)), (d = md5_gg(d, e, f, c, a[g + 8], 20, 1163531501)), (c = md5_gg(c, d, e, f, a[g + 13], 5, -1444681467)), (f = md5_gg(f, c, d, e, a[g + 2], 9, -51403784)), (e = md5_gg(e, f, c, d, a[g + 7], 14, 1735328473)), (d = md5_gg(d, e, f, c, a[g + 12], 20, -1926607734)), (c = md5_hh(c, d, e, f, a[g + 5], 4, -378558)), (f = md5_hh(f, c, d, e, a[g + 8], 11, -2022574463)), (e = md5_hh(e, f, c, d, a[g + 11], 16, 1839030562)), (d = md5_hh(d, e, f, c, a[g + 14], 23, -35309556)), (c = md5_hh(c, d, e, f, a[g + 1], 4, -1530992060)), (f = md5_hh(f, c, d, e, a[g + 4], 11, 1272893353)), (e = md5_hh(e, f, c, d, a[g + 7], 16, -155497632)), (d = md5_hh(d, e, f, c, a[g + 10], 23, -1094730640)), (c = md5_hh(c, d, e, f, a[g + 13], 4, 681279174)), (f = md5_hh(f, c, d, e, a[g + 0], 11, -358537222)), (e = md5_hh(e, f, c, d, a[g + 3], 16, -722521979)), (d = md5_hh(d, e, f, c, a[g + 6], 23, 76029189)), (c = md5_hh(c, d, e, f, a[g + 9], 4, -640364487)), (f = md5_hh(f, c, d, e, a[g + 12], 11, -421815835)), (e = md5_hh(e, f, c, d, a[g + 15], 16, 530742520)), (d = md5_hh(d, e, f, c, a[g + 2], 23, -995338651)), (c = md5_ii(c, d, e, f, a[g + 0], 6, -198630844)), (f = md5_ii(f, c, d, e, a[g + 7], 10, 1126891415)), (e = md5_ii(e, f, c, d, a[g + 14], 15, -1416354905)), (d = md5_ii(d, e, f, c, a[g + 5], 21, -57434055)), (c = md5_ii(c, d, e, f, a[g + 12], 6, 1700485571)), (f = md5_ii(f, c, d, e, a[g + 3], 10, -1894986606)), (e = md5_ii(e, f, c, d, a[g + 10], 15, -1051523)), (d = md5_ii(d, e, f, c, a[g + 1], 21, -2054922799)), (c = md5_ii(c, d, e, f, a[g + 8], 6, 1873313359)), (f = md5_ii(f, c, d, e, a[g + 15], 10, -30611744)), (e = md5_ii(e, f, c, d, a[g + 6], 15, -1560198380)), (d = md5_ii(d, e, f, c, a[g + 13], 21, 1309151649)), (c = md5_ii(c, d, e, f, a[g + 4], 6, -145523070)), (f = md5_ii(f, c, d, e, a[g + 11], 10, -1120210379)), (e = md5_ii(e, f, c, d, a[g + 2], 15, 718787259)), (d = md5_ii(d, e, f, c, a[g + 9], 21, -343485551)), (c = safe_add(c, h)), (d = safe_add(d, i)), (e = safe_add(e, j)), (f = safe_add(f, k)); return Array(c, d, e, f); } function md5_cmn(a, b, c, d, e, f) { return safe_add(bit_rol(safe_add(safe_add(b, a), safe_add(d, f)), e), c); } function md5_ff(a, b, c, d, e, f, g) { return md5_cmn((b & c) | (~b & d), a, b, e, f, g); } function md5_gg(a, b, c, d, e, f, g) { return md5_cmn((b & d) | (c & ~d), a, b, e, f, g); } function md5_hh(a, b, c, d, e, f, g) { return md5_cmn(b ^ c ^ d, a, b, e, f, g); } function md5_ii(a, b, c, d, e, f, g) { return md5_cmn(c ^ (b | ~d), a, b, e, f, g); } function core_hmac_md5(a, b) { var d, e, f, g, c = str2binl(a); for ( c.length > 16 && (c = core_md5(c, a.length * chrsz)), d = Array(16), e = Array(16), f = 0; 16 > f; f++ ) (d[f] = 909522486 ^ c[f]), (e[f] = 1549556828 ^ c[f]); return ( (g = core_md5(d.concat(str2binl(b)), 512 + b.length * chrsz)), core_md5(e.concat(g), 640) ); } function safe_add(a, b) { var c = (65535 & a) + (65535 & b), d = (a >> 16) + (b >> 16) + (c >> 16); return (d << 16) | (65535 & c); } function bit_rol(a, b) { return (a << b) | (a >>> (32 - b)); } function str2binl(a) { var d, b = Array(), c = (1 << chrsz) - 1; for (d = 0; d < a.length * chrsz; d += chrsz) b[d >> 5] |= (a.charCodeAt(d / chrsz) & c) << d % 32; return b; } function binl2str(a) { var d, b = "", c = (1 << chrsz) - 1; for (d = 0; d < 32 * a.length; d += chrsz) b += String.fromCharCode((a[d >> 5] >>> d % 32) & c); return b; } function binl2hex(a) { var d, b = hexcase ? "0123456789ABCDEF" : "0123456789abcdef", c = ""; for (d = 0; d < 4 * a.length; d++) c += b.charAt(15 & (a[d >> 2] >> (8 * (d % 4) + 4))) + b.charAt(15 & (a[d >> 2] >> (8 * (d % 4)))); return c; } function binl2b64(a) { var d, e, f, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = ""; for (d = 0; d < 4 * a.length; d += 3) for ( e = ((255 & (a[d >> 2] >> (8 * (d % 4)))) << 16) | ((255 & (a[(d + 1) >> 2] >> (8 * ((d + 1) % 4)))) << 8) | (255 & (a[(d + 2) >> 2] >> (8 * ((d + 2) % 4)))), f = 0; 4 > f; f++ ) c += 8 * d + 6 * f > 32 * a.length ? b64pad : b.charAt(63 & (e >> (6 * (3 - f)))); return c; } function encode_param(a) { var b = new Base64(); var des = DES() return des.encrypt(b.encode(a)); } function encode_secret() { var b, a = appId; for (b = 0; b < arguments.length; b++) a += arguments[b]; return (a = a.replace(/\s/g, "")), hex_md5(a); } function decode_result(a) { var b = new Base64(); return b.decode(b.decode(b.decode(a))); } var hexcase = 0, b64pad = "", chrsz = 8, appId = "a01901d3caba1f362d69474674ce477f"; var CryptoJS = CryptoJS || (function(h, r) { var k = {}, l = (k.lib = {}), n = function() {}, f = (l.Base = { extend: function(a) { n.prototype = this; var b = new n(); a && b.mixIn(a); b.hasOwnProperty("init") || (b.init = function() { b.s.init.apply(this, arguments); }); b.init.prototype = b; b.s = this; return b; }, create: function() { var a = this.extend(); a.init.apply(a, arguments); return a; }, init: function() {}, mixIn: function(a) { for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b]); a.hasOwnProperty("toString") && (this.toString = a.toString); }, clone: function() { return this.init.prototype.extend(this); } }), j = (l.WordArray = f.extend({ init: function(a, b) { a = this.words = a || []; this.sigBytes = b != r ? b : 4 * a.length; }, toString: function(a) { return (a || s).stringify(this); }, concat: function(a) { var b = this.words, d = a.words, c = this.sigBytes; a = a.sigBytes; this.clamp(); if (c % 4) for (var e = 0; e < a; e++) b[(c + e) >>> 2] |= ((d[e >>> 2] >>> (24 - 8 * (e % 4))) & 255) << (24 - 8 * ((c + e) % 4)); else if (65535 < d.length) for (e = 0; e < a; e += 4) b[(c + e) >>> 2] = d[e >>> 2]; else b.push.apply(b, d); this.sigBytes += a; return this; }, clamp: function() { var a = this.words, b = this.sigBytes; a[b >>> 2] &= 4294967295 << (32 - 8 * (b % 4)); a.length = h.ceil(b / 4); }, clone: function() { var a = f.clone.call(this); a.words = this.words.slice(0); return a; }, random: function(a) { for (var b = [], d = 0; d < a; d += 4) b.push((4294967296 * h.random()) | 0); return new j.init(b, a); } })), m = (k.enc = {}), s = (m.Hex = { stringify: function(a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) { var e = (b[c >>> 2] >>> (24 - 8 * (c % 4))) & 255; d.push((e >>> 4).toString(16)); d.push((e & 15).toString(16)); } return d.join(""); }, parse: function(a) { for (var b = a.length, d = [], c = 0; c < b; c += 2) d[c >>> 3] |= parseInt(a.substr(c, 2), 16) << (24 - 4 * (c % 8)); return new j.init(d, b / 2); } }), p = (m.Latin1 = { stringify: function(a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) d.push( String.fromCharCode((b[c >>> 2] >>> (24 - 8 * (c % 4))) & 255) ); return d.join(""); }, parse: function(a) { for (var b = a.length, d = [], c = 0; c < b; c++) d[c >>> 2] |= (a.charCodeAt(c) & 255) << (24 - 8 * (c % 4)); return new j.init(d, b); } }), t = (m.Utf8 = { stringify: function(a) { try { return decodeURIComponent(escape(p.stringify(a))); } catch (b) { throw Error("Malformed UTF-8 data"); } }, parse: function(a) { return p.parse(unescape(encodeURIComponent(a))); } }), q = (l.BufferedBlockAlgorithm = f.extend({ reset: function() { this._2 = new j.init(); this._22 = 0; }, _8: function(a) { "string" == typeof a && (a = t.parse(a)); this._2.concat(a); this._22 += a.sigBytes; }, _3: function(a) { var b = this._2, d = b.words, c = b.sigBytes, e = this.blockSize, f = c / (4 * e), f = a ? h.ceil(f) : h.max((f | 0) - this._18, 0); a = f * e; c = h.min(4 * a, c); if (a) { for (var g = 0; g < a; g += e) this._20(d, g); g = d.splice(0, a); b.sigBytes -= c; } return new j.init(g, c); }, clone: function() { var a = f.clone.call(this); a._2 = this._2.clone(); return a; }, _18: 0 })); l.Hasher = q.extend({ cfg: f.extend(), init: function(a) { this.cfg = this.cfg.extend(a); this.reset(); }, reset: function() { q.reset.call(this); this._5(); }, update: function(a) { this._8(a); this._3(); return this; }, finalize: function(a) { a && this._8(a); return this._9(); }, blockSize: 16, _6: function(a) { return function(b, d) { return new a.init(d).finalize(b); }; }, _30: function(a) { return function(b, d) { return new u.HMAC.init(a, d).finalize(b); }; } }); var u = (k.algo = {}); return k; })(Math); (function() { var h = CryptoJS, j = h.lib.WordArray; h.enc.Base64 = { stringify: function(b) { var e = b.words, f = b.sigBytes, c = this._13; b.clamp(); b = []; for (var a = 0; a < f; a += 3) for ( var d = (((e[a >>> 2] >>> (24 - 8 * (a % 4))) & 255) << 16) | (((e[(a + 1) >>> 2] >>> (24 - 8 * ((a + 1) % 4))) & 255) << 8) | ((e[(a + 2) >>> 2] >>> (24 - 8 * ((a + 2) % 4))) & 255), g = 0; 4 > g && a + 0.75 * g < f; g++ ) b.push(c.charAt((d >>> (6 * (3 - g))) & 63)); if ((e = c.charAt(64))) for (; b.length % 4; ) b.push(e); return b.join(""); }, parse: function(b) { var e = b.length, f = this._13, c = f.charAt(64); c && ((c = b.indexOf(c)), -1 != c && (e = c)); for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { var g = f.indexOf(b.charAt(d - 1)) << (2 * (d % 4)), h = f.indexOf(b.charAt(d)) >>> (6 - 2 * (d % 4)); c[a >>> 2] |= (g | h) << (24 - 8 * (a % 4)); a++; } return j.create(c, a); }, _13: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" }; })(); CryptoJS.lib.Cipher || (function(u) { var g = CryptoJS, f = g.lib, k = f.Base, l = f.WordArray, q = f.BufferedBlockAlgorithm, r = g.enc.Base64, v = g.algo.EvpKDF, n = (f.Cipher = q.extend({ cfg: k.extend(), createEncryptor: function(a, b) { return this.create(this._11, a, b); }, createDecryptor: function(a, b) { return this.create(this._25, a, b); }, init: function(a, b, c) { this.cfg = this.cfg.extend(c); this._15 = a; this._12 = b; this.reset(); }, reset: function() { q.reset.call(this); this._5(); }, process: function(a) { this._8(a); return this._3(); }, finalize: function(a) { a && this._8(a); return this._9(); }, keySize: 4, ivSize: 4, _11: 1, _25: 2, _6: function(a) { return { encrypt: function(b, c, d) { return ("string" == typeof c ? s : j).encrypt(a, b, c, d); }, decrypt: function(b, c, d) { return ("string" == typeof c ? s : j).decrypt(a, b, c, d); } }; } })); f.StreamCipher = n.extend({ _9: function() { return this._3(!0); }, blockSize: 1 }); var m = (g.mode = {}), t = function(a, b, c) { var d = this._16; d ? (this._16 = u) : (d = this._19); for (var e = 0; e < c; e++) a[b + e] ^= d[e]; }, h = (f.BlockCipherMode = k.extend({ createEncryptor: function(a, b) { return this.Encryptor.create(a, b); }, createDecryptor: function(a, b) { return this.Decryptor.create(a, b); }, init: function(a, b) { this._10 = a; this._16 = b; } })).extend(); h.Encryptor = h.extend({ processBlock: function(a, b) { var c = this._10, d = c.blockSize; t.call(this, a, b, d); c.encryptBlock(a, b); this._19 = a.slice(b, b + d); } }); h.Decryptor = h.extend({ processBlock: function(a, b) { var c = this._10, d = c.blockSize, e = a.slice(b, b + d); c.decryptBlock(a, b); t.call(this, a, b, d); this._19 = e; } }); m = m.CBC = h; h = (g.pad = {}).Pkcs7 = { pad: function(a, b) { for ( var c = 4 * b, c = c - (a.sigBytes % c), d = (c << 24) | (c << 16) | (c << 8) | c, e = [], f = 0; f < c; f += 4 ) e.push(d); c = l.create(e, c); a.concat(c); }, unpad: function(a) { a.sigBytes -= a.words[(a.sigBytes - 1) >>> 2] & 255; } }; f.BlockCipher = n.extend({ cfg: n.cfg.extend({ mode: m, padding: h }), reset: function() { n.reset.call(this); var a = this.cfg, b = a.iv, a = a.mode; if (this._15 == this._11) var c = a.createEncryptor; else (c = a.createDecryptor), (this._18 = 1); this._31 = c.call(a, this, b && b.words); }, _20: function(a, b) { this._31.processBlock(a, b); }, _9: function() { var a = this.cfg.padding; if (this._15 == this._11) { a.pad(this._2, this.blockSize); var b = this._3(!0); } else (b = this._3(!0)), a.unpad(b); return b; }, blockSize: 4 }); var p = (f.CipherParams = k.extend({ init: function(a) { this.mixIn(a); }, toString: function(a) { return (a || this.formatter).stringify(this); } })), m = ((g.format = {}).OpenSSL = { stringify: function(a) { var b = a.ciphertext; a = a.salt; return (a ? l .create([1398893684, 1701076831]) .concat(a) .concat(b) : b ).toString(r); }, parse: function(a) { a = r.parse(a); var b = a.words; if (1398893684 == b[0] && 1701076831 == b[1]) { var c = l.create(b.slice(2, 4)); b.splice(0, 4); a.sigBytes -= 16; } return p.create({ ciphertext: a, salt: c }); } }), j = (f.SerializableCipher = k.extend({ cfg: k.extend({ format: m }), encrypt: function(a, b, c, d) { d = this.cfg.extend(d); var e = a.createEncryptor(c, d); b = e.finalize(b); e = e.cfg; return p.create({ ciphertext: b, key: c, iv: e.iv, algorithm: a, mode: e.mode, padding: e.padding, blockSize: a.blockSize, formatter: d.format }); }, decrypt: function(a, b, c, d) { d = this.cfg.extend(d); b = this._14(b, d.format); return a.createDecryptor(c, d).finalize(b.ciphertext); }, _14: function(a, b) { return "string" == typeof a ? b.parse(a, this) : a; } })), g = ((g.kdf = {}).OpenSSL = { execute: function(a, b, c, d) { d || (d = l.random(8)); a = v .create({ keySize: b + c }) .compute(a, d); c = l.create(a.words.slice(b), 4 * c); a.sigBytes = 4 * b; return p.create({ key: a, iv: c, salt: d }); } }), s = (f.PasswordBasedCipher = j.extend({ cfg: j.cfg.extend({ kdf: g }), encrypt: function(a, b, c, d) { d = this.cfg.extend(d); c = d.kdf.execute(c, a.keySize, a.ivSize); d.iv = c.iv; a = j.encrypt.call(this, a, b, c.key, d); a.mixIn(c); return a; }, decrypt: function(a, b, c, d) { d = this.cfg.extend(d); b = this._14(b, d.format); c = d.kdf.execute(c, a.keySize, a.ivSize, b.salt); d.iv = c.iv; return j.decrypt.call(this, a, b, c.key, d); } })); })(); CryptoJS.mode.ECB = (function() { var a = CryptoJS.lib.BlockCipherMode.extend(); a.Encryptor = a.extend({ processBlock: function(a, b) { this._10.encryptBlock(a, b); } }); a.Decryptor = a.extend({ processBlock: function(a, b) { this._10.decryptBlock(a, b); } }); return a; })(); (function(E) { function h(a, f, g, j, p, h, k) { a = a + ((f & g) | (~f & j)) + p + k; return ((a << h) | (a >>> (32 - h))) + f; } function k(a, f, g, j, p, h, k) { a = a + ((f & j) | (g & ~j)) + p + k; return ((a << h) | (a >>> (32 - h))) + f; } function l(a, f, g, j, h, k, l) { a = a + (f ^ g ^ j) + h + l; return ((a << k) | (a >>> (32 - k))) + f; } function n(a, f, g, j, h, k, l) { a = a + (g ^ (f | ~j)) + h + l; return ((a << k) | (a >>> (32 - k))) + f; } for ( var r = CryptoJS, q = r.lib, F = q.WordArray, s = q.Hasher, q = r.algo, a = [], t = 0; 64 > t; t++ ) a[t] = (4294967296 * E.abs(E.sin(t + 1))) | 0; q = q.MD5 = s.extend({ _5: function() { this._7 = new F.init([1732584193, 4023233417, 2562383102, 271733878]); }, _20: function(m, f) { for (var g = 0; 16 > g; g++) { var j = f + g, p = m[j]; m[j] = (((p << 8) | (p >>> 24)) & 16711935) | (((p << 24) | (p >>> 8)) & 4278255360); } var g = this._7.words, j = m[f + 0], p = m[f + 1], q = m[f + 2], r = m[f + 3], s = m[f + 4], t = m[f + 5], u = m[f + 6], v = m[f + 7], w = m[f + 8], x = m[f + 9], y = m[f + 10], z = m[f + 11], A = m[f + 12], B = m[f + 13], C = m[f + 14], D = m[f + 15], b = g[0], c = g[1], d = g[2], e = g[3], b = h(b, c, d, e, j, 7, a[0]), e = h(e, b, c, d, p, 12, a[1]), d = h(d, e, b, c, q, 17, a[2]), c = h(c, d, e, b, r, 22, a[3]), b = h(b, c, d, e, s, 7, a[4]), e = h(e, b, c, d, t, 12, a[5]), d = h(d, e, b, c, u, 17, a[6]), c = h(c, d, e, b, v, 22, a[7]), b = h(b, c, d, e, w, 7, a[8]), e = h(e, b, c, d, x, 12, a[9]), d = h(d, e, b, c, y, 17, a[10]), c = h(c, d, e, b, z, 22, a[11]), b = h(b, c, d, e, A, 7, a[12]), e = h(e, b, c, d, B, 12, a[13]), d = h(d, e, b, c, C, 17, a[14]), c = h(c, d, e, b, D, 22, a[15]), b = k(b, c, d, e, p, 5, a[16]), e = k(e, b, c, d, u, 9, a[17]), d = k(d, e, b, c, z, 14, a[18]), c = k(c, d, e, b, j, 20, a[19]), b = k(b, c, d, e, t, 5, a[20]), e = k(e, b, c, d, y, 9, a[21]), d = k(d, e, b, c, D, 14, a[22]), c = k(c, d, e, b, s, 20, a[23]), b = k(b, c, d, e, x, 5, a[24]), e = k(e, b, c, d, C, 9, a[25]), d = k(d, e, b, c, r, 14, a[26]), c = k(c, d, e, b, w, 20, a[27]), b = k(b, c, d, e, B, 5, a[28]), e = k(e, b, c, d, q, 9, a[29]), d = k(d, e, b, c, v, 14, a[30]), c = k(c, d, e, b, A, 20, a[31]), b = l(b, c, d, e, t, 4, a[32]), e = l(e, b, c, d, w, 11, a[33]), d = l(d, e, b, c, z, 16, a[34]), c = l(c, d, e, b, C, 23, a[35]), b = l(b, c, d, e, p, 4, a[36]), e = l(e, b, c, d, s, 11, a[37]), d = l(d, e, b, c, v, 16, a[38]), c = l(c, d, e, b, y, 23, a[39]), b = l(b, c, d, e, B, 4, a[40]), e = l(e, b, c, d, j, 11, a[41]), d = l(d, e, b, c, r, 16, a[42]), c = l(c, d, e, b, u, 23, a[43]), b = l(b, c, d, e, x, 4, a[44]), e = l(e, b, c, d, A, 11, a[45]), d = l(d, e, b, c, D, 16, a[46]), c = l(c, d, e, b, q, 23, a[47]), b = n(b, c, d, e, j, 6, a[48]), e = n(e, b, c, d, v, 10, a[49]), d = n(d, e, b, c, C, 15, a[50]), c = n(c, d, e, b, t, 21, a[51]), b = n(b, c, d, e, A, 6, a[52]), e = n(e, b, c, d, r, 10, a[53]), d = n(d, e, b, c, y, 15, a[54]), c = n(c, d, e, b, p, 21, a[55]), b = n(b, c, d, e, w, 6, a[56]), e = n(e, b, c, d, D, 10, a[57]), d = n(d, e, b, c, u, 15, a[58]), c = n(c, d, e, b, B, 21, a[59]), b = n(b, c, d, e, s, 6, a[60]), e = n(e, b, c, d, z, 10, a[61]), d = n(d, e, b, c, q, 15, a[62]), c = n(c, d, e, b, x, 21, a[63]); g[0] = (g[0] + b) | 0; g[1] = (g[1] + c) | 0; g[2] = (g[2] + d) | 0; g[3] = (g[3] + e) | 0; }, _9: function() { var a = this._2, f = a.words, g = 8 * this._22, j = 8 * a.sigBytes; f[j >>> 5] |= 128 << (24 - (j % 32)); var h = E.floor(g / 4294967296); f[(((j + 64) >>> 9) << 4) + 15] = (((h << 8) | (h >>> 24)) & 16711935) | (((h << 24) | (h >>> 8)) & 4278255360); f[(((j + 64) >>> 9) << 4) + 14] = (((g << 8) | (g >>> 24)) & 16711935) | (((g << 24) | (g >>> 8)) & 4278255360); a.sigBytes = 4 * (f.length + 1); this._3(); a = this._7; f = a.words; for (g = 0; 4 > g; g++) (j = f[g]), (f[g] = (((j << 8) | (j >>> 24)) & 16711935) | (((j << 24) | (j >>> 8)) & 4278255360)); return a; }, clone: function() { var a = s.clone.call(this); a._7 = this._7.clone(); return a; } }); r.MD5 = s._6(q); r.HmacMD5 = s._30(q); })(Math); (function() { for ( var q = CryptoJS, x = q.lib.BlockCipher, r = q.algo, j = [], y = [], z = [], A = [], B = [], C = [], s = [], u = [], v = [], w = [], g = [], k = 0; 256 > k; k++ ) g[k] = 128 > k ? k << 1 : (k << 1) ^ 283; for (var n = 0, l = 0, k = 0; 256 > k; k++) { var f = l ^ (l << 1) ^ (l << 2) ^ (l << 3) ^ (l << 4), f = (f >>> 8) ^ (f & 255) ^ 99; j[n] = f; y[f] = n; var t = g[n], D = g[t], E = g[D], b = (257 * g[f]) ^ (16843008 * f); z[n] = (b << 24) | (b >>> 8); A[n] = (b << 16) | (b >>> 16); B[n] = (b << 8) | (b >>> 24); C[n] = b; b = (16843009 * E) ^ (65537 * D) ^ (257 * t) ^ (16843008 * n); s[f] = (b << 24) | (b >>> 8); u[f] = (b << 16) | (b >>> 16); v[f] = (b << 8) | (b >>> 24); w[f] = b; n ? ((n = t ^ g[g[g[E ^ t]]]), (l ^= g[g[l]])) : (n = l = 1); } var F = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], r = (r.AES = x.extend({ _5: function() { for ( var c = this._12, e = c.words, a = c.sigBytes / 4, c = 4 * ((this._26 = a + 6) + 1), b = (this._27 = []), h = 0; h < c; h++ ) if (h < a) b[h] = e[h]; else { var d = b[h - 1]; h % a ? 6 < a && 4 == h % a && (d = (j[d >>> 24] << 24) | (j[(d >>> 16) & 255] << 16) | (j[(d >>> 8) & 255] << 8) | j[d & 255]) : ((d = (d << 8) | (d >>> 24)), (d = (j[d >>> 24] << 24) | (j[(d >>> 16) & 255] << 16) | (j[(d >>> 8) & 255] << 8) | j[d & 255]), (d ^= F[(h / a) | 0] << 24)); b[h] = b[h - a] ^ d; } e = this._24 = []; for (a = 0; a < c; a++) (h = c - a), (d = a % 4 ? b[h] : b[h - 4]), (e[a] = 4 > a || 4 >= h ? d : s[j[d >>> 24]] ^ u[j[(d >>> 16) & 255]] ^ v[j[(d >>> 8) & 255]] ^ w[j[d & 255]]); }, encryptBlock: function(c, e) { this._4(c, e, this._27, z, A, B, C, j); }, decryptBlock: function(c, e) { var a = c[e + 1]; c[e + 1] = c[e + 3]; c[e + 3] = a; this._4(c, e, this._24, s, u, v, w, y); a = c[e + 1]; c[e + 1] = c[e + 3]; c[e + 3] = a; }, _4: function(c, e, a, b, h, d, j, m) { for ( var n = this._26, f = c[e] ^ a[0], g = c[e + 1] ^ a[1], k = c[e + 2] ^ a[2], p = c[e + 3] ^ a[3], l = 4, t = 1; t < n; t++ ) var q = b[f >>> 24] ^ h[(g >>> 16) & 255] ^ d[(k >>> 8) & 255] ^ j[p & 255] ^ a[l++], r = b[g >>> 24] ^ h[(k >>> 16) & 255] ^ d[(p >>> 8) & 255] ^ j[f & 255] ^ a[l++], s = b[k >>> 24] ^ h[(p >>> 16) & 255] ^ d[(f >>> 8) & 255] ^ j[g & 255] ^ a[l++], p = b[p >>> 24] ^ h[(f >>> 16) & 255] ^ d[(g >>> 8) & 255] ^ j[k & 255] ^ a[l++], f = q, g = r, k = s; q = ((m[f >>> 24] << 24) | (m[(g >>> 16) & 255] << 16) | (m[(k >>> 8) & 255] << 8) | m[p & 255]) ^ a[l++]; r = ((m[g >>> 24] << 24) | (m[(k >>> 16) & 255] << 16) | (m[(p >>> 8) & 255] << 8) | m[f & 255]) ^ a[l++]; s = ((m[k >>> 24] << 24) | (m[(p >>> 16) & 255] << 16) | (m[(f >>> 8) & 255] << 8) | m[g & 255]) ^ a[l++]; p = ((m[p >>> 24] << 24) | (m[(f >>> 16) & 255] << 16) | (m[(g >>> 8) & 255] << 8) | m[k & 255]) ^ a[l++]; c[e] = q; c[e + 1] = r; c[e + 2] = s; c[e + 3] = p; }, keySize: 8 })); q.AES = x._6(r); })(); (function() { function j(b, c) { var a = ((this._1 >>> b) ^ this._0) & c; this._0 ^= a; this._1 ^= a << b; } function l(b, c) { var a = ((this._0 >>> b) ^ this._1) & c; this._1 ^= a; this._0 ^= a << b; } var h = CryptoJS, e = h.lib, n = e.WordArray, e = e.BlockCipher, g = h.algo, q = [ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 ], p = [ 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 ], r = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], s = [ { "0": 8421888, 268435456: 32768, 536870912: 8421378, 805306368: 2, 1073741824: 512, 1342177280: 8421890, 1610612736: 8389122, 1879048192: 8388608, 2147483648: 514, 2415919104: 8389120, 2684354560: 33280, 2952790016: 8421376, 3221225472: 32770, 3489660928: 8388610, 3758096384: 0, 4026531840: 33282, 134217728: 0, 402653184: 8421890, 671088640: 33282, 939524096: 32768, 1207959552: 8421888, 1476395008: 512, 1744830464: 8421378, 2013265920: 2, 2281701376: 8389120, 2550136832: 33280, 2818572288: 8421376, 3087007744: 8389122, 3355443200: 8388610, 3623878656: 32770, 3892314112: 514, 4160749568: 8388608, 1: 32768, 268435457: 2, 536870913: 8421888, 805306369: 8388608, 1073741825: 8421378, 1342177281: 33280, 1610612737: 512, 1879048193: 8389122, 2147483649: 8421890, 2415919105: 8421376, 2684354561: 8388610, 2952790017: 33282, 3221225473: 514, 3489660929: 8389120, 3758096385: 32770, 4026531841: 0, 134217729: 8421890, 402653185: 8421376, 671088641: 8388608, 939524097: 512, 1207959553: 32768, 1476395009: 8388610, 1744830465: 2, 2013265921: 33282, 2281701377: 32770, 2550136833: 8389122, 2818572289: 514, 3087007745: 8421888, 3355443201: 8389120, 3623878657: 0, 3892314113: 33280, 4160749569: 8421378 }, { "0": 1074282512, 16777216: 16384, 33554432: 524288, 50331648: 1074266128, 67108864: 1073741840, 83886080: 1074282496, 100663296: 1073758208, 117440512: 16, 134217728: 540672, 150994944: 1073758224, 167772160: 1073741824, 184549376: 540688, 201326592: 524304, 218103808: 0, 234881024: 16400, 251658240: 1074266112, 8388608: 1073758208, 25165824: 540688, 41943040: 16, 58720256: 1073758224, 75497472: 1074282512, 92274688: 1073741824, 109051904: 524288, 125829120: 1074266128, 142606336: 524304, 159383552: 0, 176160768: 16384, 192937984: 1074266112, 209715200: 1073741840, 226492416: 540672, 243269632: 1074282496, 260046848: 16400, 268435456: 0, 285212672: 1074266128, 301989888: 1073758224, 318767104: 1074282496, 335544320: 1074266112, 352321536: 16, 369098752: 540688, 385875968: 16384, 402653184: 16400, 419430400: 524288, 436207616: 524304, 452984832: 1073741840, 469762048: 540672, 486539264: 1073758208, 503316480: 1073741824, 520093696: 1074282512, 276824064: 540688, 293601280: 524288, 310378496: 1074266112, 327155712: 16384, 343932928: 1073758208, 360710144: 1074282512, 377487360: 16, 394264576: 1073741824, 411041792: 1074282496, 427819008: 1073741840, 444596224: 1073758224, 461373440: 524304, 478150656: 0, 494927872: 16400, 511705088: 1074266128, 528482304: 540672 }, { "0": 260, 1048576: 0, 2097152: 67109120, 3145728: 65796, 4194304: 65540, 5242880: 67108868, 6291456: 67174660, 7340032: 67174400, 8388608: 67108864, 9437184: 67174656, 10485760: 65792, 11534336: 67174404, 12582912: 67109124, 13631488: 65536, 14680064: 4, 15728640: 256, 524288: 67174656, 1572864: 67174404, 2621440: 0, 3670016: 67109120, 4718592: 67108868, 5767168: 65536, 6815744: 65540, 7864320: 260, 8912896: 4, 9961472: 256, 11010048: 67174400, 12058624: 65796, 13107200: 65792, 14155776: 67109124, 15204352: 67174660, 16252928: 67108864, 16777216: 67174656, 17825792: 65540, 18874368: 65536, 19922944: 67109120, 20971520: 256, 22020096: 67174660, 23068672: 67108868, 24117248: 0, 25165824: 67109124, 26214400: 67108864, 27262976: 4, 28311552: 65792, 29360128: 67174400, 30408704: 260, 31457280: 65796, 32505856: 67174404, 17301504: 67108864, 18350080: 260, 19398656: 67174656, 20447232: 0, 21495808: 65540, 22544384: 67109120, 23592960: 256, 24641536: 67174404, 25690112: 65536, 26738688: 67174660, 27787264: 65796, 28835840: 67108868, 29884416: 67109124, 30932992: 67174400, 31981568: 4, 33030144: 65792 }, { "0": 2151682048, 65536: 2147487808, 131072: 4198464, 196608: 2151677952, 262144: 0, 327680: 4198400, 393216: 2147483712, 458752: 4194368, 524288: 2147483648, 589824: 4194304, 655360: 64, 720896: 2147487744, 786432: 2151678016, 851968: 4160, 917504: 4096, 983040: 2151682112, 32768: 2147487808, 98304: 64, 163840: 2151678016, 229376: 2147487744, 294912: 4198400, 360448: 2151682112, 425984: 0, 491520: 2151677952, 557056: 4096, 622592: 2151682048, 688128: 4194304, 753664: 4160, 819200: 2147483648, 884736: 4194368, 950272: 4198464, 1015808: 2147483712, 1048576: 4194368, 1114112: 4198400, 1179648: 2147483712, 1245184: 0, 1310720: 4160, 1376256: 2151678016, 1441792: 2151682048, 1507328: 2147487808, 1572864: 2151682112, 1638400: 2147483648, 1703936: 2151677952, 1769472: 4198464, 1835008: 2147487744, 1900544: 4194304, 1966080: 64, 2031616: 4096, 1081344: 2151677952, 1146880: 2151682112, 1212416: 0, 1277952: 4198400, 1343488: 4194368, 1409024: 2147483648, 1474560: 2147487808, 1540096: 64, 1605632: 2147483712, 1671168: 4096, 1736704: 2147487744, 1802240: 2151678016, 1867776: 4160, 1933312: 2151682048, 1998848: 4194304, 2064384: 4198464 }, { "0": 128, 4096: 17039360, 8192: 262144, 12288: 536870912, 16384: 537133184, 20480: 16777344, 24576: 553648256, 28672: 262272, 32768: 16777216, 36864: 537133056, 40960: 536871040, 45056: 553910400, 49152: 553910272, 53248: 0, 57344: 17039488, 61440: 553648128, 2048: 17039488, 6144: 553648256, 10240: 128, 14336: 17039360, 18432: 262144, 22528: 537133184, 26624: 553910272, 30720: 536870912, 34816: 537133056, 38912: 0, 43008: 553910400, 47104: 16777344, 51200: 536871040, 55296: 553648128, 59392: 16777216, 63488: 262272, 65536: 262144, 69632: 128, 73728: 536870912, 77824: 553648256, 81920: 16777344, 86016: 553910272, 90112: 537133184, 94208: 16777216, 98304: 553910400, 102400: 553648128, 106496: 17039360, 110592: 537133056, 114688: 262272, 118784: 536871040, 122880: 0, 126976: 17039488, 67584: 553648256, 71680: 16777216, 75776: 17039360, 79872: 537133184, 83968: 536870912, 88064: 17039488, 92160: 128, 96256: 553910272, 100352: 262272, 104448: 553910400, 108544: 0, 112640: 553648128, 116736: 16777344, 120832: 262144, 124928: 537133056, 129024: 536871040 }, { "0": 268435464, 256: 8192, 512: 270532608, 768: 270540808, 1024: 268443648, 1280: 2097152, 1536: 2097160, 1792: 268435456, 2048: 0, 2304: 268443656, 2560: 2105344, 2816: 8, 3072: 270532616, 3328: 2105352, 3584: 8200, 3840: 270540800, 128: 270532608, 384: 270540808, 640: 8, 896: 2097152, 1152: 2105352, 1408: 268435464, 1664: 268443648, 1920: 8200, 2176: 2097160, 2432: 8192, 2688: 268443656, 2944: 270532616, 3200: 0, 3456: 270540800, 3712: 2105344, 3968: 268435456, 4096: 268443648, 4352: 270532616, 4608: 270540808, 4864: 8200, 5120: 2097152, 5376: 268435456, 5632: 268435464, 5888: 2105344, 6144: 2105352, 6400: 0, 6656: 8, 6912: 270532608, 7168: 8192, 7424: 268443656, 7680: 270540800, 7936: 2097160, 4224: 8, 4480: 2105344, 4736: 2097152, 4992: 268435464, 5248: 268443648, 5504: 8200, 5760: 270540808, 6016: 270532608, 6272: 270540800, 6528: 270532616, 6784: 8192, 7040: 2105352, 7296: 2097160, 7552: 0, 7808: 268435456, 8064: 268443656 }, { "0": 1048576, 16: 33555457, 32: 1024, 48: 1049601, 64: 34604033, 80: 0, 96: 1, 112: 34603009, 128: 33555456, 144: 1048577, 160: 33554433, 176: 34604032, 192: 34603008, 208: 1025, 224: 1049600, 240: 33554432, 8: 34603009, 24: 0, 40: 33555457, 56: 34604032, 72: 1048576, 88: 33554433, 104: 33554432, 120: 1025, 136: 1049601, 152: 33555456, 168: 34603008, 184: 1048577, 200: 1024, 216: 34604033, 232: 1, 248: 1049600, 256: 33554432, 272: 1048576, 288: 33555457, 304: 34603009, 320: 1048577, 336: 33555456, 352: 34604032, 368: 1049601, 384: 1025, 400: 34604033, 416: 1049600, 432: 1, 448: 0, 464: 34603008, 480: 33554433, 496: 1024, 264: 1049600, 280: 33555457, 296: 34603009, 312: 1, 328: 33554432, 344: 1048576, 360: 1025, 376: 34604032, 392: 33554433, 408: 34603008, 424: 0, 440: 34604033, 456: 1049601, 472: 1024, 488: 33555456, 504: 1048577 }, { "0": 134219808, 1: 131072, 2: 134217728, 3: 32, 4: 131104, 5: 134350880, 6: 134350848, 7: 2048, 8: 134348800, 9: 134219776, 10: 133120, 11: 134348832, 12: 2080, 13: 0, 14: 134217760, 15: 133152, 2147483648: 2048, 2147483649: 134350880, 2147483650: 134219808, 2147483651: 134217728, 2147483652: 134348800, 2147483653: 133120, 2147483654: 133152, 2147483655: 32, 2147483656: 134217760, 2147483657: 2080, 2147483658: 131104, 2147483659: 134350848, 2147483660: 0, 2147483661: 134348832, 2147483662: 134219776, 2147483663: 131072, 16: 133152, 17: 134350848, 18: 32, 19: 2048, 20: 134219776, 21: 134217760, 22: 134348832, 23: 131072, 24: 0, 25: 131104, 26: 134348800, 27: 134219808, 28: 134350880, 29: 133120, 30: 2080, 31: 134217728, 2147483664: 131072, 2147483665: 2048, 2147483666: 134348832, 2147483667: 133152, 2147483668: 32, 2147483669: 134348800, 2147483670: 134217728, 2147483671: 134219808, 2147483672: 134350880, 2147483673: 134217760, 2147483674: 134219776, 2147483675: 0, 2147483676: 133120, 2147483677: 2080, 2147483678: 131104, 2147483679: 134350848 } ], t = [ 4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679 ], m = (g.DES = e.extend({ _5: function() { for (var b = this._12.words, c = [], a = 0; 56 > a; a++) { var f = q[a] - 1; c[a] = (b[f >>> 5] >>> (31 - (f % 32))) & 1; } b = this._28 = []; for (f = 0; 16 > f; f++) { for (var d = (b[f] = []), e = r[f], a = 0; 24 > a; a++) (d[(a / 6) | 0] |= c[(p[a] - 1 + e) % 28] << (31 - (a % 6))), (d[4 + ((a / 6) | 0)] |= c[28 + ((p[a + 24] - 1 + e) % 28)] << (31 - (a % 6))); d[0] = (d[0] << 1) | (d[0] >>> 31); for (a = 1; 7 > a; a++) d[a] >>>= 4 * (a - 1) + 3; d[7] = (d[7] << 5) | (d[7] >>> 27); } c = this._29 = []; for (a = 0; 16 > a; a++) c[a] = b[15 - a]; }, encryptBlock: function(b, c) { this._4(b, c, this._28); }, decryptBlock: function(b, c) { this._4(b, c, this._29); }, _4: function(b, c, a) { this._1 = b[c]; this._0 = b[c + 1]; j.call(this, 4, 252645135); j.call(this, 16, 65535); l.call(this, 2, 858993459); l.call(this, 8, 16711935); j.call(this, 1, 1431655765); for (var f = 0; 16 > f; f++) { for (var d = a[f], e = this._1, h = this._0, g = 0, k = 0; 8 > k; k++) g |= s[k][((h ^ d[k]) & t[k]) >>> 0]; this._1 = h; this._0 = e ^ g; } a = this._1; this._1 = this._0; this._0 = a; j.call(this, 1, 1431655765); l.call(this, 8, 16711935); l.call(this, 2, 858993459); j.call(this, 16, 65535); j.call(this, 4, 252645135); b[c] = this._1; b[c + 1] = this._0; }, keySize: 2, ivSize: 2, blockSize: 2 })); h.DES = e._6(m); g = g.TripleDES = e.extend({ _5: function() { var b = this._12.words; this._17 = m.createEncryptor(n.create(b.slice(0, 2))); this._21 = m.createEncryptor(n.create(b.slice(2, 4))); this._23 = m.createEncryptor(n.create(b.slice(4, 6))); }, encryptBlock: function(b, c) { this._17.encryptBlock(b, c); this._21.decryptBlock(b, c); this._23.encryptBlock(b, c); }, decryptBlock: function(b, c) { this._23.decryptBlock(b, c); this._21.encryptBlock(b, c); this._17.decryptBlock(b, c); }, keySize: 6, ivSize: 2, blockSize: 2 }); h.TripleDES = e._6(g); })(); var getParam = (function() { var AES = { encrypt: function(text) { var secretkey = CryptoJS.MD5("cGFsbWNsaWVudA==") .toString() .substr(16, 16); var secretiv = CryptoJS.MD5("Y2xpZW50cGFsbQ==") .toString() .substr(0, 16); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.AES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(); } }; var DES = { encrypt: function(text) { var secretkey = CryptoJS.MD5("emhlbnFpcGFsbQ==") .toString() .substr(0, 16); var secretiv = CryptoJS.MD5("emhlbnFp") .toString() .substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(); }, decrypt: function(text) { var secretkey = CryptoJS.MD5("emhlbnFpcGFsbQ==") .toString() .substr(0, 16); var secretiv = CryptoJS.MD5("emhlbnFp") .toString() .substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.decrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(CryptoJS.enc.Utf8); } }; function ObjectSort(obj) { var newObject = {}; Object.keys(obj) .sort() .map(function(key) { newObject[key] = obj[key]; }); return newObject; } function MyEncode(str) { var arr = akb33.split('') var b = new Base64; arr.forEach(times => { switch(times) { case "1": str = AES.encrypt(str) break; case "2": str = DES.encrypt(str) break; case "3": str = b.encode(str) break; } }) return str; } return function(method, obj) { var appId = "4f0e3a273d547ce6b7147bfa7ceb4b6e"; var timestamp = new Date().getTime(); var need = { appId: appId, method: method, timestamp: timestamp, clienttype: "WEB", object: obj, secret: hex_md5(appId + method + timestamp + "WEB" + obj) }; return AES.encrypt(JSON.stringify(need)); }; })(); var decryptData = (function() { var akb33 = "32223"; var akb34 = "N4EDAQpO2ejqgCoX"; var akb35 = "=qoKNLgdAjJbU8zx"; var akb36 = "mAkJqt8coXQ96zML"; var akb48 = "t4ABRmeN" var DES = { encrypt: function(text) { var secretkey = (CryptoJS.MD5(akb36).toString()).substr(0, 16); var secretiv = (CryptoJS.MD5(akb48).toString()).substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString() }, decrypt: function(text) { var secretkey = (CryptoJS.MD5(akb36).toString()).substr(0, 16); var secretiv = (CryptoJS.MD5(akb48).toString()).substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.decrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(CryptoJS.enc.Utf8) } }; var AES = { encrypt: function(text) { var secretkey = (CryptoJS.MD5(akb34).toString()).substr(16, 16); var secretiv = (CryptoJS.MD5(akb35).toString()).substr(0, 16); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.AES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString() }, decrypt: function(text) { var secretkey = (CryptoJS.MD5(akb34).toString()).substr(16, 16); var secretiv = (CryptoJS.MD5(akb35).toString()).substr(0, 16); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.AES.decrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(CryptoJS.enc.Utf8) }, }; function MyDecode(str, nopop) { var arr = akb33.split('').reverse() var b = new Base64; arr.forEach(times => { switch(times) { case "1": str = AES.decrypt(str) break; case "2": str = DES.decrypt(str) break; case "3": str = b.decode(str) break; } }) if (!nopop) { str = b.encode(str) } return str; } return function(data) { return MyDecode(data) } })(); var AES = { encrypt: function(text) { var secretkey = CryptoJS.MD5("cGFsbWNsaWVudA==") .toString() .substr(16, 16); var secretiv = CryptoJS.MD5("Y2xpZW50cGFsbQ==") .toString() .substr(0, 16); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.AES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(); }, decrypt: function(text) { var secretkey = CryptoJS.MD5("cGFsbXNlcnZlcg==") .toString() .substr(16, 16); var secretiv = CryptoJS.MD5("c2VydmVycGFsbQ==") .toString() .substr(0, 16); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.AES.decrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(CryptoJS.enc.Utf8); } }; var DES = { encrypt: function(text) { var secretkey = CryptoJS.MD5("emhlbnFpcGFsbQ==") .toString() .substr(0, 16); var secretiv = CryptoJS.MD5("emhlbnFp") .toString() .substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(); }, decrypt: function(text) { var secretkey = CryptoJS.MD5("emhlbnFpcGFsbQ==") .toString() .substr(0, 16); var secretiv = CryptoJS.MD5("emhlbnFp") .toString() .substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.decrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString(CryptoJS.enc.Utf8); } }; var b = new Base64(); function hex_md5(a) { return binl2hex(core_md5(str2binl(a), a.length * chrsz)); } function b64_md5(a) { return binl2b64(core_md5(str2binl(a), a.length * chrsz)); } function str_md5(a) { return binl2str(core_md5(str2binl(a), a.length * chrsz)); } function hex_hmac_md5(a, b) { return binl2hex(core_hmac_md5(a, b)); } function b64_hmac_md5(a, b) { return binl2b64(core_hmac_md5(a, b)); } function str_hmac_md5(a, b) { return binl2str(core_hmac_md5(a, b)); } function md5_vm_test() { return "900150983cd24fb0d6963f7d28e17f72" == hex_md5("abc"); } function core_md5(a, b) { var c, d, e, f, g, h, i, j, k; for ( a[b >> 5] |= 128 << b % 32, a[(((b + 64) >>> 9) << 4) + 14] = b, c = 1732584193, d = -271733879, e = -1732584194, f = 271733878, g = 0; g < a.length; g += 16 ) (h = c), (i = d), (j = e), (k = f), (c = md5_ff(c, d, e, f, a[g + 0], 7, -680876936)), (f = md5_ff(f, c, d, e, a[g + 1], 12, -389564586)), (e = md5_ff(e, f, c, d, a[g + 2], 17, 606105819)), (d = md5_ff(d, e, f, c, a[g + 3], 22, -1044525330)), (c = md5_ff(c, d, e, f, a[g + 4], 7, -176418897)), (f = md5_ff(f, c, d, e, a[g + 5], 12, 1200080426)), (e = md5_ff(e, f, c, d, a[g + 6], 17, -1473231341)), (d = md5_ff(d, e, f, c, a[g + 7], 22, -45705983)), (c = md5_ff(c, d, e, f, a[g + 8], 7, 1770035416)), (f = md5_ff(f, c, d, e, a[g + 9], 12, -1958414417)), (e = md5_ff(e, f, c, d, a[g + 10], 17, -42063)), (d = md5_ff(d, e, f, c, a[g + 11], 22, -1990404162)), (c = md5_ff(c, d, e, f, a[g + 12], 7, 1804603682)), (f = md5_ff(f, c, d, e, a[g + 13], 12, -40341101)), (e = md5_ff(e, f, c, d, a[g + 14], 17, -1502002290)), (d = md5_ff(d, e, f, c, a[g + 15], 22, 1236535329)), (c = md5_gg(c, d, e, f, a[g + 1], 5, -165796510)), (f = md5_gg(f, c, d, e, a[g + 6], 9, -1069501632)), (e = md5_gg(e, f, c, d, a[g + 11], 14, 643717713)), (d = md5_gg(d, e, f, c, a[g + 0], 20, -373897302)), (c = md5_gg(c, d, e, f, a[g + 5], 5, -701558691)), (f = md5_gg(f, c, d, e, a[g + 10], 9, 38016083)), (e = md5_gg(e, f, c, d, a[g + 15], 14, -660478335)), (d = md5_gg(d, e, f, c, a[g + 4], 20, -405537848)), (c = md5_gg(c, d, e, f, a[g + 9], 5, 568446438)), (f = md5_gg(f, c, d, e, a[g + 14], 9, -1019803690)), (e = md5_gg(e, f, c, d, a[g + 3], 14, -187363961)), (d = md5_gg(d, e, f, c, a[g + 8], 20, 1163531501)), (c = md5_gg(c, d, e, f, a[g + 13], 5, -1444681467)), (f = md5_gg(f, c, d, e, a[g + 2], 9, -51403784)), (e = md5_gg(e, f, c, d, a[g + 7], 14, 1735328473)), (d = md5_gg(d, e, f, c, a[g + 12], 20, -1926607734)), (c = md5_hh(c, d, e, f, a[g + 5], 4, -378558)), (f = md5_hh(f, c, d, e, a[g + 8], 11, -2022574463)), (e = md5_hh(e, f, c, d, a[g + 11], 16, 1839030562)), (d = md5_hh(d, e, f, c, a[g + 14], 23, -35309556)), (c = md5_hh(c, d, e, f, a[g + 1], 4, -1530992060)), (f = md5_hh(f, c, d, e, a[g + 4], 11, 1272893353)), (e = md5_hh(e, f, c, d, a[g + 7], 16, -155497632)), (d = md5_hh(d, e, f, c, a[g + 10], 23, -1094730640)), (c = md5_hh(c, d, e, f, a[g + 13], 4, 681279174)), (f = md5_hh(f, c, d, e, a[g + 0], 11, -358537222)), (e = md5_hh(e, f, c, d, a[g + 3], 16, -722521979)), (d = md5_hh(d, e, f, c, a[g + 6], 23, 76029189)), (c = md5_hh(c, d, e, f, a[g + 9], 4, -640364487)), (f = md5_hh(f, c, d, e, a[g + 12], 11, -421815835)), (e = md5_hh(e, f, c, d, a[g + 15], 16, 530742520)), (d = md5_hh(d, e, f, c, a[g + 2], 23, -995338651)), (c = md5_ii(c, d, e, f, a[g + 0], 6, -198630844)), (f = md5_ii(f, c, d, e, a[g + 7], 10, 1126891415)), (e = md5_ii(e, f, c, d, a[g + 14], 15, -1416354905)), (d = md5_ii(d, e, f, c, a[g + 5], 21, -57434055)), (c = md5_ii(c, d, e, f, a[g + 12], 6, 1700485571)), (f = md5_ii(f, c, d, e, a[g + 3], 10, -1894986606)), (e = md5_ii(e, f, c, d, a[g + 10], 15, -1051523)), (d = md5_ii(d, e, f, c, a[g + 1], 21, -2054922799)), (c = md5_ii(c, d, e, f, a[g + 8], 6, 1873313359)), (f = md5_ii(f, c, d, e, a[g + 15], 10, -30611744)), (e = md5_ii(e, f, c, d, a[g + 6], 15, -1560198380)), (d = md5_ii(d, e, f, c, a[g + 13], 21, 1309151649)), (c = md5_ii(c, d, e, f, a[g + 4], 6, -145523070)), (f = md5_ii(f, c, d, e, a[g + 11], 10, -1120210379)), (e = md5_ii(e, f, c, d, a[g + 2], 15, 718787259)), (d = md5_ii(d, e, f, c, a[g + 9], 21, -343485551)), (c = safe_add(c, h)), (d = safe_add(d, i)), (e = safe_add(e, j)), (f = safe_add(f, k)); return Array(c, d, e, f); } function md5_cmn(a, b, c, d, e, f) { return safe_add(bit_rol(safe_add(safe_add(b, a), safe_add(d, f)), e), c); } function md5_ff(a, b, c, d, e, f, g) { return md5_cmn((b & c) | (~b & d), a, b, e, f, g); } function md5_gg(a, b, c, d, e, f, g) { return md5_cmn((b & d) | (c & ~d), a, b, e, f, g); } function md5_hh(a, b, c, d, e, f, g) { return md5_cmn(b ^ c ^ d, a, b, e, f, g); } function md5_ii(a, b, c, d, e, f, g) { return md5_cmn(c ^ (b | ~d), a, b, e, f, g); } function core_hmac_md5(a, b) { var d, e, f, g, c = str2binl(a); for ( c.length > 16 && (c = core_md5(c, a.length * chrsz)), d = Array(16), e = Array(16), f = 0; 16 > f; f++ ) (d[f] = 909522486 ^ c[f]), (e[f] = 1549556828 ^ c[f]); return ( (g = core_md5(d.concat(str2binl(b)), 512 + b.length * chrsz)), core_md5(e.concat(g), 640) ); } function safe_add(a, b) { var c = (65535 & a) + (65535 & b), d = (a >> 16) + (b >> 16) + (c >> 16); return (d << 16) | (65535 & c); } function bit_rol(a, b) { return (a << b) | (a >>> (32 - b)); } function str2binl(a) { var d, b = Array(), c = (1 << chrsz) - 1; for (d = 0; d < a.length * chrsz; d += chrsz) b[d >> 5] |= (a.charCodeAt(d / chrsz) & c) << d % 32; return b; } function binl2str(a) { var d, b = "", c = (1 << chrsz) - 1; for (d = 0; d < 32 * a.length; d += chrsz) b += String.fromCharCode((a[d >> 5] >>> d % 32) & c); return b; } function binl2hex(a) { var d, b = hexcase ? "0123456789ABCDEF" : "0123456789abcdef", c = ""; for (d = 0; d < 4 * a.length; d++) c += b.charAt(15 & (a[d >> 2] >> (8 * (d % 4) + 4))) + b.charAt(15 & (a[d >> 2] >> (8 * (d % 4)))); return c; } function binl2b64(a) { var d, e, f, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = ""; for (d = 0; d < 4 * a.length; d += 3) for ( e = ((255 & (a[d >> 2] >> (8 * (d % 4)))) << 16) | ((255 & (a[(d + 1) >> 2] >> (8 * ((d + 1) % 4)))) << 8) | (255 & (a[(d + 2) >> 2] >> (8 * ((d + 2) % 4)))), f = 0; 4 > f; f++ ) c += 8 * d + 6 * f > 32 * a.length ? b64pad : b.charAt(63 & (e >> (6 * (3 - f)))); return c; } function encode_param(a) { var b = new Base64(); var akb33 = "32223"; var akb34 = "N4EDAQpO2ejqgCoX"; var akb35 = "=qoKNLgdAjJbU8zx"; var akb36 = "mAkJqt8coXQ96zML"; var akb48 = "t4ABRmeN" var CryptoJS = CryptoJS || function(h, r) { var k = {}, l = k.lib = {}, n = function() {}, f = l.Base = { extend: function(a) { n.prototype = this; var b = new n; a && b.mixIn(a); b.hasOwnProperty("init") || (b.init = function() { b.s.init.apply(this, arguments) }); b.init.prototype = b; b.s = this; return b }, create: function() { var a = this.extend(); a.init.apply(a, arguments); return a }, init: function() {}, mixIn: function(a) { for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b]); a.hasOwnProperty("toString") && (this.toString = a.toString) }, clone: function() { return this.init.prototype.extend(this) } }, j = l.WordArray = f.extend({ init: function(a, b) { a = this.words = a || []; this.sigBytes = b != r ? b : 4 * a.length }, toString: function(a) { return (a || s).stringify(this) }, concat: function(a) { var b = this.words, d = a.words, c = this.sigBytes; a = a.sigBytes; this.clamp(); if (c % 4) for (var e = 0; e < a; e++) b[c + e >>> 2] |= (d[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((c + e) % 4); else if (65535 < d.length) for (e = 0; e < a; e += 4) b[c + e >>> 2] = d[e >>> 2]; else b.push.apply(b, d); this.sigBytes += a; return this }, clamp: function() { var a = this.words, b = this.sigBytes; a[b >>> 2] &= 4294967295 << 32 - 8 * (b % 4); a.length = h.ceil(b / 4) }, clone: function() { var a = f.clone.call(this); a.words = this.words.slice(0); return a }, random: function(a) { for (var b = [], d = 0; d < a; d += 4) b.push(4294967296 * h.random() | 0); return new j.init(b, a) } }), m = k.enc = {}, s = m.Hex = { stringify: function(a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) { var e = b[c >>> 2] >>> 24 - 8 * (c % 4) & 255; d.push((e >>> 4).toString(16)); d.push((e & 15).toString(16)) } return d.join("") }, parse: function(a) { for (var b = a.length, d = [], c = 0; c < b; c += 2) d[c >>> 3] |= parseInt(a.substr(c, 2), 16) << 24 - 4 * (c % 8); return new j.init(d, b / 2) } }, p = m.Latin1 = { stringify: function(a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) d.push(String.fromCharCode(b[c >>> 2] >>> 24 - 8 * (c % 4) & 255)); return d.join("") }, parse: function(a) { for (var b = a.length, d = [], c = 0; c < b; c++) d[c >>> 2] |= (a.charCodeAt(c) & 255) << 24 - 8 * (c % 4); return new j.init(d, b) } }, t = m.Utf8 = { stringify: function(a) { try { return decodeURIComponent(escape(p.stringify(a))) } catch (b) { throw Error("Malformed UTF-8 data") } }, parse: function(a) { return p.parse(unescape(encodeURIComponent(a))) } }, q = l.BufferedBlockAlgorithm = f.extend({ reset: function() { this._2 = new j.init; this._22 = 0 }, _8: function(a) { "string" == typeof a && (a = t.parse(a)); this._2.concat(a); this._22 += a.sigBytes }, _3: function(a) { var b = this._2, d = b.words, c = b.sigBytes, e = this.blockSize, f = c / (4 * e), f = a ? h.ceil(f) : h.max((f | 0) - this._18, 0); a = f * e; c = h.min(4 * a, c); if (a) { for (var g = 0; g < a; g += e) this._20(d, g); g = d.splice(0, a); b.sigBytes -= c } return new j.init(g, c) }, clone: function() { var a = f.clone.call(this); a._2 = this._2.clone(); return a }, _18: 0 }); l.Hasher = q.extend({ cfg: f.extend(), init: function(a) { this.cfg = this.cfg.extend(a); this.reset() }, reset: function() { q.reset.call(this); this._5() }, update: function(a) { this._8(a); this._3(); return this }, finalize: function(a) { a && this._8(a); return this._9() }, blockSize: 16, _6: function(a) { return function(b, d) { return (new a.init(d)).finalize(b) } }, _30: function(a) { return function(b, d) { return (new u.HMAC.init(a, d)).finalize(b) } } }); var u = k.algo = {}; return k }(Math); (function() { var h = CryptoJS, j = h.lib.WordArray; h.enc.Base64 = { stringify: function(b) { var e = b.words, f = b.sigBytes, c = this._13; b.clamp(); b = []; for (var a = 0; a < f; a += 3) for (var d = (e[a >>> 2] >>> 24 - 8 * (a % 4) & 255) << 16 | (e[a + 1 >>> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) << 8 | e[a + 2 >>> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) b.push(c.charAt(d >>> 6 * (3 - g) & 63)); if (e = c.charAt(64)) for (; b.length % 4;) b.push(e); return b.join("") }, parse: function(b) { var e = b.length, f = this._13, c = f.charAt(64); c && (c = b.indexOf(c), -1 != c && (e = c)); for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { var g = f.indexOf(b.charAt(d - 1)) << 2 * (d % 4), h = f.indexOf(b.charAt(d)) >>> 6 - 2 * (d % 4); c[a >>> 2] |= (g | h) << 24 - 8 * (a % 4); a++ } return j.create(c, a) }, _13: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" } })(); CryptoJS.lib.Cipher || function(u) { var g = CryptoJS, f = g.lib, k = f.Base, l = f.WordArray, q = f.BufferedBlockAlgorithm, r = g.enc.Base64, v = g.algo.EvpKDF, n = f.Cipher = q.extend({ cfg: k.extend(), createEncryptor: function(a, b) { return this.create(this._11, a, b) }, createDecryptor: function(a, b) { return this.create(this._25, a, b) }, init: function(a, b, c) { this.cfg = this.cfg.extend(c); this._15 = a; this._12 = b; this.reset() }, reset: function() { q.reset.call(this); this._5() }, process: function(a) { this._8(a); return this._3() }, finalize: function(a) { a && this._8(a); return this._9() }, keySize: 4, ivSize: 4, _11: 1, _25: 2, _6: function(a) { return { encrypt: function(b, c, d) { return ("string" == typeof c ? s : j).encrypt(a, b, c, d) }, decrypt: function(b, c, d) { return ("string" == typeof c ? s : j).decrypt(a, b, c, d) } } } }); f.StreamCipher = n.extend({ _9: function() { return this._3(!0) }, blockSize: 1 }); var m = g.mode = {}, t = function(a, b, c) { var d = this._16; d ? this._16 = u : d = this._19; for (var e = 0; e < c; e++) a[b + e] ^= d[e] }, h = (f.BlockCipherMode = k.extend({ createEncryptor: function(a, b) { return this.Encryptor.create(a, b) }, createDecryptor: function(a, b) { return this.Decryptor.create(a, b) }, init: function(a, b) { this._10 = a; this._16 = b } })).extend(); h.Encryptor = h.extend({ processBlock: function(a, b) { var c = this._10, d = c.blockSize; t.call(this, a, b, d); c.encryptBlock(a, b); this._19 = a.slice(b, b + d) } }); h.Decryptor = h.extend({ processBlock: function(a, b) { var c = this._10, d = c.blockSize, e = a.slice(b, b + d); c.decryptBlock(a, b); t.call(this, a, b, d); this._19 = e } }); m = m.CBC = h; h = (g.pad = {}).Pkcs7 = { pad: function(a, b) { for (var c = 4 * b, c = c - a.sigBytes % c, d = c << 24 | c << 16 | c << 8 | c, e = [], f = 0; f < c; f += 4) e.push(d); c = l.create(e, c); a.concat(c) }, unpad: function(a) { a.sigBytes -= a.words[a.sigBytes - 1 >>> 2] & 255 } }; f.BlockCipher = n.extend({ cfg: n.cfg.extend({ mode: m, padding: h }), reset: function() { n.reset.call(this); var a = this.cfg, b = a.iv, a = a.mode; if (this._15 == this._11) var c = a.createEncryptor; else c = a.createDecryptor, this._18 = 1; this._31 = c.call(a, this, b && b.words) }, _20: function(a, b) { this._31.processBlock(a, b) }, _9: function() { var a = this.cfg.padding; if (this._15 == this._11) { a.pad(this._2, this.blockSize); var b = this._3(!0) } else b = this._3(!0), a.unpad(b); return b }, blockSize: 4 }); var p = f.CipherParams = k.extend({ init: function(a) { this.mixIn(a) }, toString: function(a) { return (a || this.formatter).stringify(this) } }), m = (g.format = {}).OpenSSL = { stringify: function(a) { var b = a.ciphertext; a = a.salt; return (a ? l.create([1398893684, 1701076831]).concat(a).concat(b) : b).toString(r) }, parse: function(a) { a = r.parse(a); var b = a.words; if (1398893684 == b[0] && 1701076831 == b[1]) { var c = l.create(b.slice(2, 4)); b.splice(0, 4); a.sigBytes -= 16 } return p.create({ ciphertext: a, salt: c }) } }, j = f.SerializableCipher = k.extend({ cfg: k.extend({ format: m }), encrypt: function(a, b, c, d) { d = this.cfg.extend(d); var e = a.createEncryptor(c, d); b = e.finalize(b); e = e.cfg; return p.create({ ciphertext: b, key: c, iv: e.iv, algorithm: a, mode: e.mode, padding: e.padding, blockSize: a.blockSize, formatter: d.format }) }, decrypt: function(a, b, c, d) { d = this.cfg.extend(d); b = this._14(b, d.format); return a.createDecryptor(c, d).finalize(b.ciphertext) }, _14: function(a, b) { return "string" == typeof a ? b.parse(a, this) : a } }), g = (g.kdf = {}).OpenSSL = { execute: function(a, b, c, d) { d || (d = l.random(8)); a = v.create({ keySize: b + c }).compute(a, d); c = l.create(a.words.slice(b), 4 * c); a.sigBytes = 4 * b; return p.create({ key: a, iv: c, salt: d }) } }, s = f.PasswordBasedCipher = j.extend({ cfg: j.cfg.extend({ kdf: g }), encrypt: function(a, b, c, d) { d = this.cfg.extend(d); c = d.kdf.execute(c, a.keySize, a.ivSize); d.iv = c.iv; a = j.encrypt.call(this, a, b, c.key, d); a.mixIn(c); return a }, decrypt: function(a, b, c, d) { d = this.cfg.extend(d); b = this._14(b, d.format); c = d.kdf.execute(c, a.keySize, a.ivSize, b.salt); d.iv = c.iv; return j.decrypt.call(this, a, b, c.key, d) } }) }(); CryptoJS.mode.ECB = function() { var a = CryptoJS.lib.BlockCipherMode.extend(); a.Encryptor = a.extend({ processBlock: function(a, b) { this._10.encryptBlock(a, b) } }); a.Decryptor = a.extend({ processBlock: function(a, b) { this._10.decryptBlock(a, b) } }); return a }(); (function(E) { function h(a, f, g, j, p, h, k) { a = a + (f & g | ~f & j) + p + k; return (a << h | a >>> 32 - h) + f } function k(a, f, g, j, p, h, k) { a = a + (f & j | g & ~j) + p + k; return (a << h | a >>> 32 - h) + f } function l(a, f, g, j, h, k, l) { a = a + (f ^ g ^ j) + h + l; return (a << k | a >>> 32 - k) + f } function n(a, f, g, j, h, k, l) { a = a + (g ^ (f | ~j)) + h + l; return (a << k | a >>> 32 - k) + f } for (var r = CryptoJS, q = r.lib, F = q.WordArray, s = q.Hasher, q = r.algo, a = [], t = 0; 64 > t; t++) a[t] = 4294967296 * E.abs(E.sin(t + 1)) | 0; q = q.MD5 = s.extend({ _5: function() { this._7 = new F.init([1732584193, 4023233417, 2562383102, 271733878]) }, _20: function(m, f) { for (var g = 0; 16 > g; g++) { var j = f + g, p = m[j]; m[j] = (p << 8 | p >>> 24) & 16711935 | (p << 24 | p >>> 8) & 4278255360 } var g = this._7.words, j = m[f + 0], p = m[f + 1], q = m[f + 2], r = m[f + 3], s = m[f + 4], t = m[f + 5], u = m[f + 6], v = m[f + 7], w = m[f + 8], x = m[f + 9], y = m[f + 10], z = m[f + 11], A = m[f + 12], B = m[f + 13], C = m[f + 14], D = m[f + 15], b = g[0], c = g[1], d = g[2], e = g[3], b = h(b, c, d, e, j, 7, a[0]), e = h(e, b, c, d, p, 12, a[1]), d = h(d, e, b, c, q, 17, a[2]), c = h(c, d, e, b, r, 22, a[3]), b = h(b, c, d, e, s, 7, a[4]), e = h(e, b, c, d, t, 12, a[5]), d = h(d, e, b, c, u, 17, a[6]), c = h(c, d, e, b, v, 22, a[7]), b = h(b, c, d, e, w, 7, a[8]), e = h(e, b, c, d, x, 12, a[9]), d = h(d, e, b, c, y, 17, a[10]), c = h(c, d, e, b, z, 22, a[11]), b = h(b, c, d, e, A, 7, a[12]), e = h(e, b, c, d, B, 12, a[13]), d = h(d, e, b, c, C, 17, a[14]), c = h(c, d, e, b, D, 22, a[15]), b = k(b, c, d, e, p, 5, a[16]), e = k(e, b, c, d, u, 9, a[17]), d = k(d, e, b, c, z, 14, a[18]), c = k(c, d, e, b, j, 20, a[19]), b = k(b, c, d, e, t, 5, a[20]), e = k(e, b, c, d, y, 9, a[21]), d = k(d, e, b, c, D, 14, a[22]), c = k(c, d, e, b, s, 20, a[23]), b = k(b, c, d, e, x, 5, a[24]), e = k(e, b, c, d, C, 9, a[25]), d = k(d, e, b, c, r, 14, a[26]), c = k(c, d, e, b, w, 20, a[27]), b = k(b, c, d, e, B, 5, a[28]), e = k(e, b, c, d, q, 9, a[29]), d = k(d, e, b, c, v, 14, a[30]), c = k(c, d, e, b, A, 20, a[31]), b = l(b, c, d, e, t, 4, a[32]), e = l(e, b, c, d, w, 11, a[33]), d = l(d, e, b, c, z, 16, a[34]), c = l(c, d, e, b, C, 23, a[35]), b = l(b, c, d, e, p, 4, a[36]), e = l(e, b, c, d, s, 11, a[37]), d = l(d, e, b, c, v, 16, a[38]), c = l(c, d, e, b, y, 23, a[39]), b = l(b, c, d, e, B, 4, a[40]), e = l(e, b, c, d, j, 11, a[41]), d = l(d, e, b, c, r, 16, a[42]), c = l(c, d, e, b, u, 23, a[43]), b = l(b, c, d, e, x, 4, a[44]), e = l(e, b, c, d, A, 11, a[45]), d = l(d, e, b, c, D, 16, a[46]), c = l(c, d, e, b, q, 23, a[47]), b = n(b, c, d, e, j, 6, a[48]), e = n(e, b, c, d, v, 10, a[49]), d = n(d, e, b, c, C, 15, a[50]), c = n(c, d, e, b, t, 21, a[51]), b = n(b, c, d, e, A, 6, a[52]), e = n(e, b, c, d, r, 10, a[53]), d = n(d, e, b, c, y, 15, a[54]), c = n(c, d, e, b, p, 21, a[55]), b = n(b, c, d, e, w, 6, a[56]), e = n(e, b, c, d, D, 10, a[57]), d = n(d, e, b, c, u, 15, a[58]), c = n(c, d, e, b, B, 21, a[59]), b = n(b, c, d, e, s, 6, a[60]), e = n(e, b, c, d, z, 10, a[61]), d = n(d, e, b, c, q, 15, a[62]), c = n(c, d, e, b, x, 21, a[63]); g[0] = g[0] + b | 0; g[1] = g[1] + c | 0; g[2] = g[2] + d | 0; g[3] = g[3] + e | 0 }, _9: function() { var a = this._2, f = a.words, g = 8 * this._22, j = 8 * a.sigBytes; f[j >>> 5] |= 128 << 24 - j % 32; var h = E.floor(g / 4294967296); f[(j + 64 >>> 9 << 4) + 15] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360; f[(j + 64 >>> 9 << 4) + 14] = (g << 8 | g >>> 24) & 16711935 | (g << 24 | g >>> 8) & 4278255360; a.sigBytes = 4 * (f.length + 1); this._3(); a = this._7; f = a.words; for (g = 0; 4 > g; g++) j = f[g], f[g] = (j << 8 | j >>> 24) & 16711935 | (j << 24 | j >>> 8) & 4278255360; return a }, clone: function() { var a = s.clone.call(this); a._7 = this._7.clone(); return a } }); r.MD5 = s._6(q); r.HmacMD5 = s._30(q) })(Math); (function() { for (var q = CryptoJS, x = q.lib.BlockCipher, r = q.algo, j = [], y = [], z = [], A = [], B = [], C = [], s = [], u = [], v = [], w = [], g = [], k = 0; 256 > k; k++) g[k] = 128 > k ? k << 1 : k << 1 ^ 283; for (var n = 0, l = 0, k = 0; 256 > k; k++) { var f = l ^ l << 1 ^ l << 2 ^ l << 3 ^ l << 4, f = f >>> 8 ^ f & 255 ^ 99; j[n] = f; y[f] = n; var t = g[n], D = g[t], E = g[D], b = 257 * g[f] ^ 16843008 * f; z[n] = b << 24 | b >>> 8; A[n] = b << 16 | b >>> 16; B[n] = b << 8 | b >>> 24; C[n] = b; b = 16843009 * E ^ 65537 * D ^ 257 * t ^ 16843008 * n; s[f] = b << 24 | b >>> 8; u[f] = b << 16 | b >>> 16; v[f] = b << 8 | b >>> 24; w[f] = b; n ? (n = t ^ g[g[g[E ^ t]]], l ^= g[g[l]]) : n = l = 1 } var F = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], r = r.AES = x.extend({ _5: function() { for (var c = this._12, e = c.words, a = c.sigBytes / 4, c = 4 * ((this._26 = a + 6) + 1), b = this._27 = [], h = 0; h < c; h++) if (h < a) b[h] = e[h]; else { var d = b[h - 1]; h % a ? 6 < a && 4 == h % a && (d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255]) : (d = d << 8 | d >>> 24, d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255], d ^= F[h / a | 0] << 24); b[h] = b[h - a] ^ d } e = this._24 = []; for (a = 0; a < c; a++) h = c - a, d = a % 4 ? b[h] : b[h - 4], e[a] = 4 > a || 4 >= h ? d : s[j[d >>> 24]] ^ u[j[d >>> 16 & 255]] ^ v[j[d >>> 8 & 255]] ^ w[j[d & 255]] }, encryptBlock: function(c, e) { this._4(c, e, this._27, z, A, B, C, j) }, decryptBlock: function(c, e) { var a = c[e + 1]; c[e + 1] = c[e + 3]; c[e + 3] = a; this._4(c, e, this._24, s, u, v, w, y); a = c[e + 1]; c[e + 1] = c[e + 3]; c[e + 3] = a }, _4: function(c, e, a, b, h, d, j, m) { for (var n = this._26, f = c[e] ^ a[0], g = c[e + 1] ^ a[1], k = c[e + 2] ^ a[2], p = c[e + 3] ^ a[3], l = 4, t = 1; t < n; t++) var q = b[f >>> 24] ^ h[g >>> 16 & 255] ^ d[k >>> 8 & 255] ^ j[p & 255] ^ a[l++], r = b[g >>> 24] ^ h[k >>> 16 & 255] ^ d[p >>> 8 & 255] ^ j[f & 255] ^ a[l++], s = b[k >>> 24] ^ h[p >>> 16 & 255] ^ d[f >>> 8 & 255] ^ j[g & 255] ^ a[l++], p = b[p >>> 24] ^ h[f >>> 16 & 255] ^ d[g >>> 8 & 255] ^ j[k & 255] ^ a[l++], f = q, g = r, k = s; q = (m[f >>> 24] << 24 | m[g >>> 16 & 255] << 16 | m[k >>> 8 & 255] << 8 | m[p & 255]) ^ a[l++]; r = (m[g >>> 24] << 24 | m[k >>> 16 & 255] << 16 | m[p >>> 8 & 255] << 8 | m[f & 255]) ^ a[l++]; s = (m[k >>> 24] << 24 | m[p >>> 16 & 255] << 16 | m[f >>> 8 & 255] << 8 | m[g & 255]) ^ a[l++]; p = (m[p >>> 24] << 24 | m[f >>> 16 & 255] << 16 | m[g >>> 8 & 255] << 8 | m[k & 255]) ^ a[l++]; c[e] = q; c[e + 1] = r; c[e + 2] = s; c[e + 3] = p }, keySize: 8 }); q.AES = x._6(r) })(); (function() { function j(b, c) { var a = (this._1 >>> b ^ this._0) & c; this._0 ^= a; this._1 ^= a << b } function l(b, c) { var a = (this._0 >>> b ^ this._1) & c; this._1 ^= a; this._0 ^= a << b } var h = CryptoJS, e = h.lib, n = e.WordArray, e = e.BlockCipher, g = h.algo, q = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], p = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], r = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], s = [{ "0": 8421888, 268435456: 32768, 536870912: 8421378, 805306368: 2, 1073741824: 512, 1342177280: 8421890, 1610612736: 8389122, 1879048192: 8388608, 2147483648: 514, 2415919104: 8389120, 2684354560: 33280, 2952790016: 8421376, 3221225472: 32770, 3489660928: 8388610, 3758096384: 0, 4026531840: 33282, 134217728: 0, 402653184: 8421890, 671088640: 33282, 939524096: 32768, 1207959552: 8421888, 1476395008: 512, 1744830464: 8421378, 2013265920: 2, 2281701376: 8389120, 2550136832: 33280, 2818572288: 8421376, 3087007744: 8389122, 3355443200: 8388610, 3623878656: 32770, 3892314112: 514, 4160749568: 8388608, 1: 32768, 268435457: 2, 536870913: 8421888, 805306369: 8388608, 1073741825: 8421378, 1342177281: 33280, 1610612737: 512, 1879048193: 8389122, 2147483649: 8421890, 2415919105: 8421376, 2684354561: 8388610, 2952790017: 33282, 3221225473: 514, 3489660929: 8389120, 3758096385: 32770, 4026531841: 0, 134217729: 8421890, 402653185: 8421376, 671088641: 8388608, 939524097: 512, 1207959553: 32768, 1476395009: 8388610, 1744830465: 2, 2013265921: 33282, 2281701377: 32770, 2550136833: 8389122, 2818572289: 514, 3087007745: 8421888, 3355443201: 8389120, 3623878657: 0, 3892314113: 33280, 4160749569: 8421378 }, { "0": 1074282512, 16777216: 16384, 33554432: 524288, 50331648: 1074266128, 67108864: 1073741840, 83886080: 1074282496, 100663296: 1073758208, 117440512: 16, 134217728: 540672, 150994944: 1073758224, 167772160: 1073741824, 184549376: 540688, 201326592: 524304, 218103808: 0, 234881024: 16400, 251658240: 1074266112, 8388608: 1073758208, 25165824: 540688, 41943040: 16, 58720256: 1073758224, 75497472: 1074282512, 92274688: 1073741824, 109051904: 524288, 125829120: 1074266128, 142606336: 524304, 159383552: 0, 176160768: 16384, 192937984: 1074266112, 209715200: 1073741840, 226492416: 540672, 243269632: 1074282496, 260046848: 16400, 268435456: 0, 285212672: 1074266128, 301989888: 1073758224, 318767104: 1074282496, 335544320: 1074266112, 352321536: 16, 369098752: 540688, 385875968: 16384, 402653184: 16400, 419430400: 524288, 436207616: 524304, 452984832: 1073741840, 469762048: 540672, 486539264: 1073758208, 503316480: 1073741824, 520093696: 1074282512, 276824064: 540688, 293601280: 524288, 310378496: 1074266112, 327155712: 16384, 343932928: 1073758208, 360710144: 1074282512, 377487360: 16, 394264576: 1073741824, 411041792: 1074282496, 427819008: 1073741840, 444596224: 1073758224, 461373440: 524304, 478150656: 0, 494927872: 16400, 511705088: 1074266128, 528482304: 540672 }, { "0": 260, 1048576: 0, 2097152: 67109120, 3145728: 65796, 4194304: 65540, 5242880: 67108868, 6291456: 67174660, 7340032: 67174400, 8388608: 67108864, 9437184: 67174656, 10485760: 65792, 11534336: 67174404, 12582912: 67109124, 13631488: 65536, 14680064: 4, 15728640: 256, 524288: 67174656, 1572864: 67174404, 2621440: 0, 3670016: 67109120, 4718592: 67108868, 5767168: 65536, 6815744: 65540, 7864320: 260, 8912896: 4, 9961472: 256, 11010048: 67174400, 12058624: 65796, 13107200: 65792, 14155776: 67109124, 15204352: 67174660, 16252928: 67108864, 16777216: 67174656, 17825792: 65540, 18874368: 65536, 19922944: 67109120, 20971520: 256, 22020096: 67174660, 23068672: 67108868, 24117248: 0, 25165824: 67109124, 26214400: 67108864, 27262976: 4, 28311552: 65792, 29360128: 67174400, 30408704: 260, 31457280: 65796, 32505856: 67174404, 17301504: 67108864, 18350080: 260, 19398656: 67174656, 20447232: 0, 21495808: 65540, 22544384: 67109120, 23592960: 256, 24641536: 67174404, 25690112: 65536, 26738688: 67174660, 27787264: 65796, 28835840: 67108868, 29884416: 67109124, 30932992: 67174400, 31981568: 4, 33030144: 65792 }, { "0": 2151682048, 65536: 2147487808, 131072: 4198464, 196608: 2151677952, 262144: 0, 327680: 4198400, 393216: 2147483712, 458752: 4194368, 524288: 2147483648, 589824: 4194304, 655360: 64, 720896: 2147487744, 786432: 2151678016, 851968: 4160, 917504: 4096, 983040: 2151682112, 32768: 2147487808, 98304: 64, 163840: 2151678016, 229376: 2147487744, 294912: 4198400, 360448: 2151682112, 425984: 0, 491520: 2151677952, 557056: 4096, 622592: 2151682048, 688128: 4194304, 753664: 4160, 819200: 2147483648, 884736: 4194368, 950272: 4198464, 1015808: 2147483712, 1048576: 4194368, 1114112: 4198400, 1179648: 2147483712, 1245184: 0, 1310720: 4160, 1376256: 2151678016, 1441792: 2151682048, 1507328: 2147487808, 1572864: 2151682112, 1638400: 2147483648, 1703936: 2151677952, 1769472: 4198464, 1835008: 2147487744, 1900544: 4194304, 1966080: 64, 2031616: 4096, 1081344: 2151677952, 1146880: 2151682112, 1212416: 0, 1277952: 4198400, 1343488: 4194368, 1409024: 2147483648, 1474560: 2147487808, 1540096: 64, 1605632: 2147483712, 1671168: 4096, 1736704: 2147487744, 1802240: 2151678016, 1867776: 4160, 1933312: 2151682048, 1998848: 4194304, 2064384: 4198464 }, { "0": 128, 4096: 17039360, 8192: 262144, 12288: 536870912, 16384: 537133184, 20480: 16777344, 24576: 553648256, 28672: 262272, 32768: 16777216, 36864: 537133056, 40960: 536871040, 45056: 553910400, 49152: 553910272, 53248: 0, 57344: 17039488, 61440: 553648128, 2048: 17039488, 6144: 553648256, 10240: 128, 14336: 17039360, 18432: 262144, 22528: 537133184, 26624: 553910272, 30720: 536870912, 34816: 537133056, 38912: 0, 43008: 553910400, 47104: 16777344, 51200: 536871040, 55296: 553648128, 59392: 16777216, 63488: 262272, 65536: 262144, 69632: 128, 73728: 536870912, 77824: 553648256, 81920: 16777344, 86016: 553910272, 90112: 537133184, 94208: 16777216, 98304: 553910400, 102400: 553648128, 106496: 17039360, 110592: 537133056, 114688: 262272, 118784: 536871040, 122880: 0, 126976: 17039488, 67584: 553648256, 71680: 16777216, 75776: 17039360, 79872: 537133184, 83968: 536870912, 88064: 17039488, 92160: 128, 96256: 553910272, 100352: 262272, 104448: 553910400, 108544: 0, 112640: 553648128, 116736: 16777344, 120832: 262144, 124928: 537133056, 129024: 536871040 }, { "0": 268435464, 256: 8192, 512: 270532608, 768: 270540808, 1024: 268443648, 1280: 2097152, 1536: 2097160, 1792: 268435456, 2048: 0, 2304: 268443656, 2560: 2105344, 2816: 8, 3072: 270532616, 3328: 2105352, 3584: 8200, 3840: 270540800, 128: 270532608, 384: 270540808, 640: 8, 896: 2097152, 1152: 2105352, 1408: 268435464, 1664: 268443648, 1920: 8200, 2176: 2097160, 2432: 8192, 2688: 268443656, 2944: 270532616, 3200: 0, 3456: 270540800, 3712: 2105344, 3968: 268435456, 4096: 268443648, 4352: 270532616, 4608: 270540808, 4864: 8200, 5120: 2097152, 5376: 268435456, 5632: 268435464, 5888: 2105344, 6144: 2105352, 6400: 0, 6656: 8, 6912: 270532608, 7168: 8192, 7424: 268443656, 7680: 270540800, 7936: 2097160, 4224: 8, 4480: 2105344, 4736: 2097152, 4992: 268435464, 5248: 268443648, 5504: 8200, 5760: 270540808, 6016: 270532608, 6272: 270540800, 6528: 270532616, 6784: 8192, 7040: 2105352, 7296: 2097160, 7552: 0, 7808: 268435456, 8064: 268443656 }, { "0": 1048576, 16: 33555457, 32: 1024, 48: 1049601, 64: 34604033, 80: 0, 96: 1, 112: 34603009, 128: 33555456, 144: 1048577, 160: 33554433, 176: 34604032, 192: 34603008, 208: 1025, 224: 1049600, 240: 33554432, 8: 34603009, 24: 0, 40: 33555457, 56: 34604032, 72: 1048576, 88: 33554433, 104: 33554432, 120: 1025, 136: 1049601, 152: 33555456, 168: 34603008, 184: 1048577, 200: 1024, 216: 34604033, 232: 1, 248: 1049600, 256: 33554432, 272: 1048576, 288: 33555457, 304: 34603009, 320: 1048577, 336: 33555456, 352: 34604032, 368: 1049601, 384: 1025, 400: 34604033, 416: 1049600, 432: 1, 448: 0, 464: 34603008, 480: 33554433, 496: 1024, 264: 1049600, 280: 33555457, 296: 34603009, 312: 1, 328: 33554432, 344: 1048576, 360: 1025, 376: 34604032, 392: 33554433, 408: 34603008, 424: 0, 440: 34604033, 456: 1049601, 472: 1024, 488: 33555456, 504: 1048577 }, { "0": 134219808, 1: 131072, 2: 134217728, 3: 32, 4: 131104, 5: 134350880, 6: 134350848, 7: 2048, 8: 134348800, 9: 134219776, 10: 133120, 11: 134348832, 12: 2080, 13: 0, 14: 134217760, 15: 133152, 2147483648: 2048, 2147483649: 134350880, 2147483650: 134219808, 2147483651: 134217728, 2147483652: 134348800, 2147483653: 133120, 2147483654: 133152, 2147483655: 32, 2147483656: 134217760, 2147483657: 2080, 2147483658: 131104, 2147483659: 134350848, 2147483660: 0, 2147483661: 134348832, 2147483662: 134219776, 2147483663: 131072, 16: 133152, 17: 134350848, 18: 32, 19: 2048, 20: 134219776, 21: 134217760, 22: 134348832, 23: 131072, 24: 0, 25: 131104, 26: 134348800, 27: 134219808, 28: 134350880, 29: 133120, 30: 2080, 31: 134217728, 2147483664: 131072, 2147483665: 2048, 2147483666: 134348832, 2147483667: 133152, 2147483668: 32, 2147483669: 134348800, 2147483670: 134217728, 2147483671: 134219808, 2147483672: 134350880, 2147483673: 134217760, 2147483674: 134219776, 2147483675: 0, 2147483676: 133120, 2147483677: 2080, 2147483678: 131104, 2147483679: 134350848 }], t = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], m = g.DES = e.extend({ _5: function() { for (var b = this._12.words, c = [], a = 0; 56 > a; a++) { var f = q[a] - 1; c[a] = b[f >>> 5] >>> 31 - f % 32 & 1 } b = this._28 = []; for (f = 0; 16 > f; f++) { for (var d = b[f] = [], e = r[f], a = 0; 24 > a; a++) d[a / 6 | 0] |= c[(p[a] - 1 + e) % 28] << 31 - a % 6, d[4 + (a / 6 | 0)] |= c[28 + (p[a + 24] - 1 + e) % 28] << 31 - a % 6; d[0] = d[0] << 1 | d[0] >>> 31; for (a = 1; 7 > a; a++) d[a] >>>= 4 * (a - 1) + 3; d[7] = d[7] << 5 | d[7] >>> 27 } c = this._29 = []; for (a = 0; 16 > a; a++) c[a] = b[15 - a] }, encryptBlock: function(b, c) { this._4(b, c, this._28) }, decryptBlock: function(b, c) { this._4(b, c, this._29) }, _4: function(b, c, a) { this._1 = b[c]; this._0 = b[c + 1]; j.call(this, 4, 252645135); j.call(this, 16, 65535); l.call(this, 2, 858993459); l.call(this, 8, 16711935); j.call(this, 1, 1431655765); for (var f = 0; 16 > f; f++) { for (var d = a[f], e = this._1, h = this._0, g = 0, k = 0; 8 > k; k++) g |= s[k][((h ^ d[k]) & t[k]) >>> 0]; this._1 = h; this._0 = e ^ g } a = this._1; this._1 = this._0; this._0 = a; j.call(this, 1, 1431655765); l.call(this, 8, 16711935); l.call(this, 2, 858993459); j.call(this, 16, 65535); j.call(this, 4, 252645135); b[c] = this._1; b[c + 1] = this._0 }, keySize: 2, ivSize: 2, blockSize: 2 }); h.DES = e._6(m); g = g.TripleDES = e.extend({ _5: function() { var b = this._12.words; this._17 = m.createEncryptor(n.create(b.slice(0, 2))); this._21 = m.createEncryptor(n.create(b.slice(2, 4))); this._23 = m.createEncryptor(n.create(b.slice(4, 6))) }, encryptBlock: function(b, c) { this._17.encryptBlock(b, c); this._21.decryptBlock(b, c); this._23.encryptBlock(b, c) }, decryptBlock: function(b, c) { this._23.decryptBlock(b, c); this._21.encryptBlock(b, c); this._17.decryptBlock(b, c) }, keySize: 6, ivSize: 2, blockSize: 2 }); h.TripleDES = e._6(g) })(); var DES = { encrypt: function(text) { var secretkey = (CryptoJS.MD5(akb36).toString()).substr(0, 16); var secretiv = (CryptoJS.MD5(akb48).toString()).substr(24, 8); secretkey = CryptoJS.enc.Utf8.parse(secretkey); secretiv = CryptoJS.enc.Utf8.parse(secretiv); var result = CryptoJS.DES.encrypt(text, secretkey, { iv: secretiv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); return result.toString() }, }; return b.encode(DES.encrypt(DES.encrypt(DES.encrypt(b.encode(a))))); } function encode_secret() { var b, a = appId; for (b = 0; b < arguments.length; b++) a += arguments[b]; return (a = a.replace(/\s/g, "")), hex_md5(a); } function decode_result(a) { var b = new Base64(); var akb33 = "32223"; var akb34 = "N4EDAQpO2ejqgCoX"; var akb35 = "=qoKNLgdAjJbU8zx"; var akb36 = "mAkJqt8coXQ96zML"; var akb48 = "t4ABRmeN" return b.decode(b.decode(b.decode(a))); } var hexcase = 0, b64pad = "", chrsz = 8, appId = "a01901d3caba1f362d69474674ce477f"; var encode_param = encode_param var CryptoJS = CryptoJS || function(h, r) { var k = {}, l = k.lib = {}, n = function() {}, f = l.Base = { extend: function(a) { n.prototype = this; var b = new n; a && b.mixIn(a); b.hasOwnProperty("init") || (b.init = function() { b.s.init.apply(this, arguments) }); b.init.prototype = b; b.s = this; return b }, create: function() { var a = this.extend(); a.init.apply(a, arguments); return a }, init: function() {}, mixIn: function(a) { for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b]); a.hasOwnProperty("toString") && (this.toString = a.toString) }, clone: function() { return this.init.prototype.extend(this) } }, j = l.WordArray = f.extend({ init: function(a, b) { a = this.words = a || []; this.sigBytes = b != r ? b : 4 * a.length }, toString: function(a) { return (a || s).stringify(this) }, concat: function(a) { var b = this.words, d = a.words, c = this.sigBytes; a = a.sigBytes; this.clamp(); if (c % 4) for (var e = 0; e < a; e++) b[c + e >>> 2] |= (d[e >>> 2] >>> 24 - 8 * (e % 4) & 255) << 24 - 8 * ((c + e) % 4); else if (65535 < d.length) for (e = 0; e < a; e += 4) b[c + e >>> 2] = d[e >>> 2]; else b.push.apply(b, d); this.sigBytes += a; return this }, clamp: function() { var a = this.words, b = this.sigBytes; a[b >>> 2] &= 4294967295 << 32 - 8 * (b % 4); a.length = h.ceil(b / 4) }, clone: function() { var a = f.clone.call(this); a.words = this.words.slice(0); return a }, random: function(a) { for (var b = [], d = 0; d < a; d += 4) b.push(4294967296 * h.random() | 0); return new j.init(b, a) } }), m = k.enc = {}, s = m.Hex = { stringify: function(a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) { var e = b[c >>> 2] >>> 24 - 8 * (c % 4) & 255; d.push((e >>> 4).toString(16)); d.push((e & 15).toString(16)) } return d.join("") }, parse: function(a) { for (var b = a.length, d = [], c = 0; c < b; c += 2) d[c >>> 3] |= parseInt(a.substr(c, 2), 16) << 24 - 4 * (c % 8); return new j.init(d, b / 2) } }, p = m.Latin1 = { stringify: function(a) { var b = a.words; a = a.sigBytes; for (var d = [], c = 0; c < a; c++) d.push(String.fromCharCode(b[c >>> 2] >>> 24 - 8 * (c % 4) & 255)); return d.join("") }, parse: function(a) { for (var b = a.length, d = [], c = 0; c < b; c++) d[c >>> 2] |= (a.charCodeAt(c) & 255) << 24 - 8 * (c % 4); return new j.init(d, b) } }, t = m.Utf8 = { stringify: function(a) { try { return decodeURIComponent(escape(p.stringify(a))) } catch (b) { throw Error("Malformed UTF-8 data") } }, parse: function(a) { return p.parse(unescape(encodeURIComponent(a))) } }, q = l.BufferedBlockAlgorithm = f.extend({ reset: function() { this._2 = new j.init; this._22 = 0 }, _8: function(a) { "string" == typeof a && (a = t.parse(a)); this._2.concat(a); this._22 += a.sigBytes }, _3: function(a) { var b = this._2, d = b.words, c = b.sigBytes, e = this.blockSize, f = c / (4 * e), f = a ? h.ceil(f) : h.max((f | 0) - this._18, 0); a = f * e; c = h.min(4 * a, c); if (a) { for (var g = 0; g < a; g += e) this._20(d, g); g = d.splice(0, a); b.sigBytes -= c } return new j.init(g, c) }, clone: function() { var a = f.clone.call(this); a._2 = this._2.clone(); return a }, _18: 0 }); l.Hasher = q.extend({ cfg: f.extend(), init: function(a) { this.cfg = this.cfg.extend(a); this.reset() }, reset: function() { q.reset.call(this); this._5() }, update: function(a) { this._8(a); this._3(); return this }, finalize: function(a) { a && this._8(a); return this._9() }, blockSize: 16, _6: function(a) { return function(b, d) { return (new a.init(d)).finalize(b) } }, _30: function(a) { return function(b, d) { return (new u.HMAC.init(a, d)).finalize(b) } } }); var u = k.algo = {}; return k }(Math); (function() { var h = CryptoJS, j = h.lib.WordArray; h.enc.Base64 = { stringify: function(b) { var e = b.words, f = b.sigBytes, c = this._13; b.clamp(); b = []; for (var a = 0; a < f; a += 3) for (var d = (e[a >>> 2] >>> 24 - 8 * (a % 4) & 255) << 16 | (e[a + 1 >>> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) << 8 | e[a + 2 >>> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) b.push(c.charAt(d >>> 6 * (3 - g) & 63)); if (e = c.charAt(64)) for (; b.length % 4;) b.push(e); return b.join("") }, parse: function(b) { var e = b.length, f = this._13, c = f.charAt(64); c && (c = b.indexOf(c), -1 != c && (e = c)); for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { var g = f.indexOf(b.charAt(d - 1)) << 2 * (d % 4), h = f.indexOf(b.charAt(d)) >>> 6 - 2 * (d % 4); c[a >>> 2] |= (g | h) << 24 - 8 * (a % 4); a++ } return j.create(c, a) }, _13: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" } })(); CryptoJS.lib.Cipher || function(u) { var g = CryptoJS, f = g.lib, k = f.Base, l = f.WordArray, q = f.BufferedBlockAlgorithm, r = g.enc.Base64, v = g.algo.EvpKDF, n = f.Cipher = q.extend({ cfg: k.extend(), createEncryptor: function(a, b) { return this.create(this._11, a, b) }, createDecryptor: function(a, b) { return this.create(this._25, a, b) }, init: function(a, b, c) { this.cfg = this.cfg.extend(c); this._15 = a; this._12 = b; this.reset() }, reset: function() { q.reset.call(this); this._5() }, process: function(a) { this._8(a); return this._3() }, finalize: function(a) { a && this._8(a); return this._9() }, keySize: 4, ivSize: 4, _11: 1, _25: 2, _6: function(a) { return { encrypt: function(b, c, d) { return ("string" == typeof c ? s : j).encrypt(a, b, c, d) }, decrypt: function(b, c, d) { return ("string" == typeof c ? s : j).decrypt(a, b, c, d) } } } }); f.StreamCipher = n.extend({ _9: function() { return this._3(!0) }, blockSize: 1 }); var m = g.mode = {}, t = function(a, b, c) { var d = this._16; d ? this._16 = u : d = this._19; for (var e = 0; e < c; e++) a[b + e] ^= d[e] }, h = (f.BlockCipherMode = k.extend({ createEncryptor: function(a, b) { return this.Encryptor.create(a, b) }, createDecryptor: function(a, b) { return this.Decryptor.create(a, b) }, init: function(a, b) { this._10 = a; this._16 = b } })).extend(); h.Encryptor = h.extend({ processBlock: function(a, b) { var c = this._10, d = c.blockSize; t.call(this, a, b, d); c.encryptBlock(a, b); this._19 = a.slice(b, b + d) } }); h.Decryptor = h.extend({ processBlock: function(a, b) { var c = this._10, d = c.blockSize, e = a.slice(b, b + d); c.decryptBlock(a, b); t.call(this, a, b, d); this._19 = e } }); m = m.CBC = h; h = (g.pad = {}).Pkcs7 = { pad: function(a, b) { for (var c = 4 * b, c = c - a.sigBytes % c, d = c << 24 | c << 16 | c << 8 | c, e = [], f = 0; f < c; f += 4) e.push(d); c = l.create(e, c); a.concat(c) }, unpad: function(a) { a.sigBytes -= a.words[a.sigBytes - 1 >>> 2] & 255 } }; f.BlockCipher = n.extend({ cfg: n.cfg.extend({ mode: m, padding: h }), reset: function() { n.reset.call(this); var a = this.cfg, b = a.iv, a = a.mode; if (this._15 == this._11) var c = a.createEncryptor; else c = a.createDecryptor, this._18 = 1; this._31 = c.call(a, this, b && b.words) }, _20: function(a, b) { this._31.processBlock(a, b) }, _9: function() { var a = this.cfg.padding; if (this._15 == this._11) { a.pad(this._2, this.blockSize); var b = this._3(!0) } else b = this._3(!0), a.unpad(b); return b }, blockSize: 4 }); var p = f.CipherParams = k.extend({ init: function(a) { this.mixIn(a) }, toString: function(a) { return (a || this.formatter).stringify(this) } }), m = (g.format = {}).OpenSSL = { stringify: function(a) { var b = a.ciphertext; a = a.salt; return (a ? l.create([1398893684, 1701076831]).concat(a).concat(b) : b).toString(r) }, parse: function(a) { a = r.parse(a); var b = a.words; if (1398893684 == b[0] && 1701076831 == b[1]) { var c = l.create(b.slice(2, 4)); b.splice(0, 4); a.sigBytes -= 16 } return p.create({ ciphertext: a, salt: c }) } }, j = f.SerializableCipher = k.extend({ cfg: k.extend({ format: m }), encrypt: function(a, b, c, d) { d = this.cfg.extend(d); var e = a.createEncryptor(c, d); b = e.finalize(b); e = e.cfg; return p.create({ ciphertext: b, key: c, iv: e.iv, algorithm: a, mode: e.mode, padding: e.padding, blockSize: a.blockSize, formatter: d.format }) }, decrypt: function(a, b, c, d) { d = this.cfg.extend(d); b = this._14(b, d.format); return a.createDecryptor(c, d).finalize(b.ciphertext) }, _14: function(a, b) { return "string" == typeof a ? b.parse(a, this) : a } }), g = (g.kdf = {}).OpenSSL = { execute: function(a, b, c, d) { d || (d = l.random(8)); a = v.create({ keySize: b + c }).compute(a, d); c = l.create(a.words.slice(b), 4 * c); a.sigBytes = 4 * b; return p.create({ key: a, iv: c, salt: d }) } }, s = f.PasswordBasedCipher = j.extend({ cfg: j.cfg.extend({ kdf: g }), encrypt: function(a, b, c, d) { d = this.cfg.extend(d); c = d.kdf.execute(c, a.keySize, a.ivSize); d.iv = c.iv; a = j.encrypt.call(this, a, b, c.key, d); a.mixIn(c); return a }, decrypt: function(a, b, c, d) { d = this.cfg.extend(d); b = this._14(b, d.format); c = d.kdf.execute(c, a.keySize, a.ivSize, b.salt); d.iv = c.iv; return j.decrypt.call(this, a, b, c.key, d) } }) }(); CryptoJS.mode.ECB = function() { var a = CryptoJS.lib.BlockCipherMode.extend(); a.Encryptor = a.extend({ processBlock: function(a, b) { this._10.encryptBlock(a, b) } }); a.Decryptor = a.extend({ processBlock: function(a, b) { this._10.decryptBlock(a, b) } }); return a }(); (function(E) { function h(a, f, g, j, p, h, k) { a = a + (f & g | ~f & j) + p + k; return (a << h | a >>> 32 - h) + f } function k(a, f, g, j, p, h, k) { a = a + (f & j | g & ~j) + p + k; return (a << h | a >>> 32 - h) + f } function l(a, f, g, j, h, k, l) { a = a + (f ^ g ^ j) + h + l; return (a << k | a >>> 32 - k) + f } function n(a, f, g, j, h, k, l) { a = a + (g ^ (f | ~j)) + h + l; return (a << k | a >>> 32 - k) + f } for (var r = CryptoJS, q = r.lib, F = q.WordArray, s = q.Hasher, q = r.algo, a = [], t = 0; 64 > t; t++) a[t] = 4294967296 * E.abs(E.sin(t + 1)) | 0; q = q.MD5 = s.extend({ _5: function() { this._7 = new F.init([1732584193, 4023233417, 2562383102, 271733878]) }, _20: function(m, f) { for (var g = 0; 16 > g; g++) { var j = f + g, p = m[j]; m[j] = (p << 8 | p >>> 24) & 16711935 | (p << 24 | p >>> 8) & 4278255360 } var g = this._7.words, j = m[f + 0], p = m[f + 1], q = m[f + 2], r = m[f + 3], s = m[f + 4], t = m[f + 5], u = m[f + 6], v = m[f + 7], w = m[f + 8], x = m[f + 9], y = m[f + 10], z = m[f + 11], A = m[f + 12], B = m[f + 13], C = m[f + 14], D = m[f + 15], b = g[0], c = g[1], d = g[2], e = g[3], b = h(b, c, d, e, j, 7, a[0]), e = h(e, b, c, d, p, 12, a[1]), d = h(d, e, b, c, q, 17, a[2]), c = h(c, d, e, b, r, 22, a[3]), b = h(b, c, d, e, s, 7, a[4]), e = h(e, b, c, d, t, 12, a[5]), d = h(d, e, b, c, u, 17, a[6]), c = h(c, d, e, b, v, 22, a[7]), b = h(b, c, d, e, w, 7, a[8]), e = h(e, b, c, d, x, 12, a[9]), d = h(d, e, b, c, y, 17, a[10]), c = h(c, d, e, b, z, 22, a[11]), b = h(b, c, d, e, A, 7, a[12]), e = h(e, b, c, d, B, 12, a[13]), d = h(d, e, b, c, C, 17, a[14]), c = h(c, d, e, b, D, 22, a[15]), b = k(b, c, d, e, p, 5, a[16]), e = k(e, b, c, d, u, 9, a[17]), d = k(d, e, b, c, z, 14, a[18]), c = k(c, d, e, b, j, 20, a[19]), b = k(b, c, d, e, t, 5, a[20]), e = k(e, b, c, d, y, 9, a[21]), d = k(d, e, b, c, D, 14, a[22]), c = k(c, d, e, b, s, 20, a[23]), b = k(b, c, d, e, x, 5, a[24]), e = k(e, b, c, d, C, 9, a[25]), d = k(d, e, b, c, r, 14, a[26]), c = k(c, d, e, b, w, 20, a[27]), b = k(b, c, d, e, B, 5, a[28]), e = k(e, b, c, d, q, 9, a[29]), d = k(d, e, b, c, v, 14, a[30]), c = k(c, d, e, b, A, 20, a[31]), b = l(b, c, d, e, t, 4, a[32]), e = l(e, b, c, d, w, 11, a[33]), d = l(d, e, b, c, z, 16, a[34]), c = l(c, d, e, b, C, 23, a[35]), b = l(b, c, d, e, p, 4, a[36]), e = l(e, b, c, d, s, 11, a[37]), d = l(d, e, b, c, v, 16, a[38]), c = l(c, d, e, b, y, 23, a[39]), b = l(b, c, d, e, B, 4, a[40]), e = l(e, b, c, d, j, 11, a[41]), d = l(d, e, b, c, r, 16, a[42]), c = l(c, d, e, b, u, 23, a[43]), b = l(b, c, d, e, x, 4, a[44]), e = l(e, b, c, d, A, 11, a[45]), d = l(d, e, b, c, D, 16, a[46]), c = l(c, d, e, b, q, 23, a[47]), b = n(b, c, d, e, j, 6, a[48]), e = n(e, b, c, d, v, 10, a[49]), d = n(d, e, b, c, C, 15, a[50]), c = n(c, d, e, b, t, 21, a[51]), b = n(b, c, d, e, A, 6, a[52]), e = n(e, b, c, d, r, 10, a[53]), d = n(d, e, b, c, y, 15, a[54]), c = n(c, d, e, b, p, 21, a[55]), b = n(b, c, d, e, w, 6, a[56]), e = n(e, b, c, d, D, 10, a[57]), d = n(d, e, b, c, u, 15, a[58]), c = n(c, d, e, b, B, 21, a[59]), b = n(b, c, d, e, s, 6, a[60]), e = n(e, b, c, d, z, 10, a[61]), d = n(d, e, b, c, q, 15, a[62]), c = n(c, d, e, b, x, 21, a[63]); g[0] = g[0] + b | 0; g[1] = g[1] + c | 0; g[2] = g[2] + d | 0; g[3] = g[3] + e | 0 }, _9: function() { var a = this._2, f = a.words, g = 8 * this._22, j = 8 * a.sigBytes; f[j >>> 5] |= 128 << 24 - j % 32; var h = E.floor(g / 4294967296); f[(j + 64 >>> 9 << 4) + 15] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360; f[(j + 64 >>> 9 << 4) + 14] = (g << 8 | g >>> 24) & 16711935 | (g << 24 | g >>> 8) & 4278255360; a.sigBytes = 4 * (f.length + 1); this._3(); a = this._7; f = a.words; for (g = 0; 4 > g; g++) j = f[g], f[g] = (j << 8 | j >>> 24) & 16711935 | (j << 24 | j >>> 8) & 4278255360; return a }, clone: function() { var a = s.clone.call(this); a._7 = this._7.clone(); return a } }); r.MD5 = s._6(q); r.HmacMD5 = s._30(q) })(Math); (function() { for (var q = CryptoJS, x = q.lib.BlockCipher, r = q.algo, j = [], y = [], z = [], A = [], B = [], C = [], s = [], u = [], v = [], w = [], g = [], k = 0; 256 > k; k++) g[k] = 128 > k ? k << 1 : k << 1 ^ 283; for (var n = 0, l = 0, k = 0; 256 > k; k++) { var f = l ^ l << 1 ^ l << 2 ^ l << 3 ^ l << 4, f = f >>> 8 ^ f & 255 ^ 99; j[n] = f; y[f] = n; var t = g[n], D = g[t], E = g[D], b = 257 * g[f] ^ 16843008 * f; z[n] = b << 24 | b >>> 8; A[n] = b << 16 | b >>> 16; B[n] = b << 8 | b >>> 24; C[n] = b; b = 16843009 * E ^ 65537 * D ^ 257 * t ^ 16843008 * n; s[f] = b << 24 | b >>> 8; u[f] = b << 16 | b >>> 16; v[f] = b << 8 | b >>> 24; w[f] = b; n ? (n = t ^ g[g[g[E ^ t]]], l ^= g[g[l]]) : n = l = 1 } var F = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], r = r.AES = x.extend({ _5: function() { for (var c = this._12, e = c.words, a = c.sigBytes / 4, c = 4 * ((this._26 = a + 6) + 1), b = this._27 = [], h = 0; h < c; h++) if (h < a) b[h] = e[h]; else { var d = b[h - 1]; h % a ? 6 < a && 4 == h % a && (d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255]) : (d = d << 8 | d >>> 24, d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255], d ^= F[h / a | 0] << 24); b[h] = b[h - a] ^ d } e = this._24 = []; for (a = 0; a < c; a++) h = c - a, d = a % 4 ? b[h] : b[h - 4], e[a] = 4 > a || 4 >= h ? d : s[j[d >>> 24]] ^ u[j[d >>> 16 & 255]] ^ v[j[d >>> 8 & 255]] ^ w[j[d & 255]] }, encryptBlock: function(c, e) { this._4(c, e, this._27, z, A, B, C, j) }, decryptBlock: function(c, e) { var a = c[e + 1]; c[e + 1] = c[e + 3]; c[e + 3] = a; this._4(c, e, this._24, s, u, v, w, y); a = c[e + 1]; c[e + 1] = c[e + 3]; c[e + 3] = a }, _4: function(c, e, a, b, h, d, j, m) { for (var n = this._26, f = c[e] ^ a[0], g = c[e + 1] ^ a[1], k = c[e + 2] ^ a[2], p = c[e + 3] ^ a[3], l = 4, t = 1; t < n; t++) var q = b[f >>> 24] ^ h[g >>> 16 & 255] ^ d[k >>> 8 & 255] ^ j[p & 255] ^ a[l++], r = b[g >>> 24] ^ h[k >>> 16 & 255] ^ d[p >>> 8 & 255] ^ j[f & 255] ^ a[l++], s = b[k >>> 24] ^ h[p >>> 16 & 255] ^ d[f >>> 8 & 255] ^ j[g & 255] ^ a[l++], p = b[p >>> 24] ^ h[f >>> 16 & 255] ^ d[g >>> 8 & 255] ^ j[k & 255] ^ a[l++], f = q, g = r, k = s; q = (m[f >>> 24] << 24 | m[g >>> 16 & 255] << 16 | m[k >>> 8 & 255] << 8 | m[p & 255]) ^ a[l++]; r = (m[g >>> 24] << 24 | m[k >>> 16 & 255] << 16 | m[p >>> 8 & 255] << 8 | m[f & 255]) ^ a[l++]; s = (m[k >>> 24] << 24 | m[p >>> 16 & 255] << 16 | m[f >>> 8 & 255] << 8 | m[g & 255]) ^ a[l++]; p = (m[p >>> 24] << 24 | m[f >>> 16 & 255] << 16 | m[g >>> 8 & 255] << 8 | m[k & 255]) ^ a[l++]; c[e] = q; c[e + 1] = r; c[e + 2] = s; c[e + 3] = p }, keySize: 8 }); q.AES = x._6(r) })(); (function() { function j(b, c) { var a = (this._1 >>> b ^ this._0) & c; this._0 ^= a; this._1 ^= a << b } function l(b, c) { var a = (this._0 >>> b ^ this._1) & c; this._1 ^= a; this._0 ^= a << b } var h = CryptoJS, e = h.lib, n = e.WordArray, e = e.BlockCipher, g = h.algo, q = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], p = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], r = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], s = [{ "0": 8421888, 268435456: 32768, 536870912: 8421378, 805306368: 2, 1073741824: 512, 1342177280: 8421890, 1610612736: 8389122, 1879048192: 8388608, 2147483648: 514, 2415919104: 8389120, 2684354560: 33280, 2952790016: 8421376, 3221225472: 32770, 3489660928: 8388610, 3758096384: 0, 4026531840: 33282, 134217728: 0, 402653184: 8421890, 671088640: 33282, 939524096: 32768, 1207959552: 8421888, 1476395008: 512, 1744830464: 8421378, 2013265920: 2, 2281701376: 8389120, 2550136832: 33280, 2818572288: 8421376, 3087007744: 8389122, 3355443200: 8388610, 3623878656: 32770, 3892314112: 514, 4160749568: 8388608, 1: 32768, 268435457: 2, 536870913: 8421888, 805306369: 8388608, 1073741825: 8421378, 1342177281: 33280, 1610612737: 512, 1879048193: 8389122, 2147483649: 8421890, 2415919105: 8421376, 2684354561: 8388610, 2952790017: 33282, 3221225473: 514, 3489660929: 8389120, 3758096385: 32770, 4026531841: 0, 134217729: 8421890, 402653185: 8421376, 671088641: 8388608, 939524097: 512, 1207959553: 32768, 1476395009: 8388610, 1744830465: 2, 2013265921: 33282, 2281701377: 32770, 2550136833: 8389122, 2818572289: 514, 3087007745: 8421888, 3355443201: 8389120, 3623878657: 0, 3892314113: 33280, 4160749569: 8421378 }, { "0": 1074282512, 16777216: 16384, 33554432: 524288, 50331648: 1074266128, 67108864: 1073741840, 83886080: 1074282496, 100663296: 1073758208, 117440512: 16, 134217728: 540672, 150994944: 1073758224, 167772160: 1073741824, 184549376: 540688, 201326592: 524304, 218103808: 0, 234881024: 16400, 251658240: 1074266112, 8388608: 1073758208, 25165824: 540688, 41943040: 16, 58720256: 1073758224, 75497472: 1074282512, 92274688: 1073741824, 109051904: 524288, 125829120: 1074266128, 142606336: 524304, 159383552: 0, 176160768: 16384, 192937984: 1074266112, 209715200: 1073741840, 226492416: 540672, 243269632: 1074282496, 260046848: 16400, 268435456: 0, 285212672: 1074266128, 301989888: 1073758224, 318767104: 1074282496, 335544320: 1074266112, 352321536: 16, 369098752: 540688, 385875968: 16384, 402653184: 16400, 419430400: 524288, 436207616: 524304, 452984832: 1073741840, 469762048: 540672, 486539264: 1073758208, 503316480: 1073741824, 520093696: 1074282512, 276824064: 540688, 293601280: 524288, 310378496: 1074266112, 327155712: 16384, 343932928: 1073758208, 360710144: 1074282512, 377487360: 16, 394264576: 1073741824, 411041792: 1074282496, 427819008: 1073741840, 444596224: 1073758224, 461373440: 524304, 478150656: 0, 494927872: 16400, 511705088: 1074266128, 528482304: 540672 }, { "0": 260, 1048576: 0, 2097152: 67109120, 3145728: 65796, 4194304: 65540, 5242880: 67108868, 6291456: 67174660, 7340032: 67174400, 8388608: 67108864, 9437184: 67174656, 10485760: 65792, 11534336: 67174404, 12582912: 67109124, 13631488: 65536, 14680064: 4, 15728640: 256, 524288: 67174656, 1572864: 67174404, 2621440: 0, 3670016: 67109120, 4718592: 67108868, 5767168: 65536, 6815744: 65540, 7864320: 260, 8912896: 4, 9961472: 256, 11010048: 67174400, 12058624: 65796, 13107200: 65792, 14155776: 67109124, 15204352: 67174660, 16252928: 67108864, 16777216: 67174656, 17825792: 65540, 18874368: 65536, 19922944: 67109120, 20971520: 256, 22020096: 67174660, 23068672: 67108868, 24117248: 0, 25165824: 67109124, 26214400: 67108864, 27262976: 4, 28311552: 65792, 29360128: 67174400, 30408704: 260, 31457280: 65796, 32505856: 67174404, 17301504: 67108864, 18350080: 260, 19398656: 67174656, 20447232: 0, 21495808: 65540, 22544384: 67109120, 23592960: 256, 24641536: 67174404, 25690112: 65536, 26738688: 67174660, 27787264: 65796, 28835840: 67108868, 29884416: 67109124, 30932992: 67174400, 31981568: 4, 33030144: 65792 }, { "0": 2151682048, 65536: 2147487808, 131072: 4198464, 196608: 2151677952, 262144: 0, 327680: 4198400, 393216: 2147483712, 458752: 4194368, 524288: 2147483648, 589824: 4194304, 655360: 64, 720896: 2147487744, 786432: 2151678016, 851968: 4160, 917504: 4096, 983040: 2151682112, 32768: 2147487808, 98304: 64, 163840: 2151678016, 229376: 2147487744, 294912: 4198400, 360448: 2151682112, 425984: 0, 491520: 2151677952, 557056: 4096, 622592: 2151682048, 688128: 4194304, 753664: 4160, 819200: 2147483648, 884736: 4194368, 950272: 4198464, 1015808: 2147483712, 1048576: 4194368, 1114112: 4198400, 1179648: 2147483712, 1245184: 0, 1310720: 4160, 1376256: 2151678016, 1441792: 2151682048, 1507328: 2147487808, 1572864: 2151682112, 1638400: 2147483648, 1703936: 2151677952, 1769472: 4198464, 1835008: 2147487744, 1900544: 4194304, 1966080: 64, 2031616: 4096, 1081344: 2151677952, 1146880: 2151682112, 1212416: 0, 1277952: 4198400, 1343488: 4194368, 1409024: 2147483648, 1474560: 2147487808, 1540096: 64, 1605632: 2147483712, 1671168: 4096, 1736704: 2147487744, 1802240: 2151678016, 1867776: 4160, 1933312: 2151682048, 1998848: 4194304, 2064384: 4198464 }, { "0": 128, 4096: 17039360, 8192: 262144, 12288: 536870912, 16384: 537133184, 20480: 16777344, 24576: 553648256, 28672: 262272, 32768: 16777216, 36864: 537133056, 40960: 536871040, 45056: 553910400, 49152: 553910272, 53248: 0, 57344: 17039488, 61440: 553648128, 2048: 17039488, 6144: 553648256, 10240: 128, 14336: 17039360, 18432: 262144, 22528: 537133184, 26624: 553910272, 30720: 536870912, 34816: 537133056, 38912: 0, 43008: 553910400, 47104: 16777344, 51200: 536871040, 55296: 553648128, 59392: 16777216, 63488: 262272, 65536: 262144, 69632: 128, 73728: 536870912, 77824: 553648256, 81920: 16777344, 86016: 553910272, 90112: 537133184, 94208: 16777216, 98304: 553910400, 102400: 553648128, 106496: 17039360, 110592: 537133056, 114688: 262272, 118784: 536871040, 122880: 0, 126976: 17039488, 67584: 553648256, 71680: 16777216, 75776: 17039360, 79872: 537133184, 83968: 536870912, 88064: 17039488, 92160: 128, 96256: 553910272, 100352: 262272, 104448: 553910400, 108544: 0, 112640: 553648128, 116736: 16777344, 120832: 262144, 124928: 537133056, 129024: 536871040 }, { "0": 268435464, 256: 8192, 512: 270532608, 768: 270540808, 1024: 268443648, 1280: 2097152, 1536: 2097160, 1792: 268435456, 2048: 0, 2304: 268443656, 2560: 2105344, 2816: 8, 3072: 270532616, 3328: 2105352, 3584: 8200, 3840: 270540800, 128: 270532608, 384: 270540808, 640: 8, 896: 2097152, 1152: 2105352, 1408: 268435464, 1664: 268443648, 1920: 8200, 2176: 2097160, 2432: 8192, 2688: 268443656, 2944: 270532616, 3200: 0, 3456: 270540800, 3712: 2105344, 3968: 268435456, 4096: 268443648, 4352: 270532616, 4608: 270540808, 4864: 8200, 5120: 2097152, 5376: 268435456, 5632: 268435464, 5888: 2105344, 6144: 2105352, 6400: 0, 6656: 8, 6912: 270532608, 7168: 8192, 7424: 268443656, 7680: 270540800, 7936: 2097160, 4224: 8, 4480: 2105344, 4736: 2097152, 4992: 268435464, 5248: 268443648, 5504: 8200, 5760: 270540808, 6016: 270532608, 6272: 270540800, 6528: 270532616, 6784: 8192, 7040: 2105352, 7296: 2097160, 7552: 0, 7808: 268435456, 8064: 268443656 }, { "0": 1048576, 16: 33555457, 32: 1024, 48: 1049601, 64: 34604033, 80: 0, 96: 1, 112: 34603009, 128: 33555456, 144: 1048577, 160: 33554433, 176: 34604032, 192: 34603008, 208: 1025, 224: 1049600, 240: 33554432, 8: 34603009, 24: 0, 40: 33555457, 56: 34604032, 72: 1048576, 88: 33554433, 104: 33554432, 120: 1025, 136: 1049601, 152: 33555456, 168: 34603008, 184: 1048577, 200: 1024, 216: 34604033, 232: 1, 248: 1049600, 256: 33554432, 272: 1048576, 288: 33555457, 304: 34603009, 320: 1048577, 336: 33555456, 352: 34604032, 368: 1049601, 384: 1025, 400: 34604033, 416: 1049600, 432: 1, 448: 0, 464: 34603008, 480: 33554433, 496: 1024, 264: 1049600, 280: 33555457, 296: 34603009, 312: 1, 328: 33554432, 344: 1048576, 360: 1025, 376: 34604032, 392: 33554433, 408: 34603008, 424: 0, 440: 34604033, 456: 1049601, 472: 1024, 488: 33555456, 504: 1048577 }, { "0": 134219808, 1: 131072, 2: 134217728, 3: 32, 4: 131104, 5: 134350880, 6: 134350848, 7: 2048, 8: 134348800, 9: 134219776, 10: 133120, 11: 134348832, 12: 2080, 13: 0, 14: 134217760, 15: 133152, 2147483648: 2048, 2147483649: 134350880, 2147483650: 134219808, 2147483651: 134217728, 2147483652: 134348800, 2147483653: 133120, 2147483654: 133152, 2147483655: 32, 2147483656: 134217760, 2147483657: 2080, 2147483658: 131104, 2147483659: 134350848, 2147483660: 0, 2147483661: 134348832, 2147483662: 134219776, 2147483663: 131072, 16: 133152, 17: 134350848, 18: 32, 19: 2048, 20: 134219776, 21: 134217760, 22: 134348832, 23: 131072, 24: 0, 25: 131104, 26: 134348800, 27: 134219808, 28: 134350880, 29: 133120, 30: 2080, 31: 134217728, 2147483664: 131072, 2147483665: 2048, 2147483666: 134348832, 2147483667: 133152, 2147483668: 32, 2147483669: 134348800, 2147483670: 134217728, 2147483671: 134219808, 2147483672: 134350880, 2147483673: 134217760, 2147483674: 134219776, 2147483675: 0, 2147483676: 133120, 2147483677: 2080, 2147483678: 131104, 2147483679: 134350848 }], t = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], m = g.DES = e.extend({ _5: function() { for (var b = this._12.words, c = [], a = 0; 56 > a; a++) { var f = q[a] - 1; c[a] = b[f >>> 5] >>> 31 - f % 32 & 1 } b = this._28 = []; for (f = 0; 16 > f; f++) { for (var d = b[f] = [], e = r[f], a = 0; 24 > a; a++) d[a / 6 | 0] |= c[(p[a] - 1 + e) % 28] << 31 - a % 6, d[4 + (a / 6 | 0)] |= c[28 + (p[a + 24] - 1 + e) % 28] << 31 - a % 6; d[0] = d[0] << 1 | d[0] >>> 31; for (a = 1; 7 > a; a++) d[a] >>>= 4 * (a - 1) + 3; d[7] = d[7] << 5 | d[7] >>> 27 } c = this._29 = []; for (a = 0; 16 > a; a++) c[a] = b[15 - a] }, encryptBlock: function(b, c) { this._4(b, c, this._28) }, decryptBlock: function(b, c) { this._4(b, c, this._29) }, _4: function(b, c, a) { this._1 = b[c]; this._0 = b[c + 1]; j.call(this, 4, 252645135); j.call(this, 16, 65535); l.call(this, 2, 858993459); l.call(this, 8, 16711935); j.call(this, 1, 1431655765); for (var f = 0; 16 > f; f++) { for (var d = a[f], e = this._1, h = this._0, g = 0, k = 0; 8 > k; k++) g |= s[k][((h ^ d[k]) & t[k]) >>> 0]; this._1 = h; this._0 = e ^ g } a = this._1; this._1 = this._0; this._0 = a; j.call(this, 1, 1431655765); l.call(this, 8, 16711935); l.call(this, 2, 858993459); j.call(this, 16, 65535); j.call(this, 4, 252645135); b[c] = this._1; b[c + 1] = this._0 }, keySize: 2, ivSize: 2, blockSize: 2 }); h.DES = e._6(m); g = g.TripleDES = e.extend({ _5: function() { var b = this._12.words; this._17 = m.createEncryptor(n.create(b.slice(0, 2))); this._21 = m.createEncryptor(n.create(b.slice(2, 4))); this._23 = m.createEncryptor(n.create(b.slice(4, 6))) }, encryptBlock: function(b, c) { this._17.encryptBlock(b, c); this._21.decryptBlock(b, c); this._23.encryptBlock(b, c) }, decryptBlock: function(b, c) { this._23.decryptBlock(b, c); this._21.encryptBlock(b, c); this._17.decryptBlock(b, c) }, keySize: 6, ivSize: 2, blockSize: 2 }); h.TripleDES = e._6(g) })(); ================================================ FILE: akshare/air/sunrise_tad.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/29 16:00 Desc: 日出和日落数据 https://www.timeanddate.com """ from io import StringIO import pandas as pd import requests def sunrise_city_list() -> list: """ 查询日出与日落数据的城市列表 https://www.timeanddate.com/astronomy/china :return: 所有可以获取的数据的城市列表 :rtype: list """ url = "https://www.timeanddate.com/astronomy/china" r = requests.get(url) city_list = [] china_city_one_df = pd.read_html(StringIO(r.text))[1] china_city_two_df = pd.read_html(StringIO(r.text))[2] city_list.extend([item.lower() for item in china_city_one_df.iloc[:, 0].tolist()]) city_list.extend([item.lower() for item in china_city_one_df.iloc[:, 3].tolist()]) city_list.extend([item.lower() for item in china_city_one_df.iloc[:, 6].tolist()]) city_list.extend([item.lower() for item in china_city_two_df.iloc[:, 0].tolist()]) city_list.extend([item.lower() for item in china_city_two_df.iloc[:, 1].tolist()]) city_list.extend([item.lower() for item in china_city_two_df.iloc[:, 2].tolist()]) city_list.extend([item.lower() for item in china_city_two_df.iloc[:, 3].tolist()]) city_list.extend( [item.lower() for item in china_city_two_df.iloc[:, 4].dropna().tolist()] ) return city_list def sunrise_daily(date: str = "20240428", city: str = "beijing") -> pd.DataFrame: """ 每日日出日落数据 https://www.timeanddate.com/astronomy/china/shaoxing :param date: 需要查询的日期, e.g., “20200428” :type date: str :param city: 需要查询的城市; 注意输入的格式, e.g., "北京", "上海" :type city: str :return: 返回指定日期指定地区的日出日落数据 :rtype: pandas.DataFrame """ import urllib3 urllib3.disable_warnings() if city in sunrise_city_list(): year = date[:4] month = date[4:6] url = f"https://www.timeanddate.com/sun/china/{city}?month={month}&year={year}" r = requests.get(url, verify=False) table = pd.read_html(StringIO(r.text), header=2)[1] month_df = table.iloc[:-1,] day_df = month_df[ month_df.iloc[:, 0].astype(str).str.zfill(2) == date[6:] ].copy() day_df.index = pd.to_datetime([date] * len(day_df), format="%Y%m%d") day_df.reset_index(inplace=True) day_df.rename(columns={"index": "date"}, inplace=True) day_df["date"] = pd.to_datetime(day_df["date"]).dt.date return day_df else: raise "请输入正确的城市名称" def sunrise_monthly(date: str = "20240428", city: str = "beijing") -> pd.DataFrame: """ 每个指定 date 所在月份的每日日出日落数据, 如果当前月份未到月底, 则以预测值填充 https://www.timeanddate.com/astronomy/china/shaoxing :param date: 需要查询的日期, 这里用来指定 date 所在的月份; e.g., “20200428” :type date: str :param city: 需要查询的城市; 注意输入的格式, e.g., "北京", "上海" :type city: str :return: 指定 date 所在月份的每日日出日落数据 :rtype: pandas.DataFrame """ import urllib3 urllib3.disable_warnings() if city in sunrise_city_list(): year = date[:4] month = date[4:6] url = f"https://www.timeanddate.com/sun/china/{city}?month={month}&year={year}" r = requests.get(url) table = pd.read_html(StringIO(r.text), header=2)[1] month_df = table.iloc[:-1,].copy() month_df.index = [date[:-2]] * len(month_df) month_df.reset_index(inplace=True) month_df.rename( columns={ "index": "date", }, inplace=True, ) return month_df else: raise "请输入正确的城市名称" if __name__ == "__main__": sunrise_daily_df = sunrise_daily(date="20240428", city="beijing") print(sunrise_daily_df) sunrise_monthly_df = sunrise_monthly(date="20240428", city="beijing") print(sunrise_monthly_df) ================================================ FILE: akshare/article/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/11/12 14:51 Desc: """ ================================================ FILE: akshare/article/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/11/14 20:32 Desc: 学术板块配置文件 """ # EPU epu_home_url = "http://www.policyuncertainty.com/index.html" # FF-Factor ff_home_url = "http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html" ================================================ FILE: akshare/article/epu_index.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/1/20 22:00 Desc: 经济政策不确定性指数 https://www.policyuncertainty.com/index.html """ import pandas as pd def article_epu_index(symbol: str = "China") -> pd.DataFrame: """ 经济政策不确定性指数 https://www.policyuncertainty.com/index.html :param symbol: 指定的国家名称, e.g. “China” :type symbol: str :return: 经济政策不确定性指数数据 :rtype: pandas.DataFrame """ # 切勿修改 http 否则会读取不到 csv 文件 if symbol == "China New": symbol = "SCMP_China" if symbol == "China": symbol = "SCMP_China" if symbol == "USA": symbol = "US" if symbol == "Hong Kong": symbol = "HK" epu_df = pd.read_excel( io=f"http://www.policyuncertainty.com/media/{symbol}_EPU_Data_Annotated.xlsx", engine="openpyxl", ) return epu_df if symbol in ["Germany", "France", "Italy"]: # 欧洲 symbol = "Europe" if symbol == "South Korea": symbol = "Korea" if symbol == "Spain New": symbol = "Spain" if symbol in ["Ireland", "Chile", "Colombia", "Netherlands", "Singapore", "Sweden"]: epu_df = pd.read_excel( io=f"http://www.policyuncertainty.com/media/{symbol}_Policy_Uncertainty_Data.xlsx", engine="openpyxl", ) return epu_df if symbol == "Greece": epu_df = pd.read_excel( io=f"http://www.policyuncertainty.com/media/FKT_{symbol}_Policy_Uncertainty_Data.xlsx", engine="openpyxl", ) return epu_df url = f"http://www.policyuncertainty.com/media/{symbol}_Policy_Uncertainty_Data.csv" epu_df = pd.read_csv(url) return epu_df if __name__ == "__main__": article_epu_index_df = article_epu_index(symbol="China") print(article_epu_index_df) ================================================ FILE: akshare/article/ff_factor.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/1/20 22:30 Desc: FF-data-library https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html """ from io import StringIO import pandas as pd import requests from akshare.article.cons import ff_home_url def article_ff_crr() -> pd.DataFrame: """ FF多因子模型 https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html :return: FF多因子模型单一表格 :rtype: pandas.DataFrame """ res = requests.get(ff_home_url) # first table list_index = ( pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[2, :] .index.tolist() ) list_0 = [ item for item in pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[0, :] .iloc[0] .split(" ") if item != "" ] list_1 = [ item for item in pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[0, :] .iloc[1] .split(" ") if item != "" ] list_2 = [ item for item in pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[0, :] .iloc[2] .split(" ") if item != "" ] list_0.insert(0, "-") list_1.insert(0, "-") list_2.insert(0, "-") temp_columns = ( pd.read_html(StringIO(res.text), header=0)[4] .iloc[:, 0] .str.split(" ", expand=True) .T[0] .dropna() .tolist() ) table_one = pd.DataFrame( [list_0, list_1, list_2], index=list_index, columns=temp_columns ).T # second table list_index = ( pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[1, :] .index.tolist() ) list_0 = [ item for item in pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[1, :] .iloc[0] .split(" ") if item != "" ] list_1 = [ item for item in pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[1, :] .iloc[1] .split(" ") if item != "" ] list_2 = [ item for item in pd.read_html(StringIO(res.text), header=0, index_col=0)[4] .iloc[1, :] .iloc[2] .split(" ") if item != "" ] list_0.insert(0, "-") list_1.insert(0, "-") list_2.insert(0, "-") temp_columns = ( pd.read_html(StringIO(res.text), header=0)[4] .iloc[:, 0] .str.split(" ", expand=True) .T[1] .dropna() .tolist() ) table_two = pd.DataFrame( [list_0, list_1, list_2], index=list_index, columns=temp_columns ).T # third table df = pd.read_html(StringIO(res.text), header=0, index_col=0)[4].iloc[2, :] name_list = ( pd.read_html(StringIO(res.text), header=0)[4] .iloc[:, 0] .str.split(r" ", expand=True) .iloc[2, :] .tolist() ) value_list_0 = df.iloc[0].split(" ") value_list_0.insert(0, "-") value_list_0.insert(1, "-") value_list_0.insert(8, "-") value_list_0.insert(15, "-") value_list_1 = df.iloc[1].split(" ") value_list_1.insert(0, "-") value_list_1.insert(1, "-") value_list_1.insert(8, "-") value_list_1.insert(15, "-") value_list_2 = df.iloc[2].split(" ") value_list_2.insert(0, "-") value_list_2.insert(1, "-") value_list_2.insert(8, "-") value_list_2.insert(15, "-") name_list.remove("Small Growth Big Value") name_list.insert(5, "Small Growth") name_list.insert(6, "Big Value") temp_list = [item for item in name_list if "Portfolios" not in item] temp_list.insert(0, "Fama/French Research Portfolios") temp_list.insert(1, "Size and Book-to-Market Portfolios") temp_list.insert(8, "Size and Operating Profitability Portfolios") temp_list.insert(15, "Size and Investment Portfolios") temp_df = pd.DataFrame([temp_list, value_list_0, value_list_1, value_list_2]).T temp_df.index = temp_df.iloc[:, 0] temp_df = temp_df.iloc[:, 1:] # concat all_df = pd.DataFrame() all_df = pd.concat([all_df, table_one]) all_df = pd.concat([all_df, table_two]) temp_df.columns = table_two.columns all_df = pd.concat([all_df, temp_df]) all_df.reset_index(inplace=True) all_df.rename(columns={"index": "item"}, inplace=True) return all_df if __name__ == "__main__": article_ff_crr_df = article_ff_crr() print(article_ff_crr_df) ================================================ FILE: akshare/article/fred_md.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2020/4/10 19:58 Desc: Economic Research from Federal Reserve Bank of St. Louis https://research.stlouisfed.org/econ/mccracken/fred-databases/ FRED-MD and FRED-QD are large macroeconomic databases designed for the empirical analysis of “big data.” The datasets of monthly and quarterly observations mimic the coverage of datasets already used in the literature, but they add three appealing features. They are updated in real-time through the FRED database. They are publicly accessible, facilitating the replication of empirical work. And they relieve the researcher of the task of incorporating data changes and revisions (a task accomplished by the data desk at the Federal Reserve Bank of St. Louis). """ import pandas as pd def fred_md(date: str = "2020-01") -> pd.DataFrame: """ The accompanying paper shows that factors extracted from the FRED-MD dataset share the same predictive content as those based on the various vintages of the so-called Stock-Watson data. In addition, it suggests that diffusion indexes constructed as the partial sum of the factor estimates can potentially be useful for the study of business cycle chronology. :param date: e.g., "2020-03"; from "2015-01" to now :type date: str :return: Monthly Data :rtype: pandas.DataFrame """ url = ( f"https://s3.amazonaws.com/files.fred.stlouisfed.org/fred-md/monthly/{date}.csv" ) temp_df = pd.read_csv(url) return temp_df def fred_qd(date: str = "2020-01") -> pd.DataFrame: """ FRED-QD is a quarterly frequency companion to FRED-MD. It is designed to emulate the dataset used in "Disentangling the Channels of the 2007-2009 Recession" by Stock and Watson (2012, NBER WP No. 18094) but also contains several additional series. Comments or suggestions are welcome. :param date: e.g., "2020-03"; from "2015-01" to now :type date: str :return: Quarterly Data :rtype: pandas.DataFrame """ url = f"https://s3.amazonaws.com/files.fred.stlouisfed.org/fred-md/quarterly/{date}.csv" temp_df = pd.read_csv(url) return temp_df if __name__ == "__main__": fred_md_df = fred_md(date="2023-03") print(fred_md_df) fred_qd_df = fred_qd(date="2023-03") print(fred_qd_df) ================================================ FILE: akshare/article/risk_rv.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/1/20 20:51 Desc: 修大成主页-Risk Lab-Realized Volatility; Oxford-Man Institute of Quantitative Finance Realized Library """ import json import pandas as pd import requests import urllib3 from bs4 import BeautifulSoup urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) def article_oman_rv(symbol: str = "FTSE", index: str = "rk_th2") -> pd.DataFrame: """ Oxford-Man Institute of Quantitative Finance Realized Library 的数据 :param symbol: str ['AEX', 'AORD', 'BFX', 'BSESN', 'BVLG', 'BVSP', 'DJI', 'FCHI', 'FTMIB', 'FTSE', 'GDAXI', 'GSPTSE', 'HSI', 'IBEX', 'IXIC', 'KS11', 'KSE', 'MXX', 'N225', 'NSEI', 'OMXC20', 'OMXHPI', 'OMXSPI', 'OSEAX', 'RUT', 'SMSI', 'SPX', 'SSEC', 'SSMI', 'STI', 'STOXX50E'] :param index: str 指标 ['medrv', 'rk_twoscale', 'bv', 'rv10', 'rv5', 'rk_th2', 'rv10_ss', 'rsv', 'rv5_ss', 'bv_ss', 'rk_parzen', 'rsv_ss'] :return: pandas.DataFrame The Oxford-Man Institute's "realised library" contains daily non-parametric measures of how volatility financial assets or indexes were in the past. Each day's volatility measure depends solely on financial data from that day. They are driven by the use of the latest innovations in econometric modelling and theory to design them, while we draw our high frequency data from the Thomson Reuters DataScope Tick History database. Realised measures are not volatility forecasts. However, some researchers use these measures as an input into forecasting models. The aim of this line of research is to make financial markets more transparent by exposing how volatility changes through time. This Library is used as the basis of some of our own research, which effects its scope, and is made available here to encourage the more widespread exploitation of these methods. It is given 'as is' and solely for informational purposes, please read the disclaimer. The volatility data can be visually explored. We make the complete up-to-date dataset available for download. Lists of assets covered and realized measures available are also available. | Symbol | Name | Earliest Available | Latest Available | |-----------|-------------------------------------------|--------------------|-------------------| | .AEX | AEX index | January 03, 2000 | November 28, 2019 | | .AORD | All Ordinaries | January 04, 2000 | November 28, 2019 | | .BFX | Bell 20 Index | January 03, 2000 | November 28, 2019 | | .BSESN | S&P BSE Sensex | January 03, 2000 | November 28, 2019 | | .BVLG | PSI All-Share Index | October 15, 2012 | November 28, 2019 | | .BVSP | BVSP BOVESPA Index | January 03, 2000 | November 28, 2019 | | .DJI | Dow Jones Industrial Average | January 03, 2000 | November 27, 2019 | | .FCHI | CAC 40 | January 03, 2000 | November 28, 2019 | | .FTMIB | FTSE MIB | June 01, 2009 | November 28, 2019 | | .FTSE | FTSE 100 | January 04, 2000 | November 28, 2019 | | .GDAXI | DAX | January 03, 2000 | November 28, 2019 | | .GSPTSE | S&P/TSX Composite index | May 02, 2002 | November 28, 2019 | | .HSI | HANG SENG Index | January 03, 2000 | November 28, 2019 | | .IBEX | IBEX 35 Index | January 03, 2000 | November 28, 2019 | | .IXIC | Nasdaq 100 | January 03, 2000 | November 27, 2019 | | .KS11 | Korea Composite Stock Price Index (KOSPI) | January 04, 2000 | November 28, 2019 | | .KSE | Karachi SE 100 Index | January 03, 2000 | November 28, 2019 | | .MXX | IPC Mexico | January 03, 2000 | November 28, 2019 | | .N225 | Nikkei 225 | February 02, 2000 | November 28, 2019 | | .NSEI | NIFTY 50 | January 03, 2000 | November 28, 2019 | | .OMXC20 | OMX Copenhagen 20 Index | October 03, 2005 | November 28, 2019 | | .OMXHPI | OMX Helsinki All Share Index | October 03, 2005 | November 28, 2019 | | .OMXSPI | OMX Stockholm All Share Index | October 03, 2005 | November 28, 2019 | | .OSEAX | Oslo Exchange All-share Index | September 03, 2001 | November 28, 2019 | | .RUT | Russel 2000 | January 03, 2000 | November 27, 2019 | | .SMSI | Madrid General Index | July 04, 2005 | November 28, 2019 | | .SPX | S&P 500 Index | January 03, 2000 | November 27, 2019 | | .SSEC | Shanghai Composite Index | January 04, 2000 | November 28, 2019 | | .SSMI | Swiss Stock Market Index | January 04, 2000 | November 28, 2019 | | .STI | Straits Times Index | January 03, 2000 | November 28, 2019 | | .STOXX50E | EURO STOXX 50 | January 03, 2000 | November 28, 2019 | """ url = "https://realized.oxford-man.ox.ac.uk/theme/js/visualization-data.js?20191111113154" res = requests.get(url) soup = BeautifulSoup(res.text, "lxml") soup_text = soup.find("p").get_text() data_json = json.loads(soup_text[soup_text.find("{") : soup_text.rfind("};") + 1]) date_list = data_json[f".{symbol}"]["dates"] temp_df = pd.DataFrame([date_list, data_json[f".{symbol}"][index]["data"]]).T temp_df.index = pd.to_datetime(temp_df.iloc[:, 0], unit="ms") temp_df = temp_df.iloc[:, 1] temp_df.index.name = "date" temp_df.name = f"{symbol}-{index}" return temp_df def article_oman_rv_short(symbol: str = "FTSE") -> pd.DataFrame: """ Oxford-Man Institute of Quantitative Finance Realized Library 的数据 :param symbol: str FTSE: FTSE 100, GDAXI: DAX, RUT: Russel 2000, SPX: S&P 500 Index, STOXX50E: EURO STOXX 50, SSEC: Shanghai Composite Index, N225: Nikkei 225 :return: pandas.DataFrame The Oxford-Man Institute's "realised library" contains daily non-parametric measures of how volatility financial assets or indexes were in the past. Each day's volatility measure depends solely on financial data from that day. They are driven by the use of the latest innovations in econometric modelling and theory to design them, while we draw our high frequency data from the Thomson Reuters DataScope Tick History database. Realised measures are not volatility forecasts. However, some researchers use these measures as an input into forecasting models. The aim of this line of research is to make financial markets more transparent by exposing how volatility changes through time. This Library is used as the basis of some of our own research, which effects its scope, and is made available here to encourage the more widespread exploitation of these methods. It is given 'as is' and solely for informational purposes, please read the disclaimer. The volatility data can be visually explored. We make the complete up-to-date dataset available for download. Lists of assets covered and realized measures available are also available. """ url = "https://realized.oxford-man.ox.ac.uk/theme/js/front-page-chart.js" headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "realized.oxford-man.ox.ac.uk", "Pragma": "no-cache", "Referer": "https://realized.oxford-man.ox.ac.uk/?from=groupmessage&isappinstalled=0", "Sec-Fetch-Mode": "no-cors", "Sec-Fetch-Site": "same-origin", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", } res = requests.get(url, headers=headers, verify=False) soup = BeautifulSoup(res.text, "lxml") soup_text = soup.find("p").get_text() data_json = json.loads(soup_text[soup_text.find("{") : soup_text.rfind("}") + 1]) temp_df = pd.DataFrame(data_json[f".{symbol}"]["data"]) temp_df.index = pd.to_datetime(temp_df.iloc[:, 0], unit="ms") temp_df = temp_df.iloc[:, 1] temp_df.index.name = "date" temp_df.name = f"{symbol}" return temp_df def article_rlab_rv(symbol: str = "39693") -> pd.DataFrame: """ 修大成主页-Risk Lab-Realized Volatility :param symbol: str 股票代码 :return: pandas.DataFrame 1996-01-02 0.000000 1996-01-04 0.000000 1996-01-05 0.000000 1996-01-09 0.000000 1996-01-10 0.000000 ... 2019-11-04 0.175107 2019-11-05 0.185112 2019-11-06 0.210373 2019-11-07 0.240808 2019-11-08 0.199549 Name: RV, Length: 5810, dtype: float64 Website https://dachxiu.chicagobooth.edu/ Objective We provide up-to-date daily annualized realized volatilities for individual stocks, ETFs, and future contracts, which are estimated from high-frequency data. We are in the process of incorporating equities from global markets. Data We collect trades at their highest frequencies available (up to every millisecond for US equities after 2007), and clean them using the prevalent national best bid and offer (NBBO) that are available up to every second. The mid-quotes are calculated based on the NBBOs, so their highest sampling frequencies are also up to every second. Methodology We provide quasi-maximum likelihood estimates of volatility (QMLE) based on moving-average models MA(q), using non-zero returns of transaction prices (or mid-quotes if available) sampled up to their highest frequency available, for days with at least 12 observations. We select the best model (q) using Akaike Information Criterion (AIC). For comparison, we report realized volatility (RV) estimates using 5-minute and 15-minute subsampled returns. References 1. “When Moving-Average Models Meet High-Frequency Data: Uniform Inference on Volatility”, by Rui Da and Dacheng Xiu. 2017. 2. “Quasi-Maximum Likelihood Estimation of Volatility with High Frequency Data”, by Dacheng Xiu. Journal of Econometrics, 159 (2010), 235-250. 3. “How Often to Sample A Continuous-time Process in the Presence of Market Microstructure Noise”, by Yacine Aït-Sahalia, Per Mykland, and Lan Zhang. Review of Financial Studies, 18 (2005), 351–416. 4. “The Distribution of Exchange Rate Volatility”, by Torben Andersen, Tim Bollerslev, Francis X. Diebold, and Paul Labys. Journal of the American Statistical Association, 96 (2001), 42-55. 5. “Econometric Analysis of Realized Volatility and Its Use in Estimating Stochastic Volatility Models”, by Ole E Barndorff‐Nielsen and Neil Shephard. Journal of the Royal Statistical Society: Series B, 64 (2002), 253-280. """ print("由于服务器在国外, 请稍后, 如果访问失败, 请使用代理工具") url = "https://dachxiu.chicagobooth.edu/data.php" payload = {"ticker": symbol} res = requests.get(url, params=payload, verify=False) soup = BeautifulSoup(res.text, "lxml") title_fore = ( pd.DataFrame(soup.find("p").get_text().split(symbol)).iloc[0, 0].strip() ) title_list = ( pd.DataFrame(soup.find("p").get_text().split(symbol)) .iloc[1, 0] .strip() .split("\n") ) title_list.insert(0, title_fore) temp_df = pd.DataFrame(soup.find("p").get_text().split(symbol)).iloc[2:, :] temp_df = temp_df.iloc[:, 0].str.split(" ", expand=True) temp_df = temp_df.iloc[:, 1:] temp_df.iloc[:, -1] = temp_df.iloc[:, -1].str.replace(r"\n", "") temp_df.reset_index(inplace=True) temp_df.index = pd.to_datetime(temp_df.iloc[:, 1], format="%Y%m%d", errors="coerce") temp_df = temp_df.iloc[:, 1:] data_se = temp_df.iloc[:, 1] data_se.name = "RV" temp_df = data_se.astype("float", errors="ignore") temp_df.index.name = "date" return temp_df if __name__ == "__main__": article_rlab_rv_df = article_rlab_rv(symbol="39693") print(article_rlab_rv_df) article_oman_rv_short_df = article_oman_rv_short(symbol="FTSE") print(article_oman_rv_short_df) article_oman_rv_df = article_oman_rv(symbol="FTSE", index="rk_th2") print(article_oman_rv_df) ================================================ FILE: akshare/bank/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/11/7 14:06 Desc: """ ================================================ FILE: akshare/bank/bank_cbirc_2020.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/2/4 23:00 Desc: 中国银行保险监督管理委员会-首页-政务信息-行政处罚-银保监分局本级-XXXX行政处罚信息公开表 https://www.nfra.gov.cn/cn/view/pages/ItemList.html?itemPId=923&itemId=4115&itemUrl=ItemListRightList.html&itemName=%E9%93%B6%E4%BF%9D%E7%9B%91%E5%88%86%E5%B1%80%E6%9C%AC%E7%BA%A7&itemsubPId=931&itemsubPName=%E8%A1%8C%E6%94%BF%E5%A4%84%E7%BD%9A#2 提取 具体页面 html 页面的 json 接口 https://www.nfra.gov.cn/cn/static/data/DocInfo/SelectByDocId/data_docId=881446.json 2020 新接口 """ import warnings from io import StringIO import pandas as pd import requests from tqdm import tqdm from akshare.bank.cons import cbirc_headers_without_cookie_2020 def bank_fjcf_total_num(item: str = "分局本级") -> int: """ 首页-政务信息-行政处罚-银保监分局本级 总页数 https://www.nfra.gov.cn/cn/view/pages/ItemList.html?itemPId=923&itemId=4115&itemUrl=ItemListRightList.html&itemName=%E9%93%B6%E4%BF%9D%E7%9B%91%E5%88%86%E5%B1%80%E6%9C%AC%E7%BA%A7&itemsubPId=931 :param item: choice of {"机关", "本级", "分局本级"} :type item: str :return: 总页数 :rtype: int """ item_id_list = { "机关": "4113", "本级": "4114", "分局本级": "4115", } cbirc_headers = cbirc_headers_without_cookie_2020.copy() main_url = "https://www.nfra.gov.cn/cbircweb/DocInfo/SelectDocByItemIdAndChild" params = { "itemId": item_id_list[item], "pageSize": "18", "pageIndex": "1", } res = requests.get(main_url, params=params, headers=cbirc_headers) return int(res.json()["data"]["total"]) def bank_fjcf_total_page(item: str = "分局本级", begin: int = 1) -> int: """ 获取首页-政务信息-行政处罚-银保监分局本级的总页数 https://www.nfra.gov.cn/cn/view/pages/ItemList.html?itemPId=923&itemId=4115&itemUrl=ItemListRightList.html&itemName=%E9%93%B6%E4%BF%9D%E7%9B%91%E5%88%86%E5%B1%80%E6%9C%AC%E7%BA%A7&itemsubPId=931 :param item: choice of {"机关", "本级", "分局本级"} :type item: str :param begin: 开始页数 :type begin: str :return: 总页数 :rtype: int """ item_id_list = { "机关": "4113", "本级": "4114", "分局本级": "4115", } cbirc_headers = cbirc_headers_without_cookie_2020.copy() main_url = "https://www.nfra.gov.cn/cbircweb/DocInfo/SelectDocByItemIdAndChild" params = { "itemId": item_id_list[item], "pageSize": "18", "pageIndex": str(begin), } res = requests.get(main_url, params=params, headers=cbirc_headers) if res.json()["data"]["total"] / 18 > int(res.json()["data"]["total"] / 18): total_page = int(res.json()["data"]["total"] / 18) + 1 return total_page def bank_fjcf_page_url( page: int = 5, item: str = "分局本级", begin: int = 1 ) -> pd.DataFrame: """ 获取 首页-政务信息-行政处罚-银保监分局本级-每一页的 json 数据 :param page: 需要获取前 page 页的内容, 总页数请通过 ak.bank_fjcf_total_page() 获取 :type page: int :param item: choice of {"机关", "本级", "分局本级"} :type item: str :param begin: 开始页数 :type begin: str :return: 需要的字段 :rtype: pandas.DataFrame """ item_id_list = { "机关": "4113", "本级": "4114", "分局本级": "4115", } cbirc_headers = cbirc_headers_without_cookie_2020.copy() main_url = "https://www.nfra.gov.cn/cbircweb/DocInfo/SelectDocByItemIdAndChild" temp_df = pd.DataFrame() for i_page in tqdm(range(begin, page + begin), leave=False): params = { "itemId": item_id_list[item], "pageSize": "18", "pageIndex": str(i_page), } res = requests.get(main_url, params=params, headers=cbirc_headers) temp_df = pd.concat([temp_df, pd.DataFrame(res.json()["data"]["rows"])]) return temp_df[ ["docId", "docSubtitle", "publishDate", "docFileUrl", "docTitle", "generaltype"] ] def bank_fjcf_table_detail( page: int = 5, item: str = "分局本级", begin: int = 1 ) -> pd.DataFrame: """ 获取 首页-政务信息-行政处罚-银保监分局本级-XXXX行政处罚信息公开表 数据 :param page: 需要获取前 page 页的内容, 总页数请通过 ak.bank_fjcf_total_page() 获取 :type page: int :param item: choice of {"机关", "本级", "分局本级"} :type item: str :param begin: 开始页面 :type begin: int :return: 返回所有行政处罚信息公开表的集合, 按第一页到最后一页的顺序排列 :rtype: pandas.DataFrame """ id_list = bank_fjcf_page_url(page=page, item=item, begin=begin)["docId"] big_df = pd.DataFrame() for item in id_list: url = f"https://www.nfra.gov.cn/cn/static/data/DocInfo/SelectByDocId/data_docId={item}.json" res = requests.get(url) try: table_list = pd.read_html(StringIO(res.json()["data"]["docClob"]))[0] if table_list.shape[1] == 2: table_list = table_list.iloc[:, 1].values.tolist() else: table_list = table_list.iloc[:, 3:].values.tolist() # 部分旧表缺少字段,所以填充 if len(table_list) == 7: table_list.insert(2, pd.NA) table_list.insert(3, pd.NA) table_list.insert(4, pd.NA) elif len(table_list) == 8: table_list.insert(1, pd.NA) table_list.insert(2, pd.NA) elif len(table_list) == 9: table_list.insert(2, pd.NA) elif len(table_list) == 11: table_list = table_list[2:] table_list.insert(2, pd.NA) else: print( f"{item} 异常,请通过 https://www.nfra.gov.cn/cn/view/pages/ItemDetail.html?docId={item} 查看" ) continue # 部分会变成嵌套列表, 这里还原 table_list = [ item[0] if isinstance(item, list) else item for item in table_list ] table_list.append(str(item)) table_list.append(res.json()["data"]["publishDate"]) table_df = pd.DataFrame(table_list) table_df.columns = ["内容"] big_df = pd.concat(objs=[big_df, table_df.T], ignore_index=True) # 解决有些页面缺少字段的问题, 都放到 try 里面 except: # noqa: E722 warnings.warn(f"{item} 不是表格型数据,将跳过采集") continue if big_df.empty: return pd.DataFrame() big_df.columns = [ "行政处罚决定书文号", "姓名", "单位", # 20200108 新增 "单位名称", "主要负责人姓名", "主要违法违规事实(案由)", "行政处罚依据", "行政处罚决定", "作出处罚决定的机关名称", "作出处罚决定的日期", "处罚ID", "处罚公布日期", ] return big_df if __name__ == "__main__": bank_fjcf_table_detail_df = bank_fjcf_table_detail(page=1, item="机关", begin=1) print(bank_fjcf_table_detail_df) ================================================ FILE: akshare/bank/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/4/3 21:06 Desc: 银保监会配置文件 """ cbirc_headers_without_cookie_2020 = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "www.nfra.gov.cn", "Pragma": "no-cache", "Referer": "http://www.nfra.gov.cn/cn/view/pages/ItemList.html?itemPId=923&itemId=4115&itemUrl=ItemListRightList.html&itemName=%E9%93%B6%E4%BF%9D%E7%9B%91%E5%88%86%E5%B1%80%E6%9C%AC%E7%BA%A7&itemsubPId=931&itemsubPName=%E8%A1%8C%E6%94%BF%E5%A4%84%E7%BD%9A", "X-Requested-With": "XMLHttpRequest", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", } cbirc_headers_without_cookie_2019 = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "www.nfra.gov.cn", "Pragma": "no-cache", "Referer": "http://www.nfra.gov.cn/cn/list/9103/910305/ybjjcf/1.html", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", } ================================================ FILE: akshare/bond/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/9/30 13:58 Desc: """ ================================================ FILE: akshare/bond/bond_buy_back_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/4/5 17:30 Desc: 东方财富网-行情中心-债券市场-质押式回购 https://quote.eastmoney.com/center/gridlist.html#bond_sz_buyback """ import pandas as pd import requests def bond_sh_buy_back_em() -> pd.DataFrame: """ 东方财富网-行情中心-债券市场-上证质押式回购 https://quote.eastmoney.com/center/gridlist.html#bond_sh_buyback :return: 上证质押式回购 :rtype: pandas.DataFrame """ url = "https://push2.eastmoney.com/api/qt/clist/get" params = { "np": "1", "fltt": "1", "invt": "2", "fs": "m:1+b:MK0356", "fields": "f12,f13,f14,f1,f2,f4,f3,f152,f17,f18,f15,f16,f5,f6", "fid": "f6", "pn": "1", "pz": "20", "po": "1", "dect": "1", "wbp2u": "|0|0|0|web", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["diff"]) temp_df.reset_index(inplace=True) temp_df["index"] = temp_df["index"] + 1 temp_df.rename( columns={ "index": "序号", "f2": "最新价", "f3": "涨跌幅", "f4": "涨跌额", "f5": "成交量", "f6": "成交额", "f12": "代码", "f14": "名称", "f15": "最高", "f16": "最低", "f17": "今开", "f18": "昨收", }, inplace=True, ) temp_df = temp_df[ [ "序号", "代码", "名称", "最新价", "涨跌额", "涨跌幅", "今开", "最高", "最低", "昨收", "成交量", "成交额", ] ] temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce") / 1000 temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce") / 100 temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce") / 1000 temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce") / 1000 temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce") / 1000 temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce") / 1000 temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce") / 1000 temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce") temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce") return temp_df def bond_sz_buy_back_em() -> pd.DataFrame: """ 东方财富网-行情中心-债券市场-深证质押式回购 https://quote.eastmoney.com/center/gridlist.html#bond_sz_buyback :return: 深证质押式回购 :rtype: pandas.DataFrame """ url = "https://push2.eastmoney.com/api/qt/clist/get" params = { "np": "1", "fltt": "1", "invt": "2", "fs": "m:0+b:MK0356", "fields": "f12,f13,f14,f1,f2,f4,f3,f152,f17,f18,f15,f16,f5,f6", "fid": "f6", "pn": "1", "pz": "20", "po": "1", "dect": "1", "wbp2u": "|0|0|0|web", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["diff"]) temp_df.reset_index(inplace=True) temp_df["index"] = temp_df["index"] + 1 temp_df.rename( columns={ "index": "序号", "f2": "最新价", "f3": "涨跌幅", "f4": "涨跌额", "f5": "成交量", "f6": "成交额", "f12": "代码", "f14": "名称", "f15": "最高", "f16": "最低", "f17": "今开", "f18": "昨收", }, inplace=True, ) temp_df = temp_df[ [ "序号", "代码", "名称", "最新价", "涨跌额", "涨跌幅", "今开", "最高", "最低", "昨收", "成交量", "成交额", ] ] temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce") / 1000 temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce") / 100 temp_df["涨跌额"] = pd.to_numeric(temp_df["涨跌额"], errors="coerce") / 1000 temp_df["今开"] = pd.to_numeric(temp_df["今开"], errors="coerce") / 1000 temp_df["最高"] = pd.to_numeric(temp_df["最高"], errors="coerce") / 1000 temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce") / 1000 temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce") / 1000 temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce") temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce") return temp_df def bond_buy_back_hist_em(symbol: str = "204001"): """ 东方财富网-行情中心-债券市场-质押式回购-历史数据 https://quote.eastmoney.com/center/gridlist.html#bond_sh_buyback :param symbol: 质押式回购代码 :type symbol: str :return: 历史数据 :rtype: pandas.DataFrame """ if symbol.startswith("1"): market_id = "0" else: market_id = "1" url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "secid": f"{market_id}.{symbol}", "klt": "101", "fqt": "1", "lmt": "10000", "end": "20500000", "iscca": "1", "fields1": "f1,f2,f3,f4,f5,f6,f7,f8", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64", "forcect": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) temp_df.columns = [ "日期", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "-", "-", "-", "-", "-", "-", "-", ] temp_df = temp_df[ [ "日期", "开盘", "收盘", "最高", "最低", "成交量", "成交额", ] ] 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") 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") return temp_df if __name__ == "__main__": bond_sh_buy_back_em_df = bond_sh_buy_back_em() print(bond_sh_buy_back_em_df) bond_sz_buy_back_em_df = bond_sz_buy_back_em() print(bond_sz_buy_back_em_df) bond_buy_back_hist_em_df = bond_buy_back_hist_em(symbol="204001") print(bond_buy_back_hist_em_df) bond_buy_back_hist_em_df = bond_buy_back_hist_em(symbol="131810") print(bond_buy_back_hist_em_df) ================================================ FILE: akshare/bond/bond_cb_sina.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2023/9/12 16:50 Desc: 新浪财经-债券-可转债 https://money.finance.sina.com.cn/bond/info/sz128039.html """ from io import StringIO import pandas as pd import requests def bond_cb_profile_sina(symbol: str = "sz128039") -> pd.DataFrame: """ 新浪财经-债券-可转债-详情资料 https://money.finance.sina.com.cn/bond/info/sz128039.html :param symbol: 带市场标识的转债代码 :type symbol: str :return: 可转债-详情资料 :rtype: pandas.DataFrame """ url = f"https://money.finance.sina.com.cn/bond/info/{symbol}.html" r = requests.get(url) temp_df = pd.read_html(StringIO(r.text))[0] temp_df.columns = ["item", "value"] return temp_df def bond_cb_summary_sina(symbol: str = "sh155255") -> pd.DataFrame: """ 新浪财经-债券-可转债-债券概况 https://money.finance.sina.com.cn/bond/quotes/sh155255.html :param symbol: 带市场标识的转债代码 :type symbol: str :return: 可转债-债券概况 :rtype: pandas.DataFrame """ url = f"https://money.finance.sina.com.cn/bond/quotes/{symbol}.html" r = requests.get(url) temp_df = pd.read_html(StringIO(r.text))[10] part1 = temp_df.iloc[:, 0:2].copy() part1.columns = ["item", "value"] part2 = temp_df.iloc[:, 2:4].copy() part2.columns = ["item", "value"] part3 = temp_df.iloc[:, 4:6].copy() part3.columns = ["item", "value"] big_df = pd.concat(objs=[part1, part2, part3], ignore_index=True) return big_df if __name__ == "__main__": bond_cb_profile_sina_df = bond_cb_profile_sina(symbol="sz128039") print(bond_cb_profile_sina_df) bond_cb_summary_sina_df = bond_cb_summary_sina(symbol="sh155255") print(bond_cb_summary_sina_df) ================================================ FILE: akshare/bond/bond_cb_ths.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/8/14 11:30 Desc: 同花顺-数据中心-可转债 https://data.10jqka.com.cn/ipo/bond/ """ import pandas as pd import requests def bond_zh_cov_info_ths() -> pd.DataFrame: """ 同花顺-数据中心-可转债 https://data.10jqka.com.cn/ipo/bond/ :return: 可转债行情 :rtype: pandas.DataFrame """ url = "https://data.10jqka.com.cn/ipo/kzz/" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/89.0.4389.90 Safari/537.36", } r = requests.get(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["list"]) temp_df.rename( columns={ "sub_date": "申购日期", "bond_code": "债券代码", "bond_name": "债券简称", "code": "正股代码", "name": "正股简称", "sub_code": "申购代码", "share_code": "原股东配售码", "sign_date": "中签公布日", "plan_total": "计划发行量", "issue_total": "实际发行量", "issue_price": "-", "success_rate": "中签率", "listing_date": "上市日期", "expire_date": "到期时间", "price": "转股价格", "quota": "每股获配额", "number": "中签号", "market_id": "-", "stock_market_id": "-", }, inplace=True, ) temp_df = temp_df[ [ "债券代码", "债券简称", "申购日期", "申购代码", "原股东配售码", "每股获配额", "计划发行量", "实际发行量", "中签公布日", "中签号", "上市日期", "正股代码", "正股简称", "转股价格", "到期时间", "中签率", ] ] temp_df["申购日期"] = pd.to_datetime( temp_df["申购日期"], format="%Y-%m-%d", errors="coerce" ).dt.date temp_df["中签公布日"] = pd.to_datetime( temp_df["中签公布日"], format="%Y-%m-%d", errors="coerce" ).dt.date temp_df["上市日期"] = pd.to_datetime( temp_df["上市日期"], format="%Y-%m-%d", errors="coerce" ).dt.date temp_df["到期时间"] = pd.to_datetime( temp_df["到期时间"], format="%Y-%m-%d", 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") temp_df["转股价格"] = pd.to_numeric(temp_df["转股价格"], errors="coerce") return temp_df if __name__ == "__main__": bond_zh_cov_info_ths_df = bond_zh_cov_info_ths() print(bond_zh_cov_info_ths_df) ================================================ FILE: akshare/bond/bond_cbond.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2022/9/20 17:46 Desc: 中国债券信息网-中债指数-中债指数族系-总指数-综合类指数 """ import pandas as pd import requests def bond_new_composite_index_cbond( indicator: str = "财富", period: str = "总值" ) -> pd.DataFrame: """ 中国债券信息网-中债指数-中债指数族系-总指数-综合类指数-中债-新综合指数 https://yield.chinabond.com.cn/cbweb-mn/indices/single_index_query :param indicator: choice of {"全价", "净价", "财富", "平均市值法久期", "平均现金流法久期", "平均市值法凸性", "平均现金流法凸性", "平均现金流法到期收益率", "平均市值法到期收益率", "平均基点价值", "平均待偿期", "平均派息率", "指数上日总市值", "财富指数涨跌幅", "全价指数涨跌幅", "净价指数涨跌幅", "现券结算量"} :type indicator: str :param period: choice of {"总值", "1年以下", "1-3年", "3-5年", "5-7年", "7-10年", "10年以上", "0-3个月", "3-6个月", "6-9个月", "9-12个月", "0-6个月", "6-12个月"} :type period: str :return: 新综合指数 :rtype: pandas.DataFrame """ indicator_map = { "全价": "QJZS", "净价": "JJZS", "财富": "CFZS", "平均市值法久期": "PJSZFJQ", "平均现金流法久期": "PJXJLFJQ", "平均市值法凸性": "PJSZFTX", "平均现金流法凸性": "PJXJLFTX", "平均现金流法到期收益率": "PJDQSYL", "平均市值法到期收益率": "PJSZFDQSYL", "平均基点价值": "PJJDJZ", "平均待偿期": "PJDCQ", "平均派息率": "PJPXL", "指数上日总市值": "ZSZSZ", "财富指数涨跌幅": "CFZSZDF", "全价指数涨跌幅": "QJZSZDF", "净价指数涨跌幅": "JJZSZDF", "现券结算量": "XQJSL", } period_map = { "总值": "00", "1年以下": "01", "1-3年": "02", "3-5年": "03", "5-7年": "04", "7-10年": "05", "10年以上": "06", "0-3个月": "07", "3-6个月": "08", "6-9个月": "09", "9-12个月": "10", "0-6个月": "11", "6-12个月": "12", } url = "https://yield.chinabond.com.cn/cbweb-mn/indices/singleIndexQuery" params = { "indexid": "8a8b2ca0332abed20134ea76d8885831", "": "", # noqa: F601 "qxlxt": period_map[period], "": "", # noqa: F601 "ltcslx": "", "": "", # noqa: F601 "zslxt": indicator_map[indicator], # noqa: F601 "": "", # noqa: F601 "zslxt": indicator_map[indicator], # noqa: F601 "": "", # noqa: F601 "lx": "1", "": "", # noqa: F601 "locale": "", } r = requests.post(url, params=params) data_json = r.json() temp_df = pd.DataFrame.from_dict( data_json[f"{indicator_map[indicator]}_{period_map[period]}"], orient="index", ) temp_df.reset_index(inplace=True) temp_df.columns = ["date", "value"] temp_df["date"] = temp_df["date"].astype(float) temp_df["date"] = ( pd.to_datetime(temp_df["date"], unit="ms", errors="coerce", utc=True) .dt.tz_convert("Asia/Shanghai") .dt.date ) temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce") return temp_df def bond_composite_index_cbond( indicator: str = "财富", period: str = "总值" ) -> pd.DataFrame: """ 中国债券信息网-中债指数-中债指数族系-总指数-综合类指数-中债-综合指数 https://yield.chinabond.com.cn/cbweb-mn/indices/single_index_query :param indicator: choice of {"全价", "净价", "财富", "平均市值法久期", "平均现金流法久期", "平均市值法凸性", "平均现金流法凸性", "平均现金流法到期收益率", "平均市值法到期收益率", "平均基点价值", "平均待偿期", "平均派息率", "指数上日总市值", "财富指数涨跌幅", "全价指数涨跌幅", "净价指数涨跌幅", "现券结算量"} :type indicator: str :param period: choice of {"总值", "1年以下", "1-3年", "3-5年", "5-7年", "7-10年", "10年以上", "0-3个月", "3-6个月", "6-9个月", "9-12个月", "0-6个月", "6-12个月"} :type period: str :return: 新综合指数 :rtype: pandas.DataFrame """ indicator_map = { "全价": "QJZS", "净价": "JJZS", "财富": "CFZS", "平均市值法久期": "PJSZFJQ", "平均现金流法久期": "PJXJLFJQ", "平均市值法凸性": "PJSZFTX", "平均现金流法凸性": "PJXJLFTX", "平均现金流法到期收益率": "PJDQSYL", "平均市值法到期收益率": "PJSZFDQSYL", "平均基点价值": "PJJDJZ", "平均待偿期": "PJDCQ", "平均派息率": "PJPXL", "指数上日总市值": "ZSZSZ", "财富指数涨跌幅": "CFZSZDF", "全价指数涨跌幅": "QJZSZDF", "净价指数涨跌幅": "JJZSZDF", "现券结算量": "XQJSL", } period_map = { "总值": "00", "1年以下": "01", "1-3年": "02", "3-5年": "03", "5-7年": "04", "7-10年": "05", "10年以上": "06", "0-3个月": "07", "3-6个月": "08", "6-9个月": "09", "9-12个月": "10", "0-6个月": "11", "6-12个月": "12", } url = "https://yield.chinabond.com.cn/cbweb-mn/indices/singleIndexQuery" params = { "indexid": "2c90818811afed8d0111c0c672b31578", "": "", # noqa: F601 "qxlxt": period_map[period], "": "", # noqa: F601 "zslxt": indicator_map[indicator], "": "", # noqa: F601 "lx": "1", "": "", # noqa: F601 "locale": "", } r = requests.post(url, params=params) data_json = r.json() temp_df = pd.DataFrame.from_dict( data_json[f"{indicator_map[indicator]}_{period_map[period]}"], orient="index", ) temp_df.reset_index(inplace=True) temp_df.columns = ["date", "value"] temp_df["date"] = pd.to_datetime(temp_df["date"], unit="ms").dt.date temp_df["value"] = pd.to_numeric(temp_df["value"]) return temp_df if __name__ == "__main__": bond_new_composite_index_cbond_df = bond_new_composite_index_cbond( indicator="财富", period="总值" ) print(bond_new_composite_index_cbond_df) bond_composite_index_cbond_df = bond_composite_index_cbond( indicator="财富", period="总值" ) print(bond_composite_index_cbond_df) ================================================ FILE: akshare/bond/bond_china.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/10/1 17:00 Desc: 中国外汇交易中心暨全国银行间同业拆借中心 中国外汇交易中心暨全国银行间同业拆借中心-市场数据-债券市场行情-现券市场做市报价 中国外汇交易中心暨全国银行间同业拆借中心-市场数据-债券市场行情-现券市场成交行情 https://www.chinamoney.com.cn/chinese/mkdatabond/ """ from io import StringIO import pandas as pd import requests from akshare.bond.bond_china_money import bond_china_close_return_map from akshare.utils.cons import headers def bond_spot_quote() -> pd.DataFrame: """ 中国外汇交易中心暨全国银行间同业拆借中心-市场数据-债券市场行情-现券市场做市报价 https://www.chinamoney.com.cn/chinese/mkdatabond/ :return: 现券市场做市报价 :rtype: pandas.DataFrame """ bond_china_close_return_map() url = "https://www.chinamoney.com.cn/ags/ms/cm-u-md-bond/CbMktMakQuot" payload = { "flag": "1", "lang": "cn", } r = requests.post(url=url, data=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.columns = [ "_", "_", "报价机构", "_", "_", "_", "债券简称", "_", "_", "_", "_", "买入/卖出收益率", "_", "买入/卖出净价", "_", "_", "_", ] temp_df = temp_df[ [ "报价机构", "债券简称", "买入/卖出净价", "买入/卖出收益率", ] ] temp_df["买入净价"] = ( temp_df["买入/卖出净价"].str.split("/", expand=True).iloc[:, 0] ) temp_df["卖出净价"] = ( temp_df["买入/卖出净价"].str.split("/", expand=True).iloc[:, 1] ) temp_df["买入收益率"] = ( temp_df["买入/卖出收益率"].str.split("/", expand=True).iloc[:, 0] ) temp_df["卖出收益率"] = ( temp_df["买入/卖出收益率"].str.split("/", expand=True).iloc[:, 1] ) del temp_df["买入/卖出净价"] del temp_df["买入/卖出收益率"] 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") temp_df["卖出收益率"] = pd.to_numeric(temp_df["卖出收益率"], errors="coerce") return temp_df def bond_spot_deal() -> pd.DataFrame: """ 中国外汇交易中心暨全国银行间同业拆借中心-市场数据-债券市场行情-现券市场成交行情 https://www.chinamoney.com.cn/chinese/mkdatabond/ :return: 现券市场成交行情 :rtype: pandas.DataFrame """ url = "https://www.chinamoney.com.cn/ags/ms/cm-u-md-bond/CbtPri" payload = { "flag": "1", "lang": "cn", "bondName": "", } r = requests.post(url=url, data=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.columns = [ "_", "_", "债券简称", "_", "_", "_", "_", "涨跌", "_", "_", "_", "加权收益率", "成交净价", "_", "_", "最新收益率", "-", "交易量", "_", "_", "_", "_", ] temp_df = temp_df[ [ "债券简称", "成交净价", "最新收益率", "涨跌", "加权收益率", "交易量", ] ] 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") temp_df["加权收益率"] = pd.to_numeric(temp_df["加权收益率"], errors="coerce") temp_df["交易量"] = pd.to_numeric(temp_df["交易量"], errors="coerce") return temp_df def bond_china_yield( start_date: str = "20200204", end_date: str = "20210124" ) -> pd.DataFrame: """ 中国债券信息网-国债及其他债券收益率曲线 https://www.chinabond.com.cn/ https://yield.chinabond.com.cn/cbweb-pbc-web/pbc/historyQuery?startDate=2019-02-07&endDate=2020-02-04&gjqx=0&qxId=ycqx&locale=cn_ZH 注意: end_date - start_date 应该小于一年 :param start_date: 需要查询的日期, 返回在该日期之后一年内的数据 :type start_date: str :param end_date: 需要查询的日期, 返回在该日期之前一年内的数据 :type end_date: str :return: 返回在指定日期之间之前一年内的数据 :rtype: pandas.DataFrame """ url = "https://yield.chinabond.com.cn/cbweb-pbc-web/pbc/historyQuery" params = { "startDate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "endDate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), "gjqx": "0", "qxId": "ycqx", "locale": "cn_ZH", } res = requests.get(url, params=params, headers=headers) data_text = res.text.replace(" ", "") data_df = pd.read_html(StringIO(data_text), header=0)[1] data_df["日期"] = pd.to_datetime(data_df["日期"], errors="coerce").dt.date data_df["3月"] = pd.to_numeric(data_df["3月"], errors="coerce") data_df["6月"] = pd.to_numeric(data_df["6月"], errors="coerce") data_df["1年"] = pd.to_numeric(data_df["1年"], errors="coerce") data_df["3年"] = pd.to_numeric(data_df["3年"], errors="coerce") data_df["5年"] = pd.to_numeric(data_df["5年"], errors="coerce") data_df["7年"] = pd.to_numeric(data_df["7年"], errors="coerce") data_df["10年"] = pd.to_numeric(data_df["10年"], errors="coerce") data_df["30年"] = pd.to_numeric(data_df["30年"], errors="coerce") data_df.sort_values(by="日期", inplace=True) data_df.reset_index(inplace=True, drop=True) return data_df if __name__ == "__main__": bond_spot_quote_df = bond_spot_quote() print(bond_spot_quote_df) bond_spot_deal_df = bond_spot_deal() print(bond_spot_deal_df) bond_china_yield_df = bond_china_yield(start_date="20210201", end_date="20220201") print(bond_china_yield_df) ================================================ FILE: akshare/bond/bond_china_money.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/6/27 16:00 Desc: 收盘收益率曲线历史数据 https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1 """ from functools import lru_cache import pandas as pd import requests from akshare.utils.tqdm import get_tqdm def __bond_register_service() -> requests.Session: """ 将服务注册到网站中,则该 IP 在 24 小时内可以直接访问 https://www.chinamoney.com.cn :return: 访问过的 Session :rtype: requests.Session """ session = requests.Session() headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", } session.get( url="https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1", headers=headers, ) cookies_dict = session.cookies.get_dict() cookies_str = "; ".join(f"{k}={v}" for k, v in cookies_dict.items()) # 此处需要通过未访问的游览器,首次打开 # https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1 # 页面进行人工获取 data = {"key": "TThwSjc2NWkzV0VSOVRzOA=="} headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en", "Cache-Control": "no-cache", "Connection": "keep-alive", "Content-Length": "22", "Cookie": cookies_str, "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Host": "www.chinamoney.com.cn", "Origin": "https://www.chinamoney.com.cn", "Pragma": "no-cache", "Referer": "https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } session.post( url="https://www.chinamoney.com.cn/dqs/rest/cm-u-rbt/apply", data=data, headers=headers, ) # 20231127 新增部分 https://github.com/akfamily/akshare/issues/4299 cookies_dict = session.cookies.get_dict() cookies_str = "; ".join(f"{k}={v}" for k, v in cookies_dict.items()) headers = { "Accept": "application/json, text/javascript, /; q=0.01", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en", "Connection": "keep-alive", "Content-Length": "0", "Cookie": cookies_str, "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Host": "www.chinamoney.com.cn", "Origin": "https://www.chinamoney.com.cn", "Referer": "https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1", "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } session.post( url="https://www.chinamoney.com.cn/lss/rest/cm-s-account/getSessionUser", headers=headers, ) return session @lru_cache() def bond_china_close_return_map() -> pd.DataFrame: """ 收盘收益率曲线历史数据 https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1 :return: 收盘收益率曲线历史数据 :rtype: pandas.DataFrame """ headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Content-Length": "0", "Host": "www.chinamoney.com.cn", "Origin": "https://www.chinamoney.com.cn", "Pragma": "no-cache", "Referer": "https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bk-currency/ClsYldCurvCurvGO" try: r = requests.get(url, headers=headers) data_json = r.json() except: # noqa: E722 session = __bond_register_service() r = session.get(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) return temp_df def bond_china_close_return( symbol: str = "国债", period: str = "1", start_date: str = "20231101", end_date: str = "20231101", ) -> pd.DataFrame: """ 收盘收益率曲线历史数据 https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/?bondType=CYCC000&reference=1 :param symbol: 需要获取的指标 :type period: choice of {'0.1', '0.5', '1'} :param period: 期限间隔 :type symbol: str :param start_date: 开始日期, 结束日期和开始日期不要超过 1 个月 :type start_date: str :param end_date: 结束日期, 结束日期和开始日期不要超过 1 个月 :type end_date: str :return: 收盘收益率曲线历史数据 :rtype: pandas.DataFrame """ name_code_df = bond_china_close_return_map() symbol_code = name_code_df[name_code_df["cnLabel"] == symbol]["value"].values[0] url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bk-currency/ClsYldCurvHis" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", } params = { "lang": "CN", "reference": "1,2,3", "bondType": symbol_code, "startDate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "endDate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), "termId": period, "pageNum": "1", "pageSize": "50", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) del temp_df["newDateValue"] temp_df.columns = [ "日期", "期限", "到期收益率", "即期收益率", "远期收益率", ] temp_df = temp_df[ [ "日期", "期限", "到期收益率", "即期收益率", "远期收益率", ] ] 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") temp_df["远期收益率"] = pd.to_numeric(temp_df["远期收益率"], errors="coerce") return temp_df def macro_china_swap_rate( start_date: str = "20231101", end_date: str = "20231204" ) -> pd.DataFrame: """ FR007 利率互换曲线历史数据; 只能获取近一年的数据 https://www.chinamoney.com.cn/chinese/bkcurvfxhis/?cfgItemType=72&curveType=FR007 :param start_date: 开始日期, 开始和结束日期不得超过一个月 :type start_date: str :param end_date: 结束日期, 开始和结束日期不得超过一个月 :type end_date: str :return: FR007利率互换曲线历史数据 :rtype: pandas.DataFrame """ bond_china_close_return_map() start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]]) end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]]) url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bk-shibor/IfccHis" params = { "cfgItemType": "72", "interestRateType": "0", "startDate": start_date, "endDate": end_date, "bidAskType": "", "lang": "CN", "quoteTime": "全部", "pageSize": "5000", "pageNum": "1", } headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Content-Length": "0", "Host": "www.chinamoney.com.cn", "Origin": "https://www.chinamoney.com.cn", "Pragma": "no-cache", "Referer": "https://www.chinamoney.com.cn/chinese/bkcurvfxhis/?cfgItemType=72&curveType=FR007", "sec-ch-ua": '"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } r = requests.post(url, data=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.columns = [ "日期", "_", "_", "时刻", "_", "_", "_", "_", "_", "价格类型", "_", "曲线名称", "_", "_", "_", "_", "data", ] price_df = pd.DataFrame([item for item in temp_df["data"]]) price_df.columns = [ "1M", "3M", "6M", "9M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y", ] big_df = pd.concat(objs=[temp_df, price_df], axis=1) big_df = big_df[ [ "日期", "曲线名称", "时刻", "价格类型", "1M", "3M", "6M", "9M", "1Y", "2Y", "3Y", "4Y", "5Y", "7Y", "10Y", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["1M"] = pd.to_numeric(big_df["1M"], errors="coerce") big_df["3M"] = pd.to_numeric(big_df["3M"], errors="coerce") big_df["6M"] = pd.to_numeric(big_df["6M"], errors="coerce") big_df["9M"] = pd.to_numeric(big_df["9M"], errors="coerce") big_df["1Y"] = pd.to_numeric(big_df["1Y"], errors="coerce") big_df["2Y"] = pd.to_numeric(big_df["2Y"], errors="coerce") big_df["3Y"] = pd.to_numeric(big_df["3Y"], errors="coerce") big_df["4Y"] = pd.to_numeric(big_df["4Y"], errors="coerce") big_df["5Y"] = pd.to_numeric(big_df["5Y"], errors="coerce") big_df["7Y"] = pd.to_numeric(big_df["7Y"], errors="coerce") big_df["10Y"] = pd.to_numeric(big_df["10Y"], errors="coerce") big_df.sort_values(["日期"], inplace=True, ignore_index=True) return big_df def macro_china_bond_public() -> pd.DataFrame: """ 中国-债券信息披露-债券发行 https://www.chinamoney.com.cn/chinese/xzjfx/ :return: 债券发行 :rtype: pandas.DataFrame """ bond_china_close_return_map() url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-an/bnBondEmit" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", } payload = { "enty": "", "bondType": "", "bondNameCode": "", "leadUnderwriter": "", "pageNo": "1", "pageSize": "10", "limit": "1", } r = requests.post(url, data=payload, headers=headers) data_json = r.json() total_page = int(data_json["data"]["pageTotalSize"]) + 1 big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page), leave=False): payload.update({"pageNo": page}) r = requests.post(url, data=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [ "债券全称", "债券类型", "-", "发行日期", "-", "计息方式", "-", "债券期限", "-", "债券评级", "-", "价格", "计划发行量", ] big_df = big_df[ [ "债券全称", "债券类型", "发行日期", "计息方式", "价格", "债券期限", "计划发行量", "债券评级", ] ] big_df["价格"] = pd.to_numeric(big_df["价格"], errors="coerce") big_df["计划发行量"] = pd.to_numeric(big_df["计划发行量"], errors="coerce") return big_df if __name__ == "__main__": bond_china_close_return_df = bond_china_close_return( symbol="同业存单(AAA)", period="1", start_date="20240607", end_date="20240607" ) print(bond_china_close_return_df) macro_china_swap_rate_df = macro_china_swap_rate( start_date="20251010", end_date="20251208" ) print(macro_china_swap_rate_df) macro_china_bond_public_df = macro_china_bond_public() print(macro_china_bond_public_df) ================================================ FILE: akshare/bond/bond_convert.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/5/16 19:00 Desc: 债券-集思录-可转债 集思录:https://www.jisilu.cn/data/cbnew/#cb """ from io import StringIO import pandas as pd import requests import time from akshare.utils import demjson def bond_cb_index_jsl() -> pd.DataFrame: """ 首页-可转债-集思录可转债等权指数 https://www.jisilu.cn/web/data/cb/index :return: 集思录可转债等权指数 :rtype: pandas.DataFrame """ url = "https://www.jisilu.cn/webapi/cb/index_history/" r = requests.get(url) data_dict = demjson.decode(r.text)["data"] temp_df = pd.DataFrame(data_dict) return temp_df def bond_cb_jsl(cookie: str = None) -> pd.DataFrame: """ 集思录可转债 https://www.jisilu.cn/data/cbnew/#cb :param cookie: 输入获取到的游览器 cookie :type cookie: str :return: 集思录可转债 :rtype: pandas.DataFrame """ url = "https://www.jisilu.cn/data/cbnew/cb_list_new/" headers = { "accept": "application/json, text/javascript, */*; q=0.01", "accept-encoding": "gzip, deflate, br", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", "cache-control": "no-cache", "content-length": "220", "content-type": "application/x-www-form-urlencoded; charset=UTF-8", "cookie": cookie, "origin": "https://www.jisilu.cn", "pragma": "no-cache", "referer": "https://www.jisilu.cn/data/cbnew/", "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"', "sec-ch-ua-mobile": "?0", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/91.0.4472.164 Safari/537.36", "x-requested-with": "XMLHttpRequest", } params = { "___jsl": f"LST___t={int(time.time() * 1000)}", } payload = { "fprice": "", "tprice": "", "curr_iss_amt": "", "volume": "", "svolume": "", "premium_rt": "", "ytm_rt": "", "market": "", "rating_cd": "", "is_search": "N", "market_cd[]": "shmb", # noqa: F601 "market_cd[]": "shkc", # noqa: F601 "market_cd[]": "szmb", # noqa: F601 "market_cd[]": "szcy", # noqa: F601 "btype": "", "listed": "Y", "qflag": "N", "sw_cd": "", "bond_ids": "", "rp": "50", } r = requests.post(url, params=params, json=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame([item["cell"] for item in data_json["rows"]]) temp_df.rename( columns={ "bond_id": "代码", "bond_nm": "转债名称", "price": "现价", "increase_rt": "涨跌幅", "stock_id": "正股代码", "stock_nm": "正股名称", "sprice": "正股价", "sincrease_rt": "正股涨跌", "pb": "正股PB", "convert_price": "转股价", "convert_value": "转股价值", "premium_rt": "转股溢价率", "dblow": "双低", "rating_cd": "债券评级", "put_convert_price": "回售触发价", "force_redeem_price": "强赎触发价", "convert_amt_ratio": "转债占比", "maturity_dt": "到期时间", "year_left": "剩余年限", "curr_iss_amt": "剩余规模", "volume": "成交额", "turnover_rt": "换手率", "ytm_rt": "到期税前收益", }, inplace=True, ) temp_df = temp_df[ [ "代码", "转债名称", "现价", "涨跌幅", "正股代码", "正股名称", "正股价", "正股涨跌", "正股PB", "转股价", "转股价值", "转股溢价率", "债券评级", "回售触发价", "强赎触发价", "转债占比", "到期时间", "剩余年限", "剩余规模", "成交额", "换手率", "到期税前收益", "双低", ] ] 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") temp_df["正股涨跌"] = pd.to_numeric(temp_df["正股涨跌"], errors="coerce") temp_df["正股PB"] = pd.to_numeric(temp_df["正股PB"], errors="coerce") 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") 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") 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") temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce") temp_df["到期税前收益"] = pd.to_numeric(temp_df["到期税前收益"], errors="coerce") return temp_df def bond_cb_redeem_jsl() -> pd.DataFrame: """ 集思录可转债-强赎 https://www.jisilu.cn/data/cbnew/#redeem :return: 集思录可转债-强赎 :rtype: pandas.DataFrame """ url = "https://www.jisilu.cn/data/cbnew/redeem_list/" headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Content-Length": "5", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Host": "www.jisilu.cn", "Origin": "https://www.jisilu.cn", "Pragma": "no-cache", "Referer": "https://www.jisilu.cn/data/cbnew/", "sec-ch-ua": '" Not A;Brand";v="99", "Chromium";v="101", "Google Chrome";v="101"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "Sec-Fetch-Dest": "empty", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/101.0.4951.67 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "___jsl": "LST___t=1653394005966", } payload = { "rp": "50", } r = requests.post(url, params=params, json=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame([item["cell"] for item in data_json["rows"]]) temp_df.rename( columns={ "bond_id": "代码", "bond_nm": "名称", "price": "现价", "stock_id": "正股代码", "stock_nm": "正股名称", "margin_flg": "-", "btype": "-", "orig_iss_amt": "规模", "curr_iss_amt": "剩余规模", "convert_dt": "转股起始日", "convert_price": "转股价", "next_put_dt": "-", "redeem_dt": "-", "force_redeem": "-", "redeem_flag": "-", "redeem_price": "-", "redeem_price_ratio": "强赎触发比", "real_force_redeem_price": "强赎价", "redeem_remain_days": "-", "redeem_real_days": "-", "redeem_total_days": "-", "recount_dt": "-", "redeem_count_days": "-", "redeem_tc": "强赎条款", "sprice": "正股价", "delist_dt": "最后交易日", "maturity_dt": "到期日", "redeem_icon": "强赎状态", "redeem_orders": "-", "at_maturity": "-", "redeem_count": "强赎天计数", "after_next_put_dt": "-", "force_redeem_price": "强赎触发价", }, inplace=True, ) temp_df = temp_df[ [ "代码", "名称", "现价", "正股代码", "正股名称", "规模", "剩余规模", "转股起始日", "最后交易日", "到期日", "转股价", "强赎触发比", "强赎触发价", "正股价", "强赎价", "强赎天计数", "强赎条款", "强赎状态", ] ] 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") 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_datetime(temp_df["到期日"], errors="coerce").dt.date temp_df["转股价"] = pd.to_numeric(temp_df["转股价"], errors="coerce") temp_df["强赎触发比"] = pd.to_numeric( temp_df["强赎触发比"].str.strip("%"), errors="coerce" ) 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") temp_df["强赎天计数"] = temp_df["强赎天计数"].replace( r"^.*?(\d{1,2}\/\d{1,2} \| \d{1,2}).*?$", r"\1", regex=True ) temp_df["强赎状态"] = temp_df["强赎状态"].map( { "R": "已公告强赎", "O": "公告要强赎", "G": "公告不强赎", "B": "已满足强赎条件", "": "", } ) return temp_df def bond_cb_adj_logs_jsl(symbol: str = "128013") -> pd.DataFrame: """ 集思录-可转债转股价-调整记录 https://www.jisilu.cn/data/cbnew/#cb :param symbol: 可转债代码 :type symbol: str :return: 转股价调整记录 :rtype: pandas.DataFrame """ url = f"https://www.jisilu.cn/data/cbnew/adj_logs/?bond_id={symbol}" r = requests.get(url) data_text = r.text if "" not in data_text: # 1. 该可转债没有转股价调整记录,服务端返回文本 '暂无数据' # 2. 无效可转债代码,服务端返回 {"timestamp":1639565628,"isError":1,"msg":"无效代码格式"} # 以上两种情况,返回空的 DataFrame return pd.DataFrame() else: temp_df = pd.read_html(StringIO(data_text), parse_dates=True)[0] temp_df.columns = [item.replace(" ", "") for item in temp_df.columns] 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") temp_df["股东大会日"] = pd.to_datetime( temp_df["股东大会日"], format="%Y-%m-%d", errors="coerce" ).dt.date temp_df["新转股价生效日期"] = pd.to_datetime( temp_df["新转股价生效日期"], format="%Y-%m-%d", errors="coerce" ).dt.date return temp_df if __name__ == "__main__": bond_cb_index_jsl_df = bond_cb_index_jsl() print(bond_cb_index_jsl_df) bond_cb_jsl_df = bond_cb_jsl(cookie="") print(bond_cb_jsl_df) bond_cb_redeem_jsl_df = bond_cb_redeem_jsl() print(bond_cb_redeem_jsl_df) bond_cb_adj_logs_jsl_df = bond_cb_adj_logs_jsl(symbol="128013") print(bond_cb_adj_logs_jsl_df) ================================================ FILE: akshare/bond/bond_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/4/5 17:00 Desc: 东方财富网-数据中心-经济数据-中美国债收益率 https://data.eastmoney.com/cjsj/zmgzsyl.html """ import pandas as pd import requests from akshare.utils.tqdm import get_tqdm def bond_zh_us_rate(start_date: str = "19901219") -> pd.DataFrame: """ 东方财富网-数据中心-经济数据-中美国债收益率 https://data.eastmoney.com/cjsj/zmgzsyl.html :param start_date: 开始统计时间 :type start_date: str :return: 中美国债收益率 :rtype: pandas.DataFrame """ url = "https://datacenter.eastmoney.com/api/data/get" params = { "type": "RPTA_WEB_TREASURYYIELD", "sty": "ALL", "st": "SOLAR_DATE", "sr": "-1", "token": "894050c76af8597a853f5b408b759f5d", "p": "1", "ps": "500", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params = { "type": "RPTA_WEB_TREASURYYIELD", "sty": "ALL", "st": "SOLAR_DATE", "sr": "-1", "token": "894050c76af8597a853f5b408b759f5d", "p": page, "ps": "500", "pageNo": page, "pageNum": page, } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) for col in temp_df.columns: if temp_df[col].isnull().all(): # 检查列是否包含 None 或 NaN temp_df[col] = pd.to_numeric(temp_df[col], errors="coerce") if big_df.empty: big_df = temp_df else: big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) temp_date_list = pd.to_datetime(big_df["SOLAR_DATE"]).dt.date.to_list() if pd.to_datetime(start_date) in pd.date_range( temp_date_list[-1], temp_date_list[0] ): break big_df.rename( columns={ "SOLAR_DATE": "日期", "EMM00166462": "中国国债收益率5年", "EMM00166466": "中国国债收益率10年", "EMM00166469": "中国国债收益率30年", "EMM00588704": "中国国债收益率2年", "EMM01276014": "中国国债收益率10年-2年", "EMG00001306": "美国国债收益率2年", "EMG00001308": "美国国债收益率5年", "EMG00001310": "美国国债收益率10年", "EMG00001312": "美国国债收益率30年", "EMG01339436": "美国国债收益率10年-2年", "EMM00000024": "中国GDP年增率", "EMG00159635": "美国GDP年增率", }, inplace=True, ) big_df = big_df[ [ "日期", "中国国债收益率2年", "中国国债收益率5年", "中国国债收益率10年", "中国国债收益率30年", "中国国债收益率10年-2年", "中国GDP年增率", "美国国债收益率2年", "美国国债收益率5年", "美国国债收益率10年", "美国国债收益率30年", "美国国债收益率10年-2年", "美国GDP年增率", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce") big_df["中国国债收益率2年"] = pd.to_numeric( big_df["中国国债收益率2年"], errors="coerce" ) big_df["中国国债收益率5年"] = pd.to_numeric( big_df["中国国债收益率5年"], errors="coerce" ) big_df["中国国债收益率10年"] = pd.to_numeric( big_df["中国国债收益率10年"], errors="coerce" ) big_df["中国国债收益率30年"] = pd.to_numeric( big_df["中国国债收益率30年"], errors="coerce" ) big_df["中国国债收益率10年-2年"] = pd.to_numeric( big_df["中国国债收益率10年-2年"], errors="coerce" ) big_df["中国GDP年增率"] = pd.to_numeric(big_df["中国GDP年增率"], errors="coerce") big_df["美国国债收益率2年"] = pd.to_numeric( big_df["美国国债收益率2年"], errors="coerce" ) big_df["美国国债收益率5年"] = pd.to_numeric( big_df["美国国债收益率5年"], errors="coerce" ) big_df["美国国债收益率10年"] = pd.to_numeric( big_df["美国国债收益率10年"], errors="coerce" ) big_df["美国国债收益率30年"] = pd.to_numeric( big_df["美国国债收益率30年"], errors="coerce" ) big_df["美国国债收益率10年-2年"] = pd.to_numeric( big_df["美国国债收益率10年-2年"], errors="coerce" ) big_df["美国GDP年增率"] = pd.to_numeric(big_df["美国GDP年增率"], errors="coerce") big_df.sort_values("日期", inplace=True) big_df.set_index(["日期"], inplace=True) big_df = big_df[pd.to_datetime(start_date) :] big_df.reset_index(inplace=True) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date return big_df if __name__ == "__main__": bond_zh_us_rate_df = bond_zh_us_rate(start_date="19901219") print(bond_zh_us_rate_df) ================================================ FILE: akshare/bond/bond_gb_sina.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/2/4 17:00 Desc: 新浪财经-债券-中国/美国国债收益率 https://vip.stock.finance.sina.com.cn/mkt/#hs_z """ import pandas as pd import requests def bond_gb_zh_sina(symbol: str = "中国10年期国债") -> pd.DataFrame: """ 新浪财经-债券-中国国债收益率行情数据 https://stock.finance.sina.com.cn/forex/globalbd/cn10yt.html :param symbol: choice of {"中国1年期国债", "中国2年期国债", "中国3年期国债", "中国5年期国债", "中国7年期国债", "中国10年期国债", "中国15年期国债", "中国20年期国债", "中国30年期国债"} :type symbol: str :return: 中国国债收益率行情数据 :rtype: pandas.DataFrame """ symbol_map = { "中国1年期国债": "CN1YT", "中国2年期国债": "CN2YT", "中国3年期国债": "CN3YT", "中国5年期国债": "CN5YT", "中国7年期国债": "CN7YT", "中国10年期国债": "CN10YT", "中国15年期国债": "CN15YT", "中国20年期国债": "CN20YT", "中国30年期国债": "CN30YT", } url = f"https://bond.finance.sina.com.cn/hq/gb/daily?symbol={symbol_map[symbol]}" r = requests.get(url) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "date", "open", "high", "low", "close", "volume", ] temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date temp_df["open"] = pd.to_numeric(temp_df["open"], errors="coerce") temp_df["high"] = pd.to_numeric(temp_df["high"], errors="coerce") temp_df["low"] = pd.to_numeric(temp_df["low"], errors="coerce") temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce") temp_df["volume"] = pd.to_numeric(temp_df["volume"], errors="coerce") return temp_df def bond_gb_us_sina(symbol: str = "美国10年期国债") -> pd.DataFrame: """ 新浪财经-债券-美国国债收益率行情数据 https://stock.finance.sina.com.cn/forex/globalbd/cn10yt.html :param symbol: choice of {"美国1月期国债", "美国2月期国债", "美国3月期国债", "美国4月期国债", "美国6月期国债", "美国1年期国债", "美国2年期国债", "美国3年期国债", "美国5年期国债", "美国7年期国债", "美国10年期国债", "美国20年期国债", "美国30年期国债"} :type symbol: str :return: 美国国债收益率行情数据 :rtype: pandas.DataFrame """ symbol_map = { "美国1月期国债": "US1MT", "美国2月期国债": "US2MT", "美国3月期国债": "US3MT", "美国4月期国债": "US4MT", "美国6月期国债": "US6MT", "美国1年期国债": "US1YT", "美国2年期国债": "US2YT", "美国3年期国债": "US3YT", "美国5年期国债": "US5YT", "美国7年期国债": "US7YT", "美国10年期国债": "US10YT", "美国20年期国债": "US20YT", "美国30年期国债": "US30YT", } url = f"https://bond.finance.sina.com.cn/hq/gb/daily?symbol={symbol_map[symbol]}" r = requests.get(url) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "date", "open", "high", "low", "close", "volume", ] temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date temp_df["open"] = pd.to_numeric(temp_df["open"], errors="coerce") temp_df["high"] = pd.to_numeric(temp_df["high"], errors="coerce") temp_df["low"] = pd.to_numeric(temp_df["low"], errors="coerce") temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce") temp_df["volume"] = pd.to_numeric(temp_df["volume"], errors="coerce") return temp_df if __name__ == "__main__": bond_gb_zh_sina_df = bond_gb_zh_sina(symbol="中国10年期国债") print(bond_gb_zh_sina_df) bond_gb_us_sina_df = bond_gb_us_sina(symbol="美国10年期国债") print(bond_gb_us_sina_df) ================================================ FILE: akshare/bond/bond_info_cm.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/5/10 14:00 Desc: 中国外汇交易中心暨全国银行间同业拆借中心 https://www.chinamoney.com.cn/chinese/scsjzqxx/ """ import functools import pandas as pd import requests from akshare.utils.tqdm import get_tqdm from akshare.bond.bond_china import bond_china_close_return_map @functools.lru_cache() def bond_info_cm_query(symbol: str = "评级等级") -> pd.DataFrame: """ 中国外汇交易中心暨全国银行间同业拆借中心-查询相关指标的参数 https://www.chinamoney.com.cn/chinese/scsjzqxx/ :param symbol: choice of {"主承销商", "债券类型", "息票类型", "发行年份", "评级等级"} :type symbol: str :return: 查询相关指标的参数 :rtype: pandas.DataFrame """ bond_china_close_return_map() if symbol == "主承销商": url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-md/EntyFullNameSearchCondition" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/109.0.0.0 Safari/537.36" } r = requests.post(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["enty"]) temp_df.columns = ["code", "name"] temp_df = temp_df[["name", "code"]] return temp_df else: symbol_map = { "债券类型": "bondType", "息票类型": "couponType", "发行年份": "issueYear", "评级等级": "bondRtngShrt", } url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-md/BondBaseInfoSearchCondition" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/109.0.0.0 Safari/537.36" } r = requests.post(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"][f"{symbol_map[symbol]}"]) if temp_df.shape[1] == 1: temp_df.columns = ["name"] temp_df["code"] = temp_df["name"] temp_df.columns = ["code", "name"] temp_df = temp_df[["name", "code"]] return temp_df @functools.lru_cache() def bond_info_cm( bond_name: str = "", bond_code: str = "", bond_issue: str = "", bond_type: str = "", coupon_type: str = "", issue_year: str = "", underwriter: str = "", grade: str = "", ) -> pd.DataFrame: """ 中国外汇交易中心暨全国银行间同业拆借中心-数据-债券信息-信息查询 https://www.chinamoney.com.cn/chinese/scsjzqxx/ :param bond_name: 债券名称 :type bond_name: str :param bond_code: 债券代码 :type bond_code: str :param bond_issue: 发行人/受托机构 :type bond_issue: str :param bond_type: 债券类型 :type bond_type: str :param coupon_type: 息票类型 :type coupon_type: str :param issue_year: 发行年份 :type issue_year: str :param underwriter: 主承销商 :type underwriter: str :param grade: 评级等级 :type grade: str :return: 信息查询结果 :rtype: pandas.DataFrame """ bond_china_close_return_map() if bond_type: bond_type_df = bond_info_cm_query(symbol="债券类型") bond_type_df_value = bond_type_df[bond_type_df["name"] == bond_type][ "code" ].values[0] else: bond_type_df_value = "" if coupon_type: coupon_type_df = bond_info_cm_query(symbol="息票类型") coupon_type_df_value = coupon_type_df[coupon_type_df["name"] == coupon_type][ "code" ].values[0] else: coupon_type_df_value = "" if underwriter: underwriter_df = bond_info_cm_query(symbol="主承销商") underwriter_value = underwriter_df[underwriter_df["name"] == underwriter][ "code" ].values[0] else: underwriter_value = "" url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-md/BondMarketInfoList2" payload = { "pageNo": "1", "pageSize": "15", "bondName": bond_name, "bondCode": bond_code, "issueEnty": bond_issue, "bondType": bond_type_df_value if bond_type_df_value else "", "bondSpclPrjctVrty": "", "couponType": coupon_type_df_value if coupon_type_df_value else "", "issueYear": issue_year, "entyDefinedCode": underwriter_value if underwriter_value else "", "rtngShrt": grade, } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/109.0.0.0 Safari/537.36" } r = requests.post(url, data=payload, headers=headers) data_json = r.json() total_page = data_json["data"]["pageTotal"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): payload.update({"pageNo": page}) r = requests.post(url, data=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["resultList"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.rename( columns={ "bondDefinedCode": "查询代码", "bondName": "债券简称", "bondCode": "债券代码", "issueStartDate": "发行日期", "issueEndDate": "-", "bondTypeCode": "-", "bondType": "债券类型", "entyFullName": "发行人/受托机构", "entyDefinedCode": "-", "debtRtng": "最新债项评级", "isin": "-", "inptTp": "-", }, inplace=True, ) big_df = big_df[ [ "债券简称", "债券代码", "发行人/受托机构", "债券类型", "发行日期", "最新债项评级", "查询代码", ] ] return big_df @functools.lru_cache() def bond_info_detail_cm(symbol: str = "淮安农商行CDSD2022021012") -> pd.DataFrame: """ 中国外汇交易中心暨全国银行间同业拆借中心-数据-债券信息-信息查询-债券详情 https://www.chinamoney.com.cn/chinese/zqjc/?bondDefinedCode=egfjh08154 :param symbol: 债券简称 :type symbol: str :return: 债券详情 :rtype: pandas.DataFrame """ bond_china_close_return_map() url = "https://www.chinamoney.com.cn/ags/ms/cm-u-bond-md/BondDetailInfo" inner_bond_info_cm_df = bond_info_cm(bond_name=symbol) bond_code = inner_bond_info_cm_df["查询代码"].values[0] payload = {"bondDefinedCode": bond_code} headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/109.0.0.0 Safari/537.36" } r = requests.post(url, data=payload, headers=headers) data_json = r.json() data_dict = data_json["data"]["bondBaseInfo"] if data_dict["creditRateEntyList"]: del data_dict["creditRateEntyList"] if data_dict["exerciseInfoList"]: del data_dict["exerciseInfoList"] temp_df = pd.DataFrame.from_dict(data_dict, orient="index") temp_df.reset_index(inplace=True) temp_df.columns = ["name", "value"] return temp_df if __name__ == "__main__": bond_info_cm_df = bond_info_cm( bond_name="", bond_code="", bond_issue="", bond_type="短期融资券", coupon_type="零息式", issue_year="2019", grade="A-1", underwriter="重庆农村商业银行股份有限公司", ) print(bond_info_cm_df) bond_info_detail_cm_df = bond_info_detail_cm(symbol="19万林投资CP001") print(bond_info_detail_cm_df) ================================================ FILE: akshare/bond/bond_issue_cninfo.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/6/19 22:00 Desc: 巨潮资讯-数据中心-专题统计-债券报表-债券发行 http://webapi.cninfo.com.cn/#/thematicStatistics """ import pandas as pd import requests import py_mini_racer from akshare.datasets import get_ths_js def _get_file_content_cninfo(file: str = "cninfo.js") -> str: """ 获取 JS 文件的内容 :param file: JS 文件名 :type file: str :return: 文件内容 :rtype: str """ setting_file_path = get_ths_js(file) with open(setting_file_path, encoding="utf-8") as f: file_data = f.read() return file_data def bond_treasure_issue_cninfo( start_date: str = "20210910", end_date: str = "20211109" ) -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-债券报表-债券发行-国债发行 http://webapi.cninfo.com.cn/#/thematicStatistics :param start_date: 开始统计时间 :type start_date: str :param end_date: 结束统计数据 :type end_date: str :return: 国债发行 :rtype: pandas.DataFrame """ url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1120" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "http://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "http://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "sdate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "edate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), } r = requests.post(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F009D": "缴款日", "SECNAME": "债券简称", "DECLAREDATE": "公告日期", "F004D": "发行起始日", "F003D": "发行终止日", "F008N": "单位面值", "SECCODE": "债券代码", "F007N": "发行价格", "F006N": "计划发行总量", "F005N": "实际发行总量", "F028N": "增发次数", "BONDNAME": "债券名称", "F014V": "发行对象", "F002V": "交易市场", "F013V": "发行方式", }, inplace=True, ) temp_df = temp_df[ [ "债券代码", "债券简称", "发行起始日", "发行终止日", "计划发行总量", "实际发行总量", "发行价格", "单位面值", "缴款日", "增发次数", "交易市场", "发行方式", "发行对象", "公告日期", "债券名称", ] ] 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_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") temp_df["单位面值"] = pd.to_numeric(temp_df["单位面值"], errors="coerce") temp_df["增发次数"] = pd.to_numeric(temp_df["增发次数"], errors="coerce") return temp_df def bond_local_government_issue_cninfo( start_date: str = "20210911", end_date: str = "20211110" ) -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-债券报表-债券发行-地方债发行 http://webapi.cninfo.com.cn/#/thematicStatistics :param start_date: 开始统计时间 :type start_date: str :param end_date: 开始统计时间 :type end_date: str :return: 地方债发行 :rtype: pandas.DataFrame """ url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1121" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "http://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "http://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "sdate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "edate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), } r = requests.post(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F009D": "缴款日", "SECNAME": "债券简称", "DECLAREDATE": "公告日期", "F004D": "发行起始日", "F003D": "发行终止日", "F008N": "单位面值", "SECCODE": "债券代码", "F007N": "发行价格", "F006N": "计划发行总量", "F005N": "实际发行总量", "F028N": "增发次数", "BONDNAME": "债券名称", "F014V": "发行对象", "F002V": "交易市场", "F013V": "发行方式", }, inplace=True, ) temp_df = temp_df[ [ "债券代码", "债券简称", "发行起始日", "发行终止日", "计划发行总量", "实际发行总量", "发行价格", "单位面值", "缴款日", "增发次数", "交易市场", "发行方式", "发行对象", "公告日期", "债券名称", ] ] 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_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") temp_df["单位面值"] = pd.to_numeric(temp_df["单位面值"], errors="coerce") temp_df["增发次数"] = pd.to_numeric(temp_df["增发次数"], errors="coerce") return temp_df def bond_corporate_issue_cninfo( start_date: str = "20210911", end_date: str = "20211110" ) -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-债券报表-债券发行-企业债发行 http://webapi.cninfo.com.cn/#/thematicStatistics :param start_date: 开始统计时间 :type start_date: str :param end_date: 开始统计时间 :type end_date: str :return: 企业债发行 :rtype: pandas.DataFrame """ url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1122" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "http://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "http://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "sdate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "edate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), } r = requests.post(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "SECNAME": "债券简称", "DECLAREDATE": "公告日期", "F004D": "交易所网上发行终止日", "F003D": "交易所网上发行起始日", "F008N": "发行面值", "SECCODE": "债券代码", "F007N": "发行价格", "F006N": "实际发行总量", "F005N": "计划发行总量", "F022N": "最小认购单位", "F017V": "承销方式", "F052N": "最低认购额", "F015V": "发行范围", "BONDNAME": "债券名称", "F014V": "发行对象", "F013V": "发行方式", "F023V": "募资用途说明", }, inplace=True, ) temp_df = temp_df[ [ "债券代码", "债券简称", "公告日期", "交易所网上发行起始日", "交易所网上发行终止日", "计划发行总量", "实际发行总量", "发行面值", "发行价格", "发行方式", "发行对象", "发行范围", "承销方式", "最小认购单位", "募资用途说明", "最低认购额", "债券名称", ] ] 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_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") 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") return temp_df def bond_cov_issue_cninfo( start_date: str = "20210913", end_date: str = "20211112" ) -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-债券报表-债券发行-可转债发行 http://webapi.cninfo.com.cn/#/thematicStatistics :param start_date: 开始统计时间 :type start_date: str :param end_date: 开始统计时间 :type end_date: str :return: 可转债发行 :rtype: pandas.DataFrame """ url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1123" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "http://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "http://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "sdate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "edate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), } r = requests.post(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F029D": "发行起始日", "SECNAME": "债券简称", "F027D": "转股开始日期", "F003D": "发行终止日", "F007N": "发行面值", "F053D": "转股终止日期", "F005N": "计划发行总量", "F051D": "网上申购日期", "F026N": "初始转股价格", "F066N": "网上申购数量下限", "F052N": "发行价格", "BONDNAME": "债券名称", "F014V": "发行对象", "F002V": "交易市场", "F032V": "网上申购简称", "F086V": "转股代码", "DECLAREDATE": "公告日期", "F028D": "债权登记日", "F004D": "优先申购日", "F068D": "网上申购中签结果公告日及退款日", "F054D": "优先申购缴款日", "F008N": "网上申购数量上限", "SECCODE": "债券代码", "F006N": "实际发行总量", "F067N": "网上申购单位", "F065N": "配售价格", "F017V": "承销方式", "F015V": "发行范围", "F013V": "发行方式", "F021V": "募资用途说明", "F031V": "网上申购代码", }, inplace=True, ) temp_df = temp_df[ [ "债券代码", "债券简称", "公告日期", "发行起始日", "发行终止日", "计划发行总量", "实际发行总量", "发行面值", "发行价格", "发行方式", "发行对象", "发行范围", "承销方式", "募资用途说明", "初始转股价格", "转股开始日期", "转股终止日期", "网上申购日期", "网上申购代码", "网上申购简称", "网上申购数量上限", "网上申购数量下限", "网上申购单位", "网上申购中签结果公告日及退款日", "优先申购日", "配售价格", "债权登记日", "优先申购缴款日", "转股代码", "交易市场", "债券名称", ] ] 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_datetime( temp_df["发行终止日"], errors="coerce" ).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_datetime( temp_df["转股终止日期"], errors="coerce" ).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_datetime( temp_df["债权登记日"], errors="coerce" ).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") 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" ) 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") return temp_df def bond_cov_stock_issue_cninfo() -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-债券报表-债券发行-可转债转股 http://webapi.cninfo.com.cn/#/thematicStatistics :return: 可转债转股 :rtype: pandas.DataFrame """ url = "http://webapi.cninfo.com.cn/api/sysapi/p_sysapi1124" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "http://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "http://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } r = requests.post(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F003N": "转股价格", "SECNAME": "债券简称", "DECLAREDATE": "公告日期", "F005D": "自愿转换期终止日", "F004D": "自愿转换期起始日", "F017V": "标的股票", "BONDNAME": "债券名称", "F002V": "转股简称", "F001V": "转股代码", "SECCODE": "债券代码", }, inplace=True, ) temp_df = temp_df[ [ "债券代码", "债券简称", "公告日期", "转股代码", "转股简称", "转股价格", "自愿转换期起始日", "自愿转换期终止日", "标的股票", "债券名称", ] ] 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_datetime( temp_df["自愿转换期终止日"], errors="coerce" ).dt.date temp_df["转股价格"] = pd.to_numeric(temp_df["转股价格"], errors="coerce") return temp_df if __name__ == "__main__": bond_treasure_issue_cninfo_df = bond_treasure_issue_cninfo( start_date="20210910", end_date="20211109" ) print(bond_treasure_issue_cninfo_df) bond_local_government_issue_cninfo_df = bond_local_government_issue_cninfo( start_date="20210911", end_date="20211110" ) print(bond_local_government_issue_cninfo_df) bond_corporate_issue_cninfo_df = bond_corporate_issue_cninfo( start_date="20210911", end_date="20211110" ) print(bond_corporate_issue_cninfo_df) bond_cov_issue_cninfo_df = bond_cov_issue_cninfo( start_date="20210913", end_date="20211112" ) print(bond_cov_issue_cninfo_df) bond_cov_stock_issue_cninfo_df = bond_cov_stock_issue_cninfo() print(bond_cov_stock_issue_cninfo_df) ================================================ FILE: akshare/bond/bond_nafmii.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/3/16 9:00 Desc:中国银行间市场交易商协会(https://www.nafmii.org.cn/) 孔雀开屏(http://zhuce.nafmii.org.cn/fans/publicQuery/manager)的债券基本信息数据 """ import pandas as pd import requests def bond_debt_nafmii(page: str = "1") -> pd.DataFrame: """ 中国银行间市场交易商协会-非金融企业债务融资工具注册信息系统 http://zhuce.nafmii.org.cn/fans/publicQuery/manager :param page: 输入数字页码 :type page: int :return: 指定 sector 和 indicator 的数据 :rtype: pandas.DataFrame """ url = "http://zhuce.nafmii.org.cn/fans/publicQuery/releFileProjDataGrid" payload = { "regFileName": "", "itemType": "", "startTime": "", "endTime": "", "entityName": "", "leadManager": "", "regPrdtType": "", "page": page, "rows": 50, } payload.update({"page": page}) r = requests.post(url, data=payload) data_json = r.json() # 数据类型为 json 格式 temp_df = pd.DataFrame(data_json["rows"]) temp_df.rename( columns={ "firstIssueAmount": "金额", "isReg": "注册或备案", "regFileName": "债券名称", "regNoticeNo": "注册通知书文号", "regPrdtType": "品种", "releaseTime": "更新日期", "projPhase": "项目状态", }, inplace=True, ) if "注册通知书文号" not in temp_df.columns: temp_df["注册通知书文号"] = pd.NA temp_df = temp_df[ [ "债券名称", "品种", "注册或备案", "金额", "注册通知书文号", "更新日期", "项目状态", ] ] temp_df["金额"] = pd.to_numeric(temp_df["金额"], errors="coerce") temp_df["更新日期"] = pd.to_datetime(temp_df["更新日期"], errors="coerce").dt.date return temp_df if __name__ == "__main__": bond_debt_nafmii_df = bond_debt_nafmii(page="1") print(bond_debt_nafmii_df) ================================================ FILE: akshare/bond/bond_summary.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/3/5 12:55 Desc: 上登债券信息网-债券成交概览 http://bond.sse.com.cn/data/statistics/overview/turnover/ """ from io import BytesIO import pandas as pd import requests def bond_cash_summary_sse(date: str = "20210111") -> pd.DataFrame: """ 上登债券信息网-市场数据-市场统计-市场概览-债券现券市场概览 http://bond.sse.com.cn/data/statistics/overview/bondow/ :param date: 指定日期 :type date: str :return: 债券成交概览 :rtype: pandas.DataFrame """ url = "http://query.sse.com.cn/commonExcelDd.do" headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Referer": "http://bond.sse.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36", } params = { "sqlId": "COMMON_SSEBOND_SCSJ_SCTJ_SCGL_ZQXQSCGL_CX_L", "TRADE_DATE": f"{date[:4]}-{date[4:6]}-{date[6:]}", } r = requests.get(url, params=params, headers=headers) temp_df = pd.read_excel(BytesIO(r.content), engine="xlrd") temp_df.columns = [ "债券现货", "托管只数", "托管市值", "托管面值", "数据日期", ] temp_df["托管只数"] = pd.to_numeric(temp_df["托管只数"]) temp_df["托管市值"] = pd.to_numeric(temp_df["托管市值"]) temp_df["托管面值"] = pd.to_numeric(temp_df["托管面值"]) temp_df["数据日期"] = pd.to_datetime(temp_df["数据日期"]).dt.date return temp_df def bond_deal_summary_sse(date: str = "20210104") -> pd.DataFrame: """ 上登债券信息网-市场数据-市场统计-市场概览-债券成交概览 http://bond.sse.com.cn/data/statistics/overview/turnover/ :param date: 指定日期 :type date: str :return: 债券成交概览 :rtype: pandas.DataFrame """ url = "http://query.sse.com.cn/commonExcelDd.do" headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Referer": "http://bond.sse.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36", } params = { "sqlId": "COMMON_SSEBOND_SCSJ_SCTJ_SCGL_ZQCJGL_CX_L", "TRADE_DATE": f"{date[:4]}-{date[4:6]}-{date[6:]}", } r = requests.get(url, params=params, headers=headers) temp_df = pd.read_excel(BytesIO(r.content)) temp_df.columns = [ "债券类型", "当日成交笔数", "当日成交金额", "当年成交笔数", "当年成交金额", "数据日期", ] temp_df["当日成交笔数"] = pd.to_numeric(temp_df["当日成交笔数"]) temp_df["当日成交金额"] = pd.to_numeric(temp_df["当日成交金额"]) temp_df["当年成交笔数"] = pd.to_numeric(temp_df["当年成交笔数"]) temp_df["当年成交金额"] = pd.to_numeric(temp_df["当年成交金额"]) temp_df["数据日期"] = pd.to_datetime(temp_df["数据日期"]).dt.date return temp_df if __name__ == "__main__": bond_cash_summary_sse_df = bond_cash_summary_sse(date="20210111") print(bond_cash_summary_sse_df) bond_summary_sse_df = bond_deal_summary_sse(date="20210111") print(bond_summary_sse_df) ================================================ FILE: akshare/bond/bond_zh_cov.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/7/4 15:00 Desc: 新浪财经-债券-沪深可转债-实时行情数据和历史行情数据 https://vip.stock.finance.sina.com.cn/mkt/#hskzz_z """ import datetime import re import pandas as pd import py_mini_racer import requests from akshare.bond.cons import ( zh_sina_bond_hs_cov_count_url, zh_sina_bond_hs_cov_payload, zh_sina_bond_hs_cov_url, zh_sina_bond_hs_cov_hist_url, ) from akshare.stock.cons import hk_js_decode from akshare.utils import demjson from akshare.utils.func import fetch_paginated_data from akshare.utils.tqdm import get_tqdm def _get_zh_bond_hs_cov_page_count() -> int: """ 新浪财经-行情中心-债券-沪深可转债的总页数 https://vip.stock.finance.sina.com.cn/mkt/#hskzz_z :return: 总页数 :rtype: int """ params = { "node": "hskzz_z", } r = requests.get(zh_sina_bond_hs_cov_count_url, params=params) page_count = int(re.findall(re.compile(r"\d+"), r.text)[0]) / 80 if isinstance(page_count, int): return page_count else: return int(page_count) + 1 def bond_zh_hs_cov_spot() -> pd.DataFrame: """ 新浪财经-债券-沪深可转债的实时行情数据; 大量抓取容易封IP https://vip.stock.finance.sina.com.cn/mkt/#hskzz_z :return: 所有沪深可转债在当前时刻的实时行情数据 :rtype: pandas.DataFrame """ big_df = pd.DataFrame() page_count = _get_zh_bond_hs_cov_page_count() zh_sina_bond_hs_payload_copy = zh_sina_bond_hs_cov_payload.copy() tqdm = get_tqdm() for page in tqdm(range(1, page_count + 1), leave=False): zh_sina_bond_hs_payload_copy.update({"page": page}) res = requests.get(zh_sina_bond_hs_cov_url, params=zh_sina_bond_hs_payload_copy) data_json = demjson.decode(res.text) big_df = pd.concat(objs=[big_df, pd.DataFrame(data_json)], ignore_index=True) return big_df def bond_zh_hs_cov_daily(symbol: str = "sh010107") -> pd.DataFrame: """ 新浪财经-债券-沪深可转债的历史行情数据, 大量抓取容易封 IP https://vip.stock.finance.sina.com.cn/mkt/#hskzz_z :param symbol: 沪深可转债代码; e.g., sh010107 :type symbol: str :return: 指定沪深可转债代码的日 K 线数据 :rtype: pandas.DataFrame """ r = requests.get( zh_sina_bond_hs_cov_hist_url.format( symbol, datetime.datetime.now().strftime("%Y_%m_%d") ) ) js_code = py_mini_racer.MiniRacer() js_code.eval(hk_js_decode) dict_list = js_code.call( "d", r.text.split("=")[1].split(";")[0].replace('"', "") ) # 执行js解密代码 data_df = pd.DataFrame(dict_list) data_df["date"] = pd.to_datetime(data_df["date"]).dt.date return data_df def _code_id_map() -> dict: """ 东方财富-股票和市场代码 https://quote.eastmoney.com/center/gridlist.html#hs_a_board :return: 股票和市场代码 :rtype: dict """ url = "https://80.push2.eastmoney.com/api/qt/clist/get" params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "fid": "f12", "fs": "m:1 t:2,m:1 t:23", "fields": "f3,f12", } temp_df = fetch_paginated_data(url, params) temp_df["market_id"] = 1 temp_df.rename(columns={"f12": "sh_code", "market_id": "sh_id"}, inplace=True) code_id_dict = dict(zip(temp_df["sh_code"], temp_df["sh_id"])) params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "fid": "f3", "fs": "m:0 t:6,m:0 t:80", "fields": "f3,f12", } temp_df_sz = fetch_paginated_data(url, params) temp_df_sz["sz_id"] = 0 code_id_dict.update(dict(zip(temp_df_sz["f12"], temp_df_sz["sz_id"]))) return code_id_dict def bond_zh_hs_cov_min( symbol: str = "sz128039", period: str = "15", adjust: str = "", start_date: str = "1979-09-01 09:32:00", end_date: str = "2222-01-01 09:32:00", ) -> pd.DataFrame: """ 东方财富网-可转债-分时行情 https://quote.eastmoney.com/concept/sz128039.html :param symbol: 转债代码 :type symbol: str :param period: choice of {'1', '5', '15', '30', '60'} :type period: str :param adjust: choice of {'', 'qfq', 'hfq'} :type adjust: str :param start_date: 开始日期 :type start_date: str :param end_date: 结束日期 :type end_date: str :return: 分时行情 :rtype: pandas.DataFrame """ market_type = {"sh": "1", "sz": "0"} if period == "1": url = "https://push2.eastmoney.com/api/qt/stock/trends2/get" params = { "secid": f"{market_type[symbol[:2]]}.{symbol[2:]}", "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58", "iscr": "0", "iscca": "0", "ut": "f057cbcbce2a86e2866ab8877db1d059", "ndays": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame( [item.split(",") for item in data_json["data"]["trends"]] ) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "最新价", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype( str ) # show datatime here return temp_df else: adjust_map = { "": "0", "qfq": "1", "hfq": "2", } url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "secid": f"{market_type[symbol[:2]]}.{symbol[2:]}", "klt": period, "fqt": adjust_map[adjust], "lmt": "66", "end": "20500000", "iscca": "1", "fields1": "f1,f2,f3,f4,f5", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61", "ut": "7eea3edcaed734bea9cbfc24409ed989", "forcect": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame( [item.split(",") for item in data_json["data"]["klines"]] ) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "振幅", "涨跌幅", "涨跌额", "换手率", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") 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") temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str) temp_df = temp_df[ [ "时间", "开盘", "收盘", "最高", "最低", "涨跌幅", "涨跌额", "成交量", "成交额", "振幅", "换手率", ] ] return temp_df def bond_zh_hs_cov_pre_min(symbol: str = "sh113570") -> pd.DataFrame: """ 东方财富网-可转债-分时行情-盘前 https://quote.eastmoney.com/concept/sz128039.html :param symbol: 转债代码 :type symbol: str :return: 分时行情-盘前 :rtype: pandas.DataFrame """ market_type = {"sh": "1", "sz": "0"} url = "https://push2.eastmoney.com/api/qt/stock/trends2/get" params = { "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58", "ndays": "1", "iscr": "1", "iscca": "0", "secid": f"{market_type[symbol[:2]]}.{symbol[2:]}", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["trends"]]) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "最新价", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df.reset_index(drop=True, inplace=True) 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") 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") temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str) return temp_df def bond_zh_cov() -> pd.DataFrame: """ 东方财富网-数据中心-新股数据-可转债数据 https://data.eastmoney.com/kzz/default.html :return: 可转债数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "PUBLIC_START_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_BOND_CB_LIST", "columns": "ALL", "quoteColumns": "f2~01~CONVERT_STOCK_CODE~CONVERT_STOCK_PRICE," "f235~10~SECURITY_CODE~TRANSFER_PRICE,f236~10~SECURITY_CODE~TRANSFER_VALUE," "f2~10~SECURITY_CODE~CURRENT_BOND_PRICE,f237~10~SECURITY_CODE~TRANSFER_PREMIUM_RATIO," "f239~10~SECURITY_CODE~RESALE_TRIG_PRICE,f240~10~SECURITY_CODE~REDEEM_TRIG_PRICE," "f23~01~CONVERT_STOCK_CODE~PBV_RATIO", "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [ "债券代码", "_", "_", "债券简称", "_", "上市时间", "正股代码", "_", "信用评级", "_", "_", "_", "_", "_", "_", "_", "发行规模", "申购上限", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "申购代码", "_", "申购日期", "_", "_", "中签号发布日", "原股东配售-股权登记日", "正股简称", "原股东配售-每股配售额", "_", "中签率", "-", "_", "_", "_", "_", "_", "正股价", "转股价", "转股价值", "债现价", "转股溢价率", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", "_", ] big_df = big_df[ [ "债券代码", "债券简称", "申购日期", "申购代码", "申购上限", "正股代码", "正股简称", "正股价", "转股价", "转股价值", "债现价", "转股溢价率", "原股东配售-股权登记日", "原股东配售-每股配售额", "发行规模", "中签号发布日", "中签率", "上市时间", "信用评级", ] ] big_df["申购上限"] = pd.to_numeric(big_df["申购上限"], errors="coerce") big_df["正股价"] = pd.to_numeric(big_df["正股价"], errors="coerce") big_df["转股价"] = pd.to_numeric(big_df["转股价"], errors="coerce") big_df["转股价值"] = pd.to_numeric(big_df["转股价值"], errors="coerce") big_df["债现价"] = pd.to_numeric(big_df["债现价"], errors="coerce") big_df["转股溢价率"] = pd.to_numeric(big_df["转股溢价率"], errors="coerce") big_df["原股东配售-每股配售额"] = pd.to_numeric( big_df["原股东配售-每股配售额"], errors="coerce" ) big_df["发行规模"] = pd.to_numeric(big_df["发行规模"], errors="coerce") big_df["中签率"] = pd.to_numeric(big_df["中签率"], errors="coerce") big_df["中签号发布日"] = pd.to_datetime( big_df["中签号发布日"], errors="coerce" ).dt.date big_df["上市时间"] = pd.to_datetime(big_df["上市时间"], errors="coerce").dt.date big_df["申购日期"] = pd.to_datetime(big_df["申购日期"], errors="coerce").dt.date big_df["原股东配售-股权登记日"] = pd.to_datetime( big_df["原股东配售-股权登记日"], errors="coerce" ).dt.date big_df["债现价"] = big_df["债现价"].fillna(100) return big_df def bond_cov_comparison() -> pd.DataFrame: """ 东方财富网-行情中心-债券市场-可转债比价表 https://quote.eastmoney.com/center/fullscreenlist.html#convertible_comparison :return: 可转债比价表数据 :rtype: pandas.DataFrame """ url = "https://16.push2.eastmoney.com/api/qt/clist/get" params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "fid": "f243", "fs": "b:MK0354", "fields": "f1,f152,f2,f3,f12,f13,f14,f227,f228,f229,f230,f231,f232,f233,f234," "f235,f236,f237,f238,f239,f240,f241,f242,f26,f243", } temp_df = fetch_paginated_data(url, params) temp_df.columns = [ "序号", "_", "转债最新价", "转债涨跌幅", "转债代码", "_", "转债名称", "上市日期", "_", "纯债价值", "_", "正股最新价", "正股涨跌幅", "_", "正股代码", "_", "正股名称", "转股价", "转股价值", "转股溢价率", "纯债溢价率", "回售触发价", "强赎触发价", "到期赎回价", "开始转股日", "申购日期", ] temp_df = temp_df[ [ "序号", "转债代码", "转债名称", "转债最新价", "转债涨跌幅", "正股代码", "正股名称", "正股最新价", "正股涨跌幅", "转股价", "转股价值", "转股溢价率", "纯债溢价率", "回售触发价", "强赎触发价", "到期赎回价", "纯债价值", "开始转股日", "上市日期", "申购日期", ] ] return temp_df def bond_zh_cov_info( symbol: str = "123121", indicator: str = "基本信息" ) -> pd.DataFrame: """ https://data.eastmoney.com/kzz/detail/123121.html 东方财富网-数据中心-新股数据-可转债详情 :param symbol: 可转债代码 :type symbol: str :param indicator: choice of {"基本信息", "中签号", "筹资用途", "重要日期"} :type indicator: str :return: 可转债详情 :rtype: pandas.DataFrame """ indicator_map = { "基本信息": "RPT_BOND_CB_LIST", "中签号": "RPT_CB_BALLOTNUM", "筹资用途": "RPT_BOND_BS_OPRFINVESTITEM", "重要日期": "RPT_CB_IMPORTANTDATE", } url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_BOND_CB_LIST", "columns": "ALL", "quoteColumns": "f2~01~CONVERT_STOCK_CODE~CONVERT_STOCK_PRICE,f235~10~SECURITY_CODE~TRANSFER_PRICE," "f236~10~SECURITY_CODE~TRANSFER_VALUE,f2~10~SECURITY_CODE~CURRENT_BOND_PRICE," "f237~10~SECURITY_CODE~TRANSFER_PREMIUM_RATIO,f239~10~SECURITY_CODE~RESALE_TRIG_PRICE," "f240~10~SECURITY_CODE~REDEEM_TRIG_PRICE,f23~01~CONVERT_STOCK_CODE~PBV_RATIO", "quoteType": "0", "source": "WEB", "client": "WEB", "filter": f'(SECURITY_CODE="{symbol}")', } if indicator == "基本信息": params.update( { "reportName": indicator_map[indicator], "quoteColumns": "f2~01~CONVERT_STOCK_CODE~CONVERT_STOCK_PRICE,f235~10~SECURITY_CODE~TRANSFER_PRICE," "f236~10~SECURITY_CODE~TRANSFER_VALUE,f2~10~SECURITY_CODE~CURRENT_BOND_PRICE," "f237~10~SECURITY_CODE~TRANSFER_PREMIUM_RATIO,f239~10~SECURITY_CODE~RESALE_TRIG_PRICE," "f240~10~SECURITY_CODE~REDEEM_TRIG_PRICE,f23~01~CONVERT_STOCK_CODE~PBV_RATIO", } ) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame.from_dict(data_json["result"]["data"]) return temp_df elif indicator == "中签号": params.update( { "reportName": indicator_map[indicator], "quoteColumns": "", } ) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame.from_dict(data_json["result"]["data"]) return temp_df elif indicator == "筹资用途": params.update( { "reportName": indicator_map[indicator], "quoteColumns": "", "sortColumns": "SORT", "sortTypes": "1", } ) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame.from_dict(data_json["result"]["data"]) return temp_df elif indicator == "重要日期": params.update( { "reportName": indicator_map[indicator], "quoteColumns": "", } ) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame.from_dict(data_json["result"]["data"]) return temp_df else: return pd.DataFrame() def bond_zh_cov_value_analysis(symbol: str = "113527") -> pd.DataFrame: """ https://data.eastmoney.com/kzz/detail/113527.html 东方财富网-数据中心-新股数据-可转债数据-价值分析-溢价率分析 :param symbol: 可转债代码 :type symbol: str :return: 可转债价值分析 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/get" params = { "sty": "ALL", "token": "894050c76af8597a853f5b408b759f5d", "st": "date", "sr": "1", "source": "WEB", "type": "RPTA_WEB_KZZ_LS", "filter": f'(zcode="{symbol}")', "p": "1", "ps": "8000", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "日期", "-", "-", "转股价值", "纯债价值", "纯债溢价率", "转股溢价率", "收盘价", "-", "-", "-", "-", "-", ] temp_df = temp_df[ [ "日期", "收盘价", "纯债价值", "转股价值", "纯债溢价率", "转股溢价率", ] ] 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") temp_df["纯债溢价率"] = pd.to_numeric(temp_df["纯债溢价率"], errors="coerce") temp_df["转股溢价率"] = pd.to_numeric(temp_df["转股溢价率"], errors="coerce") temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date return temp_df if __name__ == "__main__": bond_zh_hs_cov_min_df = bond_zh_hs_cov_min( symbol="sz128039", period="1", adjust="hfq", start_date="1979-09-01 09:32:00", end_date="2222-01-01 09:32:00", ) print(bond_zh_hs_cov_min_df) bond_zh_hs_cov_pre_min_df = bond_zh_hs_cov_pre_min(symbol="sz128039") print(bond_zh_hs_cov_pre_min_df) bond_zh_hs_cov_daily_df = bond_zh_hs_cov_daily(symbol="sz128039") print(bond_zh_hs_cov_daily_df) bond_zh_hs_cov_spot_df = bond_zh_hs_cov_spot() print(bond_zh_hs_cov_spot_df) bond_zh_cov_df = bond_zh_cov() print(bond_zh_cov_df) bond_cov_comparison_df = bond_cov_comparison() print(bond_cov_comparison_df) bond_zh_cov_info_df = bond_zh_cov_info(symbol="123121", indicator="基本信息") print(bond_zh_cov_info_df) bond_zh_cov_value_analysis_df = bond_zh_cov_value_analysis(symbol="113527") print(bond_zh_cov_value_analysis_df) ================================================ FILE: akshare/bond/bond_zh_sina.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/6/18 18:30 Desc: 新浪财经-债券-沪深债券-实时行情数据和历史行情数据 https://vip.stock.finance.sina.com.cn/mkt/#hs_z """ import datetime import re import pandas as pd import requests import py_mini_racer from akshare.bond.cons import ( zh_sina_bond_hs_count_url, zh_sina_bond_hs_payload, zh_sina_bond_hs_url, zh_sina_bond_hs_hist_url, ) from akshare.stock.cons import hk_js_decode from akshare.utils import demjson from akshare.utils.tqdm import get_tqdm def get_zh_bond_hs_page_count() -> int: """ 行情中心首页-债券-沪深债券的总页数 https://vip.stock.finance.sina.com.cn/mkt/#hs_z :return: 总页数 :rtype: int """ params = { "node": "hs_z", } res = requests.get(zh_sina_bond_hs_count_url, params=params) page_count = int(re.findall(re.compile(r"\d+"), res.text)[0]) / 80 if isinstance(page_count, int): return page_count else: return int(page_count) + 1 def bond_zh_hs_spot(start_page: str = "1", end_page: str = "10") -> pd.DataFrame: """ 新浪财经-债券-沪深债券-实时行情数据, 大量抓取容易封IP https://vip.stock.finance.sina.com.cn/mkt/#hs_z :param start_page: 分页起始页 :type start_page: str :param end_page: 分页结束页 :type end_page: str :return: 所有沪深债券在当前时刻的实时行情数据 :rtype: pandas.DataFrame """ page_count = get_zh_bond_hs_page_count() page_count = int(page_count) zh_sina_bond_hs_payload_copy = zh_sina_bond_hs_payload.copy() tqdm = get_tqdm() big_df = pd.DataFrame() start_page = int(start_page) end_page = int(end_page) + 1 if int(end_page) + 1 <= page_count else page_count for page in tqdm(range(start_page, end_page), leave=False): zh_sina_bond_hs_payload_copy.update({"page": page}) r = requests.get(zh_sina_bond_hs_url, params=zh_sina_bond_hs_payload_copy) data_json = demjson.decode(r.text) temp_df = pd.DataFrame(data_json) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [ "代码", "-", "名称", "最新价", "涨跌额", "涨跌幅", "买入", "卖出", "昨收", "今开", "最高", "最低", "成交量", "成交额", "-", "-", "-", "-", "-", "-", ] big_df = big_df[ [ "代码", "名称", "最新价", "涨跌额", "涨跌幅", "买入", "卖出", "昨收", "今开", "最高", "最低", "成交量", "成交额", ] ] big_df["买入"] = pd.to_numeric(big_df["买入"], errors="coerce") big_df["卖出"] = pd.to_numeric(big_df["卖出"], errors="coerce") big_df["昨收"] = pd.to_numeric(big_df["昨收"], errors="coerce") big_df["今开"] = pd.to_numeric(big_df["今开"], errors="coerce") big_df["最高"] = pd.to_numeric(big_df["最高"], errors="coerce") big_df["最低"] = pd.to_numeric(big_df["最低"], errors="coerce") big_df["最新价"] = pd.to_numeric(big_df["最新价"], errors="coerce") return big_df def bond_zh_hs_daily(symbol: str = "sh010107") -> pd.DataFrame: """ 新浪财经-债券-沪深债券-历史行情数据, 大量抓取容易封 IP https://vip.stock.finance.sina.com.cn/mkt/#hs_z :param symbol: 沪深债券代码; e.g., sh010107 :type symbol: str :return: 指定沪深债券代码的日 K 线数据 :rtype: pandas.DataFrame """ r = requests.get( zh_sina_bond_hs_hist_url.format( symbol, datetime.datetime.now().strftime("%Y_%m_%d") ) ) js_code = py_mini_racer.MiniRacer() js_code.eval(hk_js_decode) dict_list = js_code.call( "d", r.text.split("=")[1].split(";")[0].replace('"', "") ) # 执行 js 解密代码 data_df = pd.DataFrame(dict_list) data_df["date"] = pd.to_datetime(data_df["date"], errors="coerce").dt.date data_df["open"] = pd.to_numeric(data_df["open"], errors="coerce") data_df["high"] = pd.to_numeric(data_df["high"], errors="coerce") data_df["low"] = pd.to_numeric(data_df["low"], errors="coerce") data_df["close"] = pd.to_numeric(data_df["close"], errors="coerce") return data_df if __name__ == "__main__": bond_zh_hs_spot_df = bond_zh_hs_spot(start_page="1", end_page="5") print(bond_zh_hs_spot_df) bond_zh_hs_daily_df = bond_zh_hs_daily(symbol="sh010107") print(bond_zh_hs_daily_df) ================================================ FILE: akshare/bond/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/10/20 10:21 Desc: 债券配置文件 """ # bond-cov-sina zh_sina_bond_hs_cov_url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeDataSimple" zh_sina_bond_hs_cov_count_url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeStockCountSimple" zh_sina_bond_hs_cov_hist_url = ( "https://finance.sina.com.cn/realstock/company/{}/hisdata/klc_kl.js?d={}" ) zh_sina_bond_hs_cov_payload = { "page": "1", "num": "80", "sort": "symbol", "asc": "1", "node": "hskzz_z", "_s_r_a": "page", } # bond-sina zh_sina_bond_hs_url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData" zh_sina_bond_hs_count_url = "http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeStockCountSimple" zh_sina_bond_hs_hist_url = ( "https://finance.sina.com.cn/realstock/company/{}/hisdata/klc_kl.js?d={}" ) zh_sina_bond_hs_payload = { "page": "1", "num": "80", "sort": "symbol", "asc": "1", "node": "hs_z", "_s_r_a": "page", } # headers SHORT_HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36" } # quote MARKET_QUOTE_URL = "http://www.chinamoney.com.cn/ags/ms/cm-u-md-bond/CbMktMakQuot?flag=1&lang=cn&abdAssetEncdShrtDesc=&emaEntyEncdShrtDesc=" MARKET_QUOTE_PAYLOAD = { "flag": "1", "lang": "cn", "abdAssetEncdShrtDesc": "", "emaEntyEncdShrtDesc": "", } # trade MARKET_TRADE_URL = ( "http://www.chinamoney.com.cn/ags/ms/cm-u-md-bond/CbtPri?lang=cn&flag=1&bondName=" ) MARKET_TRADE_PAYLOAD = {"lang": "cn", "flag": "1", "bondName": ""} ================================================ FILE: akshare/cal/__init__.py ================================================ ================================================ FILE: akshare/cal/rv.py ================================================ """ Yang-Zhang-s-Realized-Volatility-Automated-Estimation-in-Python https://github.com/hugogobato/Yang-Zhang-s-Realized-Volatility-Automated-Estimation-in-Python 论文地址:https://www.jstor.org/stable/10.1086/209650 """ import warnings import numpy as np import pandas as pd def rv_from_stock_zh_a_hist_min_em( symbol="000001", start_date="2021-10-20 09:30:00", end_date="2024-11-01 15:00:00", period="1", adjust="hfq", ) -> pd.DataFrame: """ 从东方财富网获取股票的分钟级历史行情数据,并进行数据清洗和格式化为计算 yz 已实现波动率所需的数据格式 https://quote.eastmoney.com/concept/sh603777.html?from=classic :param symbol: 股票代码,如"000001" :type symbol: str :param start_date: 开始日期时间,格式"YYYY-MM-DD HH:MM:SS" :type start_date: str :param end_date: 结束日期时间,格式"YYYY-MM-DD HH:MM:SS" :type end_date: str :param period: 时间周期,可选{'1','5','15','30','60'}分钟 :type period: str :param adjust: 复权方式,可选{'','qfq'(前复权),'hfq'(后复权)} :type adjust: str :return: 整理后的分钟行情数据,包含Date(索引),Open,High,Low,Close列 :rtype: pandas.DataFrame """ from akshare.stock_feature.stock_hist_em import stock_zh_a_hist_min_em temp_df = stock_zh_a_hist_min_em( symbol=symbol, start_date=start_date, end_date=end_date, period=period, adjust=adjust, ) temp_df.rename( columns={ "时间": "Date", "开盘": "Open", "最高": "High", "最低": "Low", "收盘": "Close", }, inplace=True, ) temp_df = temp_df[temp_df["Open"] != 0] temp_df["Date"] = pd.to_datetime(temp_df["Date"]) temp_df.set_index(keys="Date", inplace=True) return temp_df def rv_from_futures_zh_minute_sina( symbol: str = "IF2008", period: str = "5" ) -> pd.DataFrame: """ 从新浪财经获取期货的分钟级历史行情数据,并进行数据清洗和格式化 https://vip.stock.finance.sina.com.cn/quotes_service/view/qihuohangqing.html#titlePos_3 :param symbol: 期货合约代码,如"IF2008"代表沪深300期货2020年8月合约 :type symbol: str :param period: 时间周期,可选{'1','5','15','30','60'}分钟 :type period: str :return: 整理后的分钟行情数据,包含Date(索引),Open,High,Low,Close列 :rtype: pandas.DataFrame """ from akshare.futures.futures_zh_sina import futures_zh_minute_sina temp_df = futures_zh_minute_sina(symbol=symbol, period=period) temp_df.rename( columns={ "datetime": "Date", "open": "Open", "high": "High", "low": "Low", "close": "Close", }, inplace=True, ) temp_df["Date"] = pd.to_datetime(temp_df["Date"]) temp_df.set_index(keys="Date", inplace=True) return temp_df def volatility_yz_rv(data: pd.DataFrame) -> pd.DataFrame: ( """ 波动率-已实现波动率-Yang-Zhang 已实现波动率(Yang-Zhang Realized Volatility) https://github.com/hugogobato/Yang-Zhang-s-Realized-Volatility-Automated-Estimation-in-Python 论文地址:https://www.jstor.org/stable/10.1086/209650 基于以下公式计算: RV^2 = Vo + k*Vc + (1-k)*Vrs 其中: - Vo: 隔夜波动率, Vo = 1/(n-1)*sum(Oi-Obar)^2 Oi为标准化开盘价, Obar为标准化开盘价均值 - Vc: 收盘波动率, Vc = 1/(n-1)*sum(ci-Cbar)^2 ci为标准化收盘价, Cbar为标准化收盘价均值 - k: 权重系数, k = 0.34/(1.34+(n+1)/(n-1)) n为样本数量 - Vrs: Rogers-Satchell波动率代理, Vrs = ui(ui-ci)+di(di-ci) ui = ln(Hi/Oi), ci = ln(Ci/Oi), di = ln(Li/Oi), oi = ln(Oi/Ci-1) Hi/Li/Ci/Oi分别为最高价/最低价/收盘价/开盘价 :param data: 包含 OHLC(开高低收) 价格的 pandas.DataFrame :type data: pandas.DataFrame :return: 包含 Yang-Zhang 实现波动率的 pandas.DataFrame :rtype: pandas.DataFrame 要求输入数据包含以下列: - Open: 开盘价 - High: 最高价 - Low: 最低价 - Close: 收盘价 # yang_zhang_rv formula is give as: # RV^2 = Vo + k*Vc + (1-k)*Vrs # where Vo = 1/(n-1)*sum(Oi-Obar)^2 # with oi = normalized opening price at time t and Obar = mean of normalized opening prices # Vc = = 1/(n-1)*sum(ci-Cbar)^2 # with ci = normalized close price at time t and Cbar = mean of normalized close prices # k = 0.34/(1.34+(n+1)/(n-1)) # with n = total number of days or time periods considered # Vrs (Rogers & Satchell RV proxy) = ui(ui-ci)+di(di-ci) # with ui = ln(Hi/Oi), ci = ln(Ci/Oi), di=(Li/Oi), oi = ln(Oi/Ci-1) # where Hi = high price at time t and Li = low price at time t """ "" ) warnings.filterwarnings("ignore") data["ui"] = np.log(np.divide(data["High"][1:], data["Open"][1:])) data["ci"] = np.log(np.divide(data["Close"][1:], data["Open"][1:])) data["di"] = np.log(np.divide(data["Low"][1:], data["Open"][1:])) data["oi"] = np.log(np.divide(data["Open"][1:], data["Close"][: len(data) - 1])) data = data[1:] data["RS"] = data["ui"] * (data["ui"] - data["ci"]) + data["di"] * ( data["di"] - data["ci"] ) rs_var = data["RS"].groupby(pd.Grouper(freq="1D")).mean().dropna() vc_and_vo = data[["oi", "ci"]].groupby(pd.Grouper(freq="1D")).var().dropna() n = int(len(data) / len(rs_var)) k = 0.34 / (1.34 + (n + 1) / (n - 1)) yang_zhang_rv = np.sqrt((1 - k) * rs_var + vc_and_vo["oi"] + vc_and_vo["ci"] * k) yang_zhang_rv_df = pd.DataFrame(yang_zhang_rv) yang_zhang_rv_df.rename(columns={0: "yz_rv"}, inplace=True) yang_zhang_rv_df.reset_index(inplace=True) yang_zhang_rv_df.columns = ["date", "rv"] yang_zhang_rv_df["date"] = pd.to_datetime( yang_zhang_rv_df["date"], errors="coerce" ).dt.date return yang_zhang_rv_df if __name__ == "__main__": futures_df = rv_from_futures_zh_minute_sina(symbol="IF2008", period="1") volatility_yz_rv_df = volatility_yz_rv(data=futures_df) print(volatility_yz_rv_df) stock_df = rv_from_stock_zh_a_hist_min_em( symbol="000001", start_date="2021-10-20 09:30:00", end_date="2024-11-01 15:00:00", period="5", adjust="", ) volatility_yz_rv_df = volatility_yz_rv(data=stock_df) print(volatility_yz_rv_df) ================================================ FILE: akshare/crypto/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2020/10/23 13:51 Desc: """ ================================================ FILE: akshare/crypto/crypto_bitcoin_cme.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/9/5 15:41 Desc: 芝加哥商业交易所-比特币成交量报告 https://datacenter.jin10.com/reportType/dc_cme_btc_report """ import pandas as pd import requests def crypto_bitcoin_cme(date: str = "20230830") -> pd.DataFrame: """ 芝加哥商业交易所-比特币成交量报告 https://datacenter.jin10.com/reportType/dc_cme_btc_report :param date: Specific date, e.g., "20230830" :type date: str :return: 比特币成交量报告 :rtype: pandas.DataFrame """ url = "https://datacenter-api.jin10.com/reports/list" params = { "category": "cme", "date": "-".join([date[:4], date[4:6], date[6:]]), "attr_id": "4", } headers = { "accept": "*/*", "accept-encoding": "gzip, deflate, br", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", "cache-control": "no-cache", "origin": "https://datacenter.jin10.com", "pragma": "no-cache", "referer": "https://datacenter.jin10.com/", "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"', "sec-ch-ua-mobile": "?0", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-site", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "", "x-version": "1.0.0", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame( [item for item in data_json["data"]["values"]], columns=[item["name"] for item in data_json["data"]["keys"]], ) 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") 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") return temp_df if __name__ == "__main__": crypto_bitcoin_cme_df = crypto_bitcoin_cme(date="20230830") print(crypto_bitcoin_cme_df) ================================================ FILE: akshare/crypto/crypto_hold.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/8/31 23:00 Desc: 金十数据-比特币持仓报告 https://datacenter.jin10.com/dc_report?name=bitcoint """ import pandas as pd import requests def crypto_bitcoin_hold_report(): """ 金十数据-比特币持仓报告 https://datacenter.jin10.com/dc_report?name=bitcoint :return: 比特币持仓报告 :rtype: pandas.DataFrame """ url = "https://datacenter-api.jin10.com/bitcoin_treasuries/list" headers = { "X-App-Id": "lnFP5lxse24wPgtY", "X-Version": "1.0.0", } r = requests.get(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["values"]) temp_df.columns = [ "代码", "公司名称-英文", "国家/地区", "市值", "比特币占市值比重", "持仓成本", "持仓占比", "持仓量", "当日持仓市值", "查询日期", "公告链接", "_", "分类", "倍数", "_", "公司名称-中文", ] temp_df = temp_df[ [ "代码", "公司名称-英文", "公司名称-中文", "国家/地区", "市值", "比特币占市值比重", "持仓成本", "持仓占比", "持仓量", "当日持仓市值", "查询日期", "公告链接", "分类", "倍数", ] ] 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") 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") temp_df["倍数"] = pd.to_numeric(temp_df["倍数"], errors="coerce") temp_df["查询日期"] = pd.to_datetime(temp_df["查询日期"], errors="coerce").dt.date return temp_df if __name__ == "__main__": crypto_bitcoin_hold_report_df = crypto_bitcoin_hold_report() print(crypto_bitcoin_hold_report_df) ================================================ FILE: akshare/currency/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2020/3/6 16:40 Desc: """ ================================================ FILE: akshare/currency/currency.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/7/24 18:30 Desc: currencybeacon 提供的外汇数据 该网站需要先注册后获取 API 使用 https://currencyscoop.com/ """ import pandas as pd import requests def currency_latest( base: str = "USD", symbols: str = "", api_key: str = "" ) -> pd.DataFrame: """ Latest data from currencyscoop.com https://currencyscoop.com/api-documentation :param base: The base currency you would like to use for your rates :type base: str :param symbols: A list of currencies you will like to see the rates for. You can refer to a list all supported currencies here :type symbols: str :param api_key: Account -> Account Details -> API KEY (use as password in external tools) :type api_key: str :return: Latest data of base currency :rtype: pandas.DataFrame """ params = {"base": base, "symbols": symbols, "api_key": api_key} url = "https://api.currencyscoop.com/v1/latest" r = requests.get(url, params=params) temp_df = pd.DataFrame.from_dict(r.json()["response"]) temp_df["date"] = pd.to_datetime(temp_df["date"]) temp_df.reset_index(inplace=True) temp_df.rename(columns={"index": "currency"}, inplace=True) return temp_df def currency_history( base: str = "USD", date: str = "2023-02-03", symbols: str = "", api_key: str = "" ) -> pd.DataFrame: """ Latest data from currencyscoop.com https://currencyscoop.com/api-documentation :param base: The base currency you would like to use for your rates :type base: str :param date: Specific date, e.g., "2020-02-03" :type date: str :param symbols: A list of currencies you will like to see the rates for. You can refer to a list all supported currencies here :type symbols: str :param api_key: Account -> Account Details -> API KEY (use as password in external tools) :type api_key: str :return: Latest data of base currency :rtype: pandas.DataFrame """ params = {"base": base, "date": date, "symbols": symbols, "api_key": api_key} url = "https://api.currencyscoop.com/v1/historical" r = requests.get(url, params=params) temp_df = pd.DataFrame.from_dict(r.json()["response"]) temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df.reset_index(inplace=True) temp_df.rename(columns={"index": "currency"}, inplace=True) return temp_df def currency_time_series( base: str = "USD", start_date: str = "2023-02-03", end_date: str = "2023-03-04", symbols: str = "", api_key: str = "", ) -> pd.DataFrame: """ Time-series data from currencyscoop.com P.S. need special authority https://currencyscoop.com/api-documentation :param base: The base currency you would like to use for your rates :type base: str :param start_date: Specific date, e.g., "2020-02-03" :type start_date: str :param end_date: Specific date, e.g., "2020-02-03" :type end_date: str :param symbols: A list of currencies you will like to see the rates for. You can refer to a list all supported currencies here :type symbols: str :param api_key: Account -> Account Details -> API KEY (use as password in external tools) :type api_key: str :return: Latest data of base currency :rtype: pandas.DataFrame """ params = { "base": base, "api_key": api_key, "start_date": start_date, "end_date": end_date, "symbols": symbols, } url = "https://api.currencyscoop.com/v1/timeseries" r = requests.get(url, params=params) temp_df = pd.DataFrame.from_dict(r.json()["response"]) temp_df = temp_df.T temp_df.reset_index(inplace=True) temp_df.rename(columns={"index": "date"}, inplace=True) temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date return temp_df def currency_currencies(c_type: str = "fiat", api_key: str = "") -> pd.DataFrame: """ currencies data from currencyscoop.com https://currencyscoop.com/api-documentation :param c_type: now only "fiat" can return data :type c_type: str :param api_key: Account -> Account Details -> API KEY (use as password in external tools) :type api_key: str :return: Latest data of base currency :rtype: pandas.DataFrame """ params = {"type": c_type, "api_key": api_key} url = "https://api.currencyscoop.com/v1/currencies" r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["response"]) return temp_df def currency_convert( base: str = "USD", to: str = "CNY", amount: str = "10000", api_key: str = "", ) -> pd.DataFrame: """ currencies data from currencyscoop.com https://currencyscoop.com/api-documentation :param base: The base currency you would like to use for your rates :type base: str :param to: The currency you would like to use for your rates :type to: str :param amount: The amount of base currency :type amount: str :param api_key: Account -> Account Details -> API KEY (use as password in external tools) :type api_key: str :return: Latest data of base currency :rtype: pandas.Series """ params = { "from": base, "to": to, "amount": amount, "api_key": api_key, } url = "https://api.currencyscoop.com/v1/convert" r = requests.get(url, params=params) temp_se = pd.Series(r.json()["response"]) temp_se["timestamp"] = pd.to_datetime(temp_se["timestamp"], unit="s") temp_df = temp_se.to_frame() temp_df.reset_index(inplace=True) temp_df.columns = ["item", "value"] return temp_df if __name__ == "__main__": currency_latest_df = currency_latest(base="USD", api_key="") print(currency_latest_df) currency_history_df = currency_history(base="USD", date="2023-02-03", api_key="") print(currency_history_df) currency_time_series_df = currency_time_series( base="USD", start_date="2023-02-03", end_date="2023-03-04", symbols="", api_key="", ) print(currency_time_series_df) currency_currencies_df = currency_currencies(c_type="fiat", api_key="") print(currency_currencies_df) currency_convert_se = currency_convert( base="USD", to="CNY", amount="10000", api_key="" ) print(currency_convert_se) ================================================ FILE: akshare/currency/currency_china_bank_sina.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/12/8 17:20 Desc: 新浪财经-中行人民币牌价历史数据查询 https://biz.finance.sina.com.cn/forex/forex.php?startdate=2012-01-01&enddate=2021-06-14&money_code=EUR&type=0 """ from functools import lru_cache from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup from tqdm import tqdm @lru_cache() def _currency_boc_sina_map( start_date: str = "20210614", end_date: str = "20230810" ) -> dict: """ 外汇 symbol 和代码映射 https://biz.finance.sina.com.cn/forex/forex.php?startdate=2012-01-01&enddate=2021-06-14&money_code=EUR&type=0 :param start_date: 开始交易日 :type start_date: str :param end_date: 结束交易日 :type end_date: str :return: 外汇 symbol 和代码映射 :rtype: dict """ url = "http://biz.finance.sina.com.cn/forex/forex.php" params = { "startdate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "enddate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), "money_code": "EUR", "type": "0", } r = requests.get(url, params=params) r.encoding = "gbk" soup = BeautifulSoup(r.text, "lxml") data_dict = dict( zip( [ item.text for item in soup.find(attrs={"id": "money_code"}).find_all("option") ], [ item["value"] for item in soup.find(attrs={"id": "money_code"}).find_all("option") ], ) ) return data_dict def currency_boc_sina( symbol: str = "美元", start_date: str = "20230304", end_date: str = "20231110" ) -> pd.DataFrame: """ 新浪财经-中行人民币牌价历史数据查询 https://biz.finance.sina.com.cn/forex/forex.php?startdate=2012-01-01&enddate=2021-06-14&money_code=EUR&type=0 :param symbol: choice of {'美元', '英镑', '欧元', '澳门元', '泰国铢', '菲律宾比索', '港币', '瑞士法郎', '新加坡元', '瑞典克朗', '丹麦克朗', '挪威克朗', '日元', '加拿大元', '澳大利亚元', '新西兰元', '韩国元'} :type symbol: str :param start_date: 开始交易日 :type start_date: str :param end_date: 结束交易日 :type end_date: str :return: 中行人民币牌价历史数据查询 :rtype: pandas.DataFrame """ data_dict = _currency_boc_sina_map(start_date=start_date, end_date=end_date) url = "http://biz.finance.sina.com.cn/forex/forex.php" params = { "money_code": data_dict[symbol], "type": "0", "startdate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "enddate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), "page": "1", "call_type": "ajax", } r = requests.get(url, params=params) soup = BeautifulSoup(r.text, features="lxml") soup.find(attrs={"id": "money_code"}) page_element_list = soup.find_all("a", attrs={"class": "page"}) page_num = int(page_element_list[-2].text) if len(page_element_list) != 0 else 1 big_df = pd.DataFrame() for page in tqdm(range(1, page_num + 1), leave=False): params.update({"page": page}) r = requests.get(url, params=params) temp_df = pd.read_html(StringIO(r.text), header=0)[0] big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [ "日期", "中行汇买价", "中行钞买价", "中行钞卖价/汇卖价", "央行中间价", "中行折算价", ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["中行汇买价"] = pd.to_numeric(big_df["中行汇买价"], errors="coerce") big_df["中行钞买价"] = pd.to_numeric(big_df["中行钞买价"], errors="coerce") big_df["中行钞卖价/汇卖价"] = pd.to_numeric( big_df["中行钞卖价/汇卖价"], errors="coerce" ) big_df["央行中间价"] = pd.to_numeric(big_df["央行中间价"], errors="coerce") big_df["中行折算价"] = pd.to_numeric(big_df["中行折算价"], errors="coerce") big_df.sort_values(by=["日期"], inplace=True, ignore_index=True) return big_df if __name__ == "__main__": currency_boc_sina_df = currency_boc_sina( symbol="美元", start_date="20230304", end_date="20231110" ) print(currency_boc_sina_df) ================================================ FILE: akshare/currency/currency_safe.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/4/29 17:00 Desc: 人民币汇率中间价 https://www.safe.gov.cn/safe/rmbhlzjj/index.html """ import re from datetime import datetime from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup def currency_boc_safe() -> pd.DataFrame: """ 人民币汇率中间价 https://www.safe.gov.cn/safe/rmbhlzjj/index.html :return: 人民币汇率中间价 :rtype: pandas.DataFrame """ url = "https://www.safe.gov.cn/safe/2020/1218/17833.html" r = requests.get(url) r.encoding = "utf8" soup = BeautifulSoup(r.text, features="lxml") content = soup.find(name="a", string=re.compile("人民币汇率"))["href"] url = f"https://www.safe.gov.cn{content}" temp_df = pd.read_excel(url) temp_df.sort_values(by=["日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) start_date = ( (pd.Timestamp(temp_df["日期"].tolist()[-1]) + pd.Timedelta(days=1)) .isoformat() .split("T")[0] ) end_date = datetime.now().isoformat().split("T")[0] url = "https://www.safe.gov.cn/AppStructured/hlw/RMBQuery.do" payload = { "startDate": start_date, "endDate": end_date, "queryYN": "true", } r = requests.post(url, data=payload) current_temp_df = pd.read_html(StringIO(r.text))[-1] current_temp_df.sort_values(by=["日期"], inplace=True) current_temp_df.reset_index(inplace=True, drop=True) big_df = pd.concat(objs=[temp_df, current_temp_df], ignore_index=True) column_name_list = big_df.columns[1:] for item in column_name_list: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date return big_df if __name__ == "__main__": currency_boc_safe_df = currency_boc_safe() print(currency_boc_safe_df) ================================================ FILE: akshare/data/__init__.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2022/5/9 18:08 Desc: """ ================================================ FILE: akshare/data/cninfo.js ================================================ localStorage = null; ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(); } else if (typeof define === "function" && define.amd) { // AMD define([], factory); } else { // Global (browser) root.CryptoJS = factory(); } }(this, function () { /** * CryptoJS core components. */ var CryptoJS = CryptoJS || (function (Math, undefined) { /* * Local polyfil of Object.create */ var create = Object.create || (function () { function F() { }; return function (obj) { var subtype; F.prototype = obj; subtype = new F(); F.prototype = null; return subtype; }; }()) /** * CryptoJS namespace. */ var C = {}; /** * Library namespace. */ var C_lib = C.lib = {}; /** * Base object for prototypal inheritance. */ var Base = C_lib.Base = (function () { return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function (overrides) { // Spawn var subtype = create(this); // Augment if (overrides) { subtype.mixIn(overrides); } // Create default initializer if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { subtype.init = function () { subtype.$super.init.apply(this, arguments); }; } // Initializer's prototype is the subtype object subtype.init.prototype = subtype; // Reference supertype subtype.$super = this; return subtype; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function () { var instance = this.extend(); instance.init.apply(instance, arguments); return instance; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function () { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function (properties) { for (var propertyName in properties) { if (properties.hasOwnProperty(propertyName)) { this[propertyName] = properties[propertyName]; } } // IE won't copy toString using the loop above if (properties.hasOwnProperty('toString')) { this.toString = properties.toString; } }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function () { return this.init.prototype.extend(this); } }; }()); /** * An array of 32-bit words. * * @property {Array} words The array of 32-bit words. * @property {number} sigBytes The number of significant bytes in this word array. */ var WordArray = C_lib.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function (words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 4; } }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function (encoder) { return (encoder || Hex).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function (wordArray) { // Shortcuts var thisWords = this.words; var thatWords = wordArray.words; var thisSigBytes = this.sigBytes; var thatSigBytes = wordArray.sigBytes; // Clamp excess bits this.clamp(); // Concat if (thisSigBytes % 4) { // Copy one byte at a time for (var i = 0; i < thatSigBytes; i++) { var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); } } else { // Copy one word at a time for (var i = 0; i < thatSigBytes; i += 4) { thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; } } this.sigBytes += thatSigBytes; // Chainable return this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function () { // Shortcuts var words = this.words; var sigBytes = this.sigBytes; // Clamp words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); words.length = Math.ceil(sigBytes / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function () { var clone = Base.clone.call(this); clone.words = this.words.slice(0); return clone; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function (nBytes) { var words = []; var r = (function (m_w) { var m_w = m_w; var m_z = 0x3ade68b1; var mask = 0xffffffff; return function () { m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; var result = ((m_z << 0x10) + m_w) & mask; result /= 0x100000000; result += 0.5; return result * (Math.random() > .5 ? 1 : -1); } }); for (var i = 0, rcache; i < nBytes; i += 4) { var _r = r((rcache || Math.random()) * 0x100000000); rcache = _r() * 0x3ade67b7; words.push((_r() * 0x100000000) | 0); } return new WordArray.init(words, nBytes); } }); /** * Encoder namespace. */ var C_enc = C.enc = {}; /** * Hex encoding strategy. */ var Hex = C_enc.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var hexChars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 0x0f).toString(16)); } return hexChars.join(''); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function (hexStr) { // Shortcut var hexStrLength = hexStr.length; // Convert var words = []; for (var i = 0; i < hexStrLength; i += 2) { words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); } return new WordArray.init(words, hexStrLength / 2); } }; /** * Latin1 encoding strategy. */ var Latin1 = C_enc.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var latin1Chars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; latin1Chars.push(String.fromCharCode(bite)); } return latin1Chars.join(''); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function (latin1Str) { // Shortcut var latin1StrLength = latin1Str.length; // Convert var words = []; for (var i = 0; i < latin1StrLength; i++) { words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); } return new WordArray.init(words, latin1StrLength); } }; /** * UTF-8 encoding strategy. */ var Utf8 = C_enc.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function (wordArray) { try { return decodeURIComponent(escape(Latin1.stringify(wordArray))); } catch (e) { throw new Error('Malformed UTF-8 data'); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function (utf8Str) { return Latin1.parse(unescape(encodeURIComponent(utf8Str))); } }; /** * Abstract buffered block algorithm template. * * The property blockSize must be implemented in a concrete subtype. * * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 */ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function () { // Initial values this._data = new WordArray.init(); this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function (data) { // Convert string to WordArray, else assume WordArray already if (typeof data == 'string') { data = Utf8.parse(data); } // Append this._data.concat(data); this._nDataBytes += data.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function (doFlush) { // Shortcuts var data = this._data; var dataWords = data.words; var dataSigBytes = data.sigBytes; var blockSize = this.blockSize; var blockSizeBytes = blockSize * 4; // Count blocks ready var nBlocksReady = dataSigBytes / blockSizeBytes; if (doFlush) { // Round up to include partial blocks nBlocksReady = Math.ceil(nBlocksReady); } else { // Round down to include only full blocks, // less the number of blocks that must remain in the buffer nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); } // Count words ready var nWordsReady = nBlocksReady * blockSize; // Count bytes ready var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks if (nWordsReady) { for (var offset = 0; offset < nWordsReady; offset += blockSize) { // Perform concrete-algorithm logic this._doProcessBlock(dataWords, offset); } // Remove processed words var processedWords = dataWords.splice(0, nWordsReady); data.sigBytes -= nBytesReady; } // Return processed words return new WordArray.init(processedWords, nBytesReady); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function () { var clone = Base.clone.call(this); clone._data = this._data.clone(); return clone; }, _minBufferSize: 0 }); /** * Abstract hasher template. * * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) */ var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ /** * Configuration options. */ cfg: Base.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function (cfg) { // Apply config defaults this.cfg = this.cfg.extend(cfg); // Set initial values this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function () { // Reset data buffer BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function (messageUpdate) { // Append this._append(messageUpdate); // Update the hash this._process(); // Chainable return this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function (messageUpdate) { // Final message update if (messageUpdate) { this._append(messageUpdate); } // Perform concrete-hasher logic var hash = this._doFinalize(); return hash; }, blockSize: 512 / 32, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function (hasher) { return function (message, cfg) { return new hasher.init(cfg).finalize(message); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function (hasher) { return function (message, key) { return new C_algo.HMAC.init(hasher, key).finalize(message); }; } }); /** * Algorithm namespace. */ var C_algo = C.algo = {}; return C; }(Math)); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_enc = C.enc; /** * Base64 encoding strategy. */ var Base64 = C_enc.Base64 = { /** * Converts a word array to a Base64 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Base64 string. * * @static * * @example * * var base64String = CryptoJS.enc.Base64.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; var map = this._map; // Clamp excess bits wordArray.clamp(); // Convert var base64Chars = []; for (var i = 0; i < sigBytes; i += 3) { var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; var triplet = (byte1 << 16) | (byte2 << 8) | byte3; for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); } } // Add padding var paddingChar = map.charAt(64); if (paddingChar) { while (base64Chars.length % 4) { base64Chars.push(paddingChar); } } return base64Chars.join(''); }, /** * Converts a Base64 string to a word array. * * @param {string} base64Str The Base64 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Base64.parse(base64String); */ parse: function (base64Str) { // Shortcuts var base64StrLength = base64Str.length; var map = this._map; var reverseMap = this._reverseMap; if (!reverseMap) { reverseMap = this._reverseMap = []; for (var j = 0; j < map.length; j++) { reverseMap[map.charCodeAt(j)] = j; } } // Ignore padding var paddingChar = map.charAt(64); if (paddingChar) { var paddingIndex = base64Str.indexOf(paddingChar); if (paddingIndex !== -1) { base64StrLength = paddingIndex; } } // Convert return parseLoop(base64Str, base64StrLength, reverseMap); }, _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' }; function parseLoop(base64Str, base64StrLength, reverseMap) { var words = []; var nBytes = 0; for (var i = 0; i < base64StrLength; i++) { if (i % 4) { var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); nBytes++; } } return WordArray.create(words, nBytes); } }()); (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Constants table var T = []; // Compute constants (function () { for (var i = 0; i < 64; i++) { T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; } }()); /** * MD5 hash algorithm. */ var MD5 = C_algo.MD5 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init([ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 ]); }, _doProcessBlock: function (M, offset) { // Swap endian for (var i = 0; i < 16; i++) { // Shortcuts var offset_i = offset + i; var M_offset_i = M[offset_i]; M[offset_i] = ( (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) ); } // Shortcuts var H = this._hash.words; var M_offset_0 = M[offset + 0]; var M_offset_1 = M[offset + 1]; var M_offset_2 = M[offset + 2]; var M_offset_3 = M[offset + 3]; var M_offset_4 = M[offset + 4]; var M_offset_5 = M[offset + 5]; var M_offset_6 = M[offset + 6]; var M_offset_7 = M[offset + 7]; var M_offset_8 = M[offset + 8]; var M_offset_9 = M[offset + 9]; var M_offset_10 = M[offset + 10]; var M_offset_11 = M[offset + 11]; var M_offset_12 = M[offset + 12]; var M_offset_13 = M[offset + 13]; var M_offset_14 = M[offset + 14]; var M_offset_15 = M[offset + 15]; // Working varialbes var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; // Computation a = FF(a, b, c, d, M_offset_0, 7, T[0]); d = FF(d, a, b, c, M_offset_1, 12, T[1]); c = FF(c, d, a, b, M_offset_2, 17, T[2]); b = FF(b, c, d, a, M_offset_3, 22, T[3]); a = FF(a, b, c, d, M_offset_4, 7, T[4]); d = FF(d, a, b, c, M_offset_5, 12, T[5]); c = FF(c, d, a, b, M_offset_6, 17, T[6]); b = FF(b, c, d, a, M_offset_7, 22, T[7]); a = FF(a, b, c, d, M_offset_8, 7, T[8]); d = FF(d, a, b, c, M_offset_9, 12, T[9]); c = FF(c, d, a, b, M_offset_10, 17, T[10]); b = FF(b, c, d, a, M_offset_11, 22, T[11]); a = FF(a, b, c, d, M_offset_12, 7, T[12]); d = FF(d, a, b, c, M_offset_13, 12, T[13]); c = FF(c, d, a, b, M_offset_14, 17, T[14]); b = FF(b, c, d, a, M_offset_15, 22, T[15]); a = GG(a, b, c, d, M_offset_1, 5, T[16]); d = GG(d, a, b, c, M_offset_6, 9, T[17]); c = GG(c, d, a, b, M_offset_11, 14, T[18]); b = GG(b, c, d, a, M_offset_0, 20, T[19]); a = GG(a, b, c, d, M_offset_5, 5, T[20]); d = GG(d, a, b, c, M_offset_10, 9, T[21]); c = GG(c, d, a, b, M_offset_15, 14, T[22]); b = GG(b, c, d, a, M_offset_4, 20, T[23]); a = GG(a, b, c, d, M_offset_9, 5, T[24]); d = GG(d, a, b, c, M_offset_14, 9, T[25]); c = GG(c, d, a, b, M_offset_3, 14, T[26]); b = GG(b, c, d, a, M_offset_8, 20, T[27]); a = GG(a, b, c, d, M_offset_13, 5, T[28]); d = GG(d, a, b, c, M_offset_2, 9, T[29]); c = GG(c, d, a, b, M_offset_7, 14, T[30]); b = GG(b, c, d, a, M_offset_12, 20, T[31]); a = HH(a, b, c, d, M_offset_5, 4, T[32]); d = HH(d, a, b, c, M_offset_8, 11, T[33]); c = HH(c, d, a, b, M_offset_11, 16, T[34]); b = HH(b, c, d, a, M_offset_14, 23, T[35]); a = HH(a, b, c, d, M_offset_1, 4, T[36]); d = HH(d, a, b, c, M_offset_4, 11, T[37]); c = HH(c, d, a, b, M_offset_7, 16, T[38]); b = HH(b, c, d, a, M_offset_10, 23, T[39]); a = HH(a, b, c, d, M_offset_13, 4, T[40]); d = HH(d, a, b, c, M_offset_0, 11, T[41]); c = HH(c, d, a, b, M_offset_3, 16, T[42]); b = HH(b, c, d, a, M_offset_6, 23, T[43]); a = HH(a, b, c, d, M_offset_9, 4, T[44]); d = HH(d, a, b, c, M_offset_12, 11, T[45]); c = HH(c, d, a, b, M_offset_15, 16, T[46]); b = HH(b, c, d, a, M_offset_2, 23, T[47]); a = II(a, b, c, d, M_offset_0, 6, T[48]); d = II(d, a, b, c, M_offset_7, 10, T[49]); c = II(c, d, a, b, M_offset_14, 15, T[50]); b = II(b, c, d, a, M_offset_5, 21, T[51]); a = II(a, b, c, d, M_offset_12, 6, T[52]); d = II(d, a, b, c, M_offset_3, 10, T[53]); c = II(c, d, a, b, M_offset_10, 15, T[54]); b = II(b, c, d, a, M_offset_1, 21, T[55]); a = II(a, b, c, d, M_offset_8, 6, T[56]); d = II(d, a, b, c, M_offset_15, 10, T[57]); c = II(c, d, a, b, M_offset_6, 15, T[58]); b = II(b, c, d, a, M_offset_13, 21, T[59]); a = II(a, b, c, d, M_offset_4, 6, T[60]); d = II(d, a, b, c, M_offset_11, 10, T[61]); c = II(c, d, a, b, M_offset_2, 15, T[62]); b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); var nBitsTotalL = nBitsTotal; dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) ); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) ); data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks this._process(); // Shortcuts var hash = this._hash; var H = hash.words; // Swap endian for (var i = 0; i < 4; i++) { // Shortcut var H_i = H[i]; H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); } // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); function FF(a, b, c, d, x, s, t) { var n = a + ((b & c) | (~b & d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function GG(a, b, c, d, x, s, t) { var n = a + ((b & d) | (c & ~d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function HH(a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function II(a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.MD5('message'); * var hash = CryptoJS.MD5(wordArray); */ C.MD5 = Hasher._createHelper(MD5); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacMD5(message, key); */ C.HmacMD5 = Hasher._createHmacHelper(MD5); }(Math)); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Reusable object var W = []; /** * SHA-1 hash algorithm. */ var SHA1 = C_algo.SHA1 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init([ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]); }, _doProcessBlock: function (M, offset) { // Shortcut var H = this._hash.words; // Working variables var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; var e = H[4]; // Computation for (var i = 0; i < 80; i++) { if (i < 16) { W[i] = M[offset + i] | 0; } else { var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = (n << 1) | (n >>> 31); } var t = ((a << 5) | (a >>> 27)) + e + W[i]; if (i < 20) { t += ((b & c) | (~b & d)) + 0x5a827999; } else if (i < 40) { t += (b ^ c ^ d) + 0x6ed9eba1; } else if (i < 60) { t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; } else /* if (i < 80) */ { t += (b ^ c ^ d) - 0x359d3e2a; } e = d; d = c; c = (b << 30) | (b >>> 2); b = a; a = t; } // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; H[4] = (H[4] + e) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Return final computed hash return this._hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA1('message'); * var hash = CryptoJS.SHA1(wordArray); */ C.SHA1 = Hasher._createHelper(SHA1); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA1(message, key); */ C.HmacSHA1 = Hasher._createHmacHelper(SHA1); }()); (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Initialization and round constants tables var H = []; var K = []; // Compute constants (function () { function isPrime(n) { var sqrtN = Math.sqrt(n); for (var factor = 2; factor <= sqrtN; factor++) { if (!(n % factor)) { return false; } } return true; } function getFractionalBits(n) { return ((n - (n | 0)) * 0x100000000) | 0; } var n = 2; var nPrime = 0; while (nPrime < 64) { if (isPrime(n)) { if (nPrime < 8) { H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); } K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); nPrime++; } n++; } }()); // Reusable object var W = []; /** * SHA-256 hash algorithm. */ var SHA256 = C_algo.SHA256 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init(H.slice(0)); }, _doProcessBlock: function (M, offset) { // Shortcut var H = this._hash.words; // Working variables var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; var e = H[4]; var f = H[5]; var g = H[6]; var h = H[7]; // Computation for (var i = 0; i < 64; i++) { if (i < 16) { W[i] = M[offset + i] | 0; } else { var gamma0x = W[i - 15]; var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ ((gamma0x << 14) | (gamma0x >>> 18)) ^ (gamma0x >>> 3); var gamma1x = W[i - 2]; var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ ((gamma1x << 13) | (gamma1x >>> 19)) ^ (gamma1x >>> 10); W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; } var ch = (e & f) ^ (~e & g); var maj = (a & b) ^ (a & c) ^ (b & c); var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); var t1 = h + sigma1 + ch + K[i] + W[i]; var t2 = sigma0 + maj; h = g; g = f; f = e; e = (d + t1) | 0; d = c; c = b; b = a; a = (t1 + t2) | 0; } // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; H[4] = (H[4] + e) | 0; H[5] = (H[5] + f) | 0; H[6] = (H[6] + g) | 0; H[7] = (H[7] + h) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Return final computed hash return this._hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA256('message'); * var hash = CryptoJS.SHA256(wordArray); */ C.SHA256 = Hasher._createHelper(SHA256); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA256(message, key); */ C.HmacSHA256 = Hasher._createHmacHelper(SHA256); }(Math)); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_enc = C.enc; /** * UTF-16 BE encoding strategy. */ var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { /** * Converts a word array to a UTF-16 BE string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-16 BE string. * * @static * * @example * * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var utf16Chars = []; for (var i = 0; i < sigBytes; i += 2) { var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; utf16Chars.push(String.fromCharCode(codePoint)); } return utf16Chars.join(''); }, /** * Converts a UTF-16 BE string to a word array. * * @param {string} utf16Str The UTF-16 BE string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); */ parse: function (utf16Str) { // Shortcut var utf16StrLength = utf16Str.length; // Convert var words = []; for (var i = 0; i < utf16StrLength; i++) { words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); } return WordArray.create(words, utf16StrLength * 2); } }; /** * UTF-16 LE encoding strategy. */ C_enc.Utf16LE = { /** * Converts a word array to a UTF-16 LE string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-16 LE string. * * @static * * @example * * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var utf16Chars = []; for (var i = 0; i < sigBytes; i += 2) { var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); utf16Chars.push(String.fromCharCode(codePoint)); } return utf16Chars.join(''); }, /** * Converts a UTF-16 LE string to a word array. * * @param {string} utf16Str The UTF-16 LE string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); */ parse: function (utf16Str) { // Shortcut var utf16StrLength = utf16Str.length; // Convert var words = []; for (var i = 0; i < utf16StrLength; i++) { words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); } return WordArray.create(words, utf16StrLength * 2); } }; function swapEndian(word) { return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); } }()); (function () { // Check if typed arrays are supported if (typeof ArrayBuffer != 'function') { return; } // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; // Reference original init var superInit = WordArray.init; // Augment WordArray.init to handle typed arrays var subInit = WordArray.init = function (typedArray) { // Convert buffers to uint8 if (typedArray instanceof ArrayBuffer) { typedArray = new Uint8Array(typedArray); } // Convert other array views to uint8 if ( typedArray instanceof Int8Array || (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array ) { typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); } // Handle Uint8Array if (typedArray instanceof Uint8Array) { // Shortcut var typedArrayByteLength = typedArray.byteLength; // Extract bytes var words = []; for (var i = 0; i < typedArrayByteLength; i++) { words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); } // Initialize this word array superInit.call(this, words, typedArrayByteLength); } else { // Else call normal init superInit.apply(this, arguments); } }; subInit.prototype = WordArray; }()); /** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Constants table var _zl = WordArray.create([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); var _zr = WordArray.create([ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); var _sl = WordArray.create([ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]); var _sr = WordArray.create([ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]); var _hl = WordArray.create([0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); var _hr = WordArray.create([0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); /** * RIPEMD160 hash algorithm. */ var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ _doReset: function () { this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); }, _doProcessBlock: function (M, offset) { // Swap endian for (var i = 0; i < 16; i++) { // Shortcuts var offset_i = offset + i; var M_offset_i = M[offset_i]; // Swap M[offset_i] = ( (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) ); } // Shortcut var H = this._hash.words; var hl = _hl.words; var hr = _hr.words; var zl = _zl.words; var zr = _zr.words; var sl = _sl.words; var sr = _sr.words; // Working variables var al, bl, cl, dl, el; var ar, br, cr, dr, er; ar = al = H[0]; br = bl = H[1]; cr = cl = H[2]; dr = dl = H[3]; er = el = H[4]; // Computation var t; for (var i = 0; i < 80; i += 1) { t = (al + M[offset + zl[i]]) | 0; if (i < 16) { t += f1(bl, cl, dl) + hl[0]; } else if (i < 32) { t += f2(bl, cl, dl) + hl[1]; } else if (i < 48) { t += f3(bl, cl, dl) + hl[2]; } else if (i < 64) { t += f4(bl, cl, dl) + hl[3]; } else {// if (i<80) { t += f5(bl, cl, dl) + hl[4]; } t = t | 0; t = rotl(t, sl[i]); t = (t + el) | 0; al = el; el = dl; dl = rotl(cl, 10); cl = bl; bl = t; t = (ar + M[offset + zr[i]]) | 0; if (i < 16) { t += f5(br, cr, dr) + hr[0]; } else if (i < 32) { t += f4(br, cr, dr) + hr[1]; } else if (i < 48) { t += f3(br, cr, dr) + hr[2]; } else if (i < 64) { t += f2(br, cr, dr) + hr[3]; } else {// if (i<80) { t += f1(br, cr, dr) + hr[4]; } t = t | 0; t = rotl(t, sr[i]); t = (t + er) | 0; ar = er; er = dr; dr = rotl(cr, 10); cr = br; br = t; } // Intermediate hash value t = (H[1] + cl + dr) | 0; H[1] = (H[2] + dl + er) | 0; H[2] = (H[3] + el + ar) | 0; H[3] = (H[4] + al + br) | 0; H[4] = (H[0] + bl + cr) | 0; H[0] = t; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) ); data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks this._process(); // Shortcuts var hash = this._hash; var H = hash.words; // Swap endian for (var i = 0; i < 5; i++) { // Shortcut var H_i = H[i]; // Swap H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); } // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); function f1(x, y, z) { return ((x) ^ (y) ^ (z)); } function f2(x, y, z) { return (((x) & (y)) | ((~x) & (z))); } function f3(x, y, z) { return (((x) | (~(y))) ^ (z)); } function f4(x, y, z) { return (((x) & (z)) | ((y) & (~(z)))); } function f5(x, y, z) { return ((x) ^ ((y) | (~(z)))); } function rotl(x, n) { return (x << n) | (x >>> (32 - n)); } /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.RIPEMD160('message'); * var hash = CryptoJS.RIPEMD160(wordArray); */ C.RIPEMD160 = Hasher._createHelper(RIPEMD160); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacRIPEMD160(message, key); */ C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); }(Math)); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var C_enc = C.enc; var Utf8 = C_enc.Utf8; var C_algo = C.algo; /** * HMAC algorithm. */ var HMAC = C_algo.HMAC = Base.extend({ /** * Initializes a newly created HMAC. * * @param {Hasher} hasher The hash algorithm to use. * @param {WordArray|string} key The secret key. * * @example * * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); */ init: function (hasher, key) { // Init hasher hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already if (typeof key == 'string') { key = Utf8.parse(key); } // Shortcuts var hasherBlockSize = hasher.blockSize; var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys if (key.sigBytes > hasherBlockSizeBytes) { key = hasher.finalize(key); } // Clamp excess bits key.clamp(); // Clone key for inner and outer pads var oKey = this._oKey = key.clone(); var iKey = this._iKey = key.clone(); // Shortcuts var oKeyWords = oKey.words; var iKeyWords = iKey.words; // XOR keys with pad constants for (var i = 0; i < hasherBlockSize; i++) { oKeyWords[i] ^= 0x5c5c5c5c; iKeyWords[i] ^= 0x36363636; } oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values this.reset(); }, /** * Resets this HMAC to its initial state. * * @example * * hmacHasher.reset(); */ reset: function () { // Shortcut var hasher = this._hasher; // Reset hasher.reset(); hasher.update(this._iKey); }, /** * Updates this HMAC with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {HMAC} This HMAC instance. * * @example * * hmacHasher.update('message'); * hmacHasher.update(wordArray); */ update: function (messageUpdate) { this._hasher.update(messageUpdate); // Chainable return this; }, /** * Finalizes the HMAC computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The HMAC. * * @example * * var hmac = hmacHasher.finalize(); * var hmac = hmacHasher.finalize('message'); * var hmac = hmacHasher.finalize(wordArray); */ finalize: function (messageUpdate) { // Shortcut var hasher = this._hasher; // Compute HMAC var innerHash = hasher.finalize(messageUpdate); hasher.reset(); var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); return hmac; } }); }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var C_algo = C.algo; var SHA1 = C_algo.SHA1; var HMAC = C_algo.HMAC; /** * Password-Based Key Derivation Function 2 algorithm. */ var PBKDF2 = C_algo.PBKDF2 = Base.extend({ /** * Configuration options. * * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) * @property {Hasher} hasher The hasher to use. Default: SHA1 * @property {number} iterations The number of iterations to perform. Default: 1 */ cfg: Base.extend({ keySize: 128 / 32, hasher: SHA1, iterations: 1 }), /** * Initializes a newly created key derivation function. * * @param {Object} cfg (Optional) The configuration options to use for the derivation. * * @example * * var kdf = CryptoJS.algo.PBKDF2.create(); * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); */ init: function (cfg) { this.cfg = this.cfg.extend(cfg); }, /** * Computes the Password-Based Key Derivation Function 2. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * * @return {WordArray} The derived key. * * @example * * var key = kdf.compute(password, salt); */ compute: function (password, salt) { // Shortcut var cfg = this.cfg; // Init HMAC var hmac = HMAC.create(cfg.hasher, password); // Initial values var derivedKey = WordArray.create(); var blockIndex = WordArray.create([0x00000001]); // Shortcuts var derivedKeyWords = derivedKey.words; var blockIndexWords = blockIndex.words; var keySize = cfg.keySize; var iterations = cfg.iterations; // Generate key while (derivedKeyWords.length < keySize) { var block = hmac.update(salt).finalize(blockIndex); hmac.reset(); // Shortcuts var blockWords = block.words; var blockWordsLength = blockWords.length; // Iterations var intermediate = block; for (var i = 1; i < iterations; i++) { intermediate = hmac.finalize(intermediate); hmac.reset(); // Shortcut var intermediateWords = intermediate.words; // XOR intermediate with block for (var j = 0; j < blockWordsLength; j++) { blockWords[j] ^= intermediateWords[j]; } } derivedKey.concat(block); blockIndexWords[0]++; } derivedKey.sigBytes = keySize * 4; return derivedKey; } }); /** * Computes the Password-Based Key Derivation Function 2. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * @param {Object} cfg (Optional) The configuration options to use for this computation. * * @return {WordArray} The derived key. * * @static * * @example * * var key = CryptoJS.PBKDF2(password, salt); * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); */ C.PBKDF2 = function (password, salt, cfg) { return PBKDF2.create(cfg).compute(password, salt); }; }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var C_algo = C.algo; var MD5 = C_algo.MD5; /** * This key derivation function is meant to conform with EVP_BytesToKey. * www.openssl.org/docs/crypto/EVP_BytesToKey.html */ var EvpKDF = C_algo.EvpKDF = Base.extend({ /** * Configuration options. * * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) * @property {Hasher} hasher The hash algorithm to use. Default: MD5 * @property {number} iterations The number of iterations to perform. Default: 1 */ cfg: Base.extend({ keySize: 128 / 32, hasher: MD5, iterations: 1 }), /** * Initializes a newly created key derivation function. * * @param {Object} cfg (Optional) The configuration options to use for the derivation. * * @example * * var kdf = CryptoJS.algo.EvpKDF.create(); * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); */ init: function (cfg) { this.cfg = this.cfg.extend(cfg); }, /** * Derives a key from a password. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * * @return {WordArray} The derived key. * * @example * * var key = kdf.compute(password, salt); */ compute: function (password, salt) { // Shortcut var cfg = this.cfg; // Init hasher var hasher = cfg.hasher.create(); // Initial values var derivedKey = WordArray.create(); // Shortcuts var derivedKeyWords = derivedKey.words; var keySize = cfg.keySize; var iterations = cfg.iterations; // Generate key while (derivedKeyWords.length < keySize) { if (block) { hasher.update(block); } var block = hasher.update(password).finalize(salt); hasher.reset(); // Iterations for (var i = 1; i < iterations; i++) { block = hasher.finalize(block); hasher.reset(); } derivedKey.concat(block); } derivedKey.sigBytes = keySize * 4; return derivedKey; } }); /** * Derives a key from a password. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * @param {Object} cfg (Optional) The configuration options to use for this computation. * * @return {WordArray} The derived key. * * @static * * @example * * var key = CryptoJS.EvpKDF(password, salt); * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); */ C.EvpKDF = function (password, salt, cfg) { return EvpKDF.create(cfg).compute(password, salt); }; }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_algo = C.algo; var SHA256 = C_algo.SHA256; /** * SHA-224 hash algorithm. */ var SHA224 = C_algo.SHA224 = SHA256.extend({ _doReset: function () { this._hash = new WordArray.init([ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]); }, _doFinalize: function () { var hash = SHA256._doFinalize.call(this); hash.sigBytes -= 4; return hash; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA224('message'); * var hash = CryptoJS.SHA224(wordArray); */ C.SHA224 = SHA256._createHelper(SHA224); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA224(message, key); */ C.HmacSHA224 = SHA256._createHmacHelper(SHA224); }()); (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var X32WordArray = C_lib.WordArray; /** * x64 namespace. */ var C_x64 = C.x64 = {}; /** * A 64-bit word. */ var X64Word = C_x64.Word = Base.extend({ /** * Initializes a newly created 64-bit word. * * @param {number} high The high 32 bits. * @param {number} low The low 32 bits. * * @example * * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); */ init: function (high, low) { this.high = high; this.low = low; } /** * Bitwise NOTs this word. * * @return {X64Word} A new x64-Word object after negating. * * @example * * var negated = x64Word.not(); */ // not: function () { // var high = ~this.high; // var low = ~this.low; // return X64Word.create(high, low); // }, /** * Bitwise ANDs this word with the passed word. * * @param {X64Word} word The x64-Word to AND with this word. * * @return {X64Word} A new x64-Word object after ANDing. * * @example * * var anded = x64Word.and(anotherX64Word); */ // and: function (word) { // var high = this.high & word.high; // var low = this.low & word.low; // return X64Word.create(high, low); // }, /** * Bitwise ORs this word with the passed word. * * @param {X64Word} word The x64-Word to OR with this word. * * @return {X64Word} A new x64-Word object after ORing. * * @example * * var ored = x64Word.or(anotherX64Word); */ // or: function (word) { // var high = this.high | word.high; // var low = this.low | word.low; // return X64Word.create(high, low); // }, /** * Bitwise XORs this word with the passed word. * * @param {X64Word} word The x64-Word to XOR with this word. * * @return {X64Word} A new x64-Word object after XORing. * * @example * * var xored = x64Word.xor(anotherX64Word); */ // xor: function (word) { // var high = this.high ^ word.high; // var low = this.low ^ word.low; // return X64Word.create(high, low); // }, /** * Shifts this word n bits to the left. * * @param {number} n The number of bits to shift. * * @return {X64Word} A new x64-Word object after shifting. * * @example * * var shifted = x64Word.shiftL(25); */ // shiftL: function (n) { // if (n < 32) { // var high = (this.high << n) | (this.low >>> (32 - n)); // var low = this.low << n; // } else { // var high = this.low << (n - 32); // var low = 0; // } // return X64Word.create(high, low); // }, /** * Shifts this word n bits to the right. * * @param {number} n The number of bits to shift. * * @return {X64Word} A new x64-Word object after shifting. * * @example * * var shifted = x64Word.shiftR(7); */ // shiftR: function (n) { // if (n < 32) { // var low = (this.low >>> n) | (this.high << (32 - n)); // var high = this.high >>> n; // } else { // var low = this.high >>> (n - 32); // var high = 0; // } // return X64Word.create(high, low); // }, /** * Rotates this word n bits to the left. * * @param {number} n The number of bits to rotate. * * @return {X64Word} A new x64-Word object after rotating. * * @example * * var rotated = x64Word.rotL(25); */ // rotL: function (n) { // return this.shiftL(n).or(this.shiftR(64 - n)); // }, /** * Rotates this word n bits to the right. * * @param {number} n The number of bits to rotate. * * @return {X64Word} A new x64-Word object after rotating. * * @example * * var rotated = x64Word.rotR(7); */ // rotR: function (n) { // return this.shiftR(n).or(this.shiftL(64 - n)); // }, /** * Adds this word with the passed word. * * @param {X64Word} word The x64-Word to add with this word. * * @return {X64Word} A new x64-Word object after adding. * * @example * * var added = x64Word.add(anotherX64Word); */ // add: function (word) { // var low = (this.low + word.low) | 0; // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; // var high = (this.high + word.high + carry) | 0; // return X64Word.create(high, low); // } }); /** * An array of 64-bit words. * * @property {Array} words The array of CryptoJS.x64.Word objects. * @property {number} sigBytes The number of significant bytes in this word array. */ var X64WordArray = C_x64.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.x64.WordArray.create(); * * var wordArray = CryptoJS.x64.WordArray.create([ * CryptoJS.x64.Word.create(0x00010203, 0x04050607), * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) * ]); * * var wordArray = CryptoJS.x64.WordArray.create([ * CryptoJS.x64.Word.create(0x00010203, 0x04050607), * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) * ], 10); */ init: function (words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 8; } }, /** * Converts this 64-bit word array to a 32-bit word array. * * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. * * @example * * var x32WordArray = x64WordArray.toX32(); */ toX32: function () { // Shortcuts var x64Words = this.words; var x64WordsLength = x64Words.length; // Convert var x32Words = []; for (var i = 0; i < x64WordsLength; i++) { var x64Word = x64Words[i]; x32Words.push(x64Word.high); x32Words.push(x64Word.low); } return X32WordArray.create(x32Words, this.sigBytes); }, /** * Creates a copy of this word array. * * @return {X64WordArray} The clone. * * @example * * var clone = x64WordArray.clone(); */ clone: function () { var clone = Base.clone.call(this); // Clone "words" array var words = clone.words = this.words.slice(0); // Clone each X64Word object var wordsLength = words.length; for (var i = 0; i < wordsLength; i++) { words[i] = words[i].clone(); } return clone; } }); }()); (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_x64 = C.x64; var X64Word = C_x64.Word; var C_algo = C.algo; // Constants tables var RHO_OFFSETS = []; var PI_INDEXES = []; var ROUND_CONSTANTS = []; // Compute Constants (function () { // Compute rho offset constants var x = 1, y = 0; for (var t = 0; t < 24; t++) { RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; var newX = y % 5; var newY = (2 * x + 3 * y) % 5; x = newX; y = newY; } // Compute pi index constants for (var x = 0; x < 5; x++) { for (var y = 0; y < 5; y++) { PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; } } // Compute round constants var LFSR = 0x01; for (var i = 0; i < 24; i++) { var roundConstantMsw = 0; var roundConstantLsw = 0; for (var j = 0; j < 7; j++) { if (LFSR & 0x01) { var bitPosition = (1 << j) - 1; if (bitPosition < 32) { roundConstantLsw ^= 1 << bitPosition; } else /* if (bitPosition >= 32) */ { roundConstantMsw ^= 1 << (bitPosition - 32); } } // Compute next LFSR if (LFSR & 0x80) { // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 LFSR = (LFSR << 1) ^ 0x71; } else { LFSR <<= 1; } } ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); } }()); // Reusable objects for temporary values var T = []; (function () { for (var i = 0; i < 25; i++) { T[i] = X64Word.create(); } }()); /** * SHA-3 hash algorithm. */ var SHA3 = C_algo.SHA3 = Hasher.extend({ /** * Configuration options. * * @property {number} outputLength * The desired number of bits in the output hash. * Only values permitted are: 224, 256, 384, 512. * Default: 512 */ cfg: Hasher.cfg.extend({ outputLength: 512 }), _doReset: function () { var state = this._state = [] for (var i = 0; i < 25; i++) { state[i] = new X64Word.init(); } this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; }, _doProcessBlock: function (M, offset) { // Shortcuts var state = this._state; var nBlockSizeLanes = this.blockSize / 2; // Absorb for (var i = 0; i < nBlockSizeLanes; i++) { // Shortcuts var M2i = M[offset + 2 * i]; var M2i1 = M[offset + 2 * i + 1]; // Swap endian M2i = ( (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) ); M2i1 = ( (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) ); // Absorb message into state var lane = state[i]; lane.high ^= M2i1; lane.low ^= M2i; } // Rounds for (var round = 0; round < 24; round++) { // Theta for (var x = 0; x < 5; x++) { // Mix column lanes var tMsw = 0, tLsw = 0; for (var y = 0; y < 5; y++) { var lane = state[x + 5 * y]; tMsw ^= lane.high; tLsw ^= lane.low; } // Temporary values var Tx = T[x]; Tx.high = tMsw; Tx.low = tLsw; } for (var x = 0; x < 5; x++) { // Shortcuts var Tx4 = T[(x + 4) % 5]; var Tx1 = T[(x + 1) % 5]; var Tx1Msw = Tx1.high; var Tx1Lsw = Tx1.low; // Mix surrounding columns var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); for (var y = 0; y < 5; y++) { var lane = state[x + 5 * y]; lane.high ^= tMsw; lane.low ^= tLsw; } } // Rho Pi for (var laneIndex = 1; laneIndex < 25; laneIndex++) { // Shortcuts var lane = state[laneIndex]; var laneMsw = lane.high; var laneLsw = lane.low; var rhoOffset = RHO_OFFSETS[laneIndex]; // Rotate lanes if (rhoOffset < 32) { var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); } else /* if (rhoOffset >= 32) */ { var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); } // Transpose lanes var TPiLane = T[PI_INDEXES[laneIndex]]; TPiLane.high = tMsw; TPiLane.low = tLsw; } // Rho pi at x = y = 0 var T0 = T[0]; var state0 = state[0]; T0.high = state0.high; T0.low = state0.low; // Chi for (var x = 0; x < 5; x++) { for (var y = 0; y < 5; y++) { // Shortcuts var laneIndex = x + 5 * y; var lane = state[laneIndex]; var TLane = T[laneIndex]; var Tx1Lane = T[((x + 1) % 5) + 5 * y]; var Tx2Lane = T[((x + 2) % 5) + 5 * y]; // Mix rows lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); } } // Iota var lane = state[0]; var roundConstant = ROUND_CONSTANTS[round]; lane.high ^= roundConstant.high; lane.low ^= roundConstant.low; ; } }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; var blockSizeBits = this.blockSize * 32; // Add padding dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Shortcuts var state = this._state; var outputLengthBytes = this.cfg.outputLength / 8; var outputLengthLanes = outputLengthBytes / 8; // Squeeze var hashWords = []; for (var i = 0; i < outputLengthLanes; i++) { // Shortcuts var lane = state[i]; var laneMsw = lane.high; var laneLsw = lane.low; // Swap endian laneMsw = ( (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) ); laneLsw = ( (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) ); // Squeeze state to retrieve hash hashWords.push(laneLsw); hashWords.push(laneMsw); } // Return final computed hash return new WordArray.init(hashWords, outputLengthBytes); }, clone: function () { var clone = Hasher.clone.call(this); var state = clone._state = this._state.slice(0); for (var i = 0; i < 25; i++) { state[i] = state[i].clone(); } return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA3('message'); * var hash = CryptoJS.SHA3(wordArray); */ C.SHA3 = Hasher._createHelper(SHA3); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA3(message, key); */ C.HmacSHA3 = Hasher._createHmacHelper(SHA3); }(Math)); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Hasher = C_lib.Hasher; var C_x64 = C.x64; var X64Word = C_x64.Word; var X64WordArray = C_x64.WordArray; var C_algo = C.algo; function X64Word_create() { return X64Word.create.apply(X64Word, arguments); } // Constants var K = [ X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) ]; // Reusable objects var W = []; (function () { for (var i = 0; i < 80; i++) { W[i] = X64Word_create(); } }()); /** * SHA-512 hash algorithm. */ var SHA512 = C_algo.SHA512 = Hasher.extend({ _doReset: function () { this._hash = new X64WordArray.init([ new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) ]); }, _doProcessBlock: function (M, offset) { // Shortcuts var H = this._hash.words; var H0 = H[0]; var H1 = H[1]; var H2 = H[2]; var H3 = H[3]; var H4 = H[4]; var H5 = H[5]; var H6 = H[6]; var H7 = H[7]; var H0h = H0.high; var H0l = H0.low; var H1h = H1.high; var H1l = H1.low; var H2h = H2.high; var H2l = H2.low; var H3h = H3.high; var H3l = H3.low; var H4h = H4.high; var H4l = H4.low; var H5h = H5.high; var H5l = H5.low; var H6h = H6.high; var H6l = H6.low; var H7h = H7.high; var H7l = H7.low; // Working variables var ah = H0h; var al = H0l; var bh = H1h; var bl = H1l; var ch = H2h; var cl = H2l; var dh = H3h; var dl = H3l; var eh = H4h; var el = H4l; var fh = H5h; var fl = H5l; var gh = H6h; var gl = H6l; var hh = H7h; var hl = H7l; // Rounds for (var i = 0; i < 80; i++) { // Shortcut var Wi = W[i]; // Extend message if (i < 16) { var Wih = Wi.high = M[offset + i * 2] | 0; var Wil = Wi.low = M[offset + i * 2 + 1] | 0; } else { // Gamma0 var gamma0x = W[i - 15]; var gamma0xh = gamma0x.high; var gamma0xl = gamma0x.low; var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); // Gamma1 var gamma1x = W[i - 2]; var gamma1xh = gamma1x.high; var gamma1xl = gamma1x.low; var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] var Wi7 = W[i - 7]; var Wi7h = Wi7.high; var Wi7l = Wi7.low; var Wi16 = W[i - 16]; var Wi16h = Wi16.high; var Wi16l = Wi16.low; var Wil = gamma0l + Wi7l; var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); var Wil = Wil + gamma1l; var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); var Wil = Wil + Wi16l; var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); Wi.high = Wih; Wi.low = Wil; } var chh = (eh & fh) ^ (~eh & gh); var chl = (el & fl) ^ (~el & gl); var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); var majl = (al & bl) ^ (al & cl) ^ (bl & cl); var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); // t1 = h + sigma1 + ch + K[i] + W[i] var Ki = K[i]; var Kih = Ki.high; var Kil = Ki.low; var t1l = hl + sigma1l; var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); var t1l = t1l + chl; var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); var t1l = t1l + Kil; var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); var t1l = t1l + Wil; var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); // t2 = sigma0 + maj var t2l = sigma0l + majl; var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); // Update working variables hh = gh; hl = gl; gh = fh; gl = fl; fh = eh; fl = el; el = (dl + t1l) | 0; eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; dh = ch; dl = cl; ch = bh; cl = bl; bh = ah; bl = al; al = (t1l + t2l) | 0; ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; } // Intermediate hash value H0l = H0.low = (H0l + al); H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); H1l = H1.low = (H1l + bl); H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); H2l = H2.low = (H2l + cl); H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); H3l = H3.low = (H3l + dl); H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); H4l = H4.low = (H4l + el); H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); H5l = H5.low = (H5l + fl); H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); H6l = H6.low = (H6l + gl); H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); H7l = H7.low = (H7l + hl); H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Convert hash to 32-bit word array before returning var hash = this._hash.toX32(); // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; }, blockSize: 1024 / 32 }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA512('message'); * var hash = CryptoJS.SHA512(wordArray); */ C.SHA512 = Hasher._createHelper(SHA512); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA512(message, key); */ C.HmacSHA512 = Hasher._createHmacHelper(SHA512); }()); (function () { // Shortcuts var C = CryptoJS; var C_x64 = C.x64; var X64Word = C_x64.Word; var X64WordArray = C_x64.WordArray; var C_algo = C.algo; var SHA512 = C_algo.SHA512; /** * SHA-384 hash algorithm. */ var SHA384 = C_algo.SHA384 = SHA512.extend({ _doReset: function () { this._hash = new X64WordArray.init([ new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) ]); }, _doFinalize: function () { var hash = SHA512._doFinalize.call(this); hash.sigBytes -= 16; return hash; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA384('message'); * var hash = CryptoJS.SHA384(wordArray); */ C.SHA384 = SHA512._createHelper(SHA384); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA384(message, key); */ C.HmacSHA384 = SHA512._createHmacHelper(SHA384); }()); /** * Cipher core components. */ CryptoJS.lib.Cipher || (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; var C_enc = C.enc; var Utf8 = C_enc.Utf8; var Base64 = C_enc.Base64; var C_algo = C.algo; var EvpKDF = C_algo.EvpKDF; /** * Abstract base cipher template. * * @property {number} keySize This cipher's key size. Default: 4 (128 bits) * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. */ var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ /** * Configuration options. * * @property {WordArray} iv The IV to use for this operation. */ cfg: Base.extend(), /** * Creates this cipher in encryption mode. * * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {Cipher} A cipher instance. * * @static * * @example * * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); */ createEncryptor: function (key, cfg) { return this.create(this._ENC_XFORM_MODE, key, cfg); }, /** * Creates this cipher in decryption mode. * * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {Cipher} A cipher instance. * * @static * * @example * * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); */ createDecryptor: function (key, cfg) { return this.create(this._DEC_XFORM_MODE, key, cfg); }, /** * Initializes a newly created cipher. * * @param {number} xformMode Either the encryption or decryption transormation mode constant. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @example * * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); */ init: function (xformMode, key, cfg) { // Apply config defaults this.cfg = this.cfg.extend(cfg); // Store transform mode and key this._xformMode = xformMode; this._key = key; // Set initial values this.reset(); }, /** * Resets this cipher to its initial state. * * @example * * cipher.reset(); */ reset: function () { // Reset data buffer BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic this._doReset(); }, /** * Adds data to be encrypted or decrypted. * * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. * * @return {WordArray} The data after processing. * * @example * * var encrypted = cipher.process('data'); * var encrypted = cipher.process(wordArray); */ process: function (dataUpdate) { // Append this._append(dataUpdate); // Process available blocks return this._process(); }, /** * Finalizes the encryption or decryption process. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. * * @return {WordArray} The data after final processing. * * @example * * var encrypted = cipher.finalize(); * var encrypted = cipher.finalize('data'); * var encrypted = cipher.finalize(wordArray); */ finalize: function (dataUpdate) { // Final data update if (dataUpdate) { this._append(dataUpdate); } // Perform concrete-cipher logic var finalProcessedData = this._doFinalize(); return finalProcessedData; }, keySize: 128 / 32, ivSize: 128 / 32, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, /** * Creates shortcut functions to a cipher's object interface. * * @param {Cipher} cipher The cipher to create a helper for. * * @return {Object} An object with encrypt and decrypt shortcut functions. * * @static * * @example * * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); */ _createHelper: (function () { function selectCipherStrategy(key) { if (typeof key == 'string') { return PasswordBasedCipher; } else { return SerializableCipher; } } return function (cipher) { return { encrypt: function (message, key, cfg) { return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); }, decrypt: function (ciphertext, key, cfg) { return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); } }; }; }()) }); /** * Abstract base stream cipher template. * * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) */ var StreamCipher = C_lib.StreamCipher = Cipher.extend({ _doFinalize: function () { // Process partial blocks var finalProcessedBlocks = this._process(!!'flush'); return finalProcessedBlocks; }, blockSize: 1 }); /** * Mode namespace. */ var C_mode = C.mode = {}; /** * Abstract base block cipher mode template. */ var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ /** * Creates this mode for encryption. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @static * * @example * * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); */ createEncryptor: function (cipher, iv) { return this.Encryptor.create(cipher, iv); }, /** * Creates this mode for decryption. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @static * * @example * * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); */ createDecryptor: function (cipher, iv) { return this.Decryptor.create(cipher, iv); }, /** * Initializes a newly created mode. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @example * * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); */ init: function (cipher, iv) { this._cipher = cipher; this._iv = iv; } }); /** * Cipher Block Chaining mode. */ var CBC = C_mode.CBC = (function () { /** * Abstract base CBC mode. */ var CBC = BlockCipherMode.extend(); /** * CBC encryptor. */ CBC.Encryptor = CBC.extend({ /** * Processes the data block at offset. * * @param {Array} words The data words to operate on. * @param {number} offset The offset where the block starts. * * @example * * mode.processBlock(data.words, offset); */ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // XOR and encrypt xorBlock.call(this, words, offset, blockSize); cipher.encryptBlock(words, offset); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); /** * CBC decryptor. */ CBC.Decryptor = CBC.extend({ /** * Processes the data block at offset. * * @param {Array} words The data words to operate on. * @param {number} offset The offset where the block starts. * * @example * * mode.processBlock(data.words, offset); */ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR cipher.decryptBlock(words, offset); xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block this._prevBlock = thisBlock; } }); function xorBlock(words, offset, blockSize) { // Shortcut var iv = this._iv; // Choose mixing block if (iv) { var block = iv; // Remove IV for subsequent blocks this._iv = undefined; } else { var block = this._prevBlock; } // XOR blocks for (var i = 0; i < blockSize; i++) { words[offset + i] ^= block[i]; } } return CBC; }()); /** * Padding namespace. */ var C_pad = C.pad = {}; /** * PKCS #5/7 padding strategy. */ var Pkcs7 = C_pad.Pkcs7 = { /** * Pads data using the algorithm defined in PKCS #5/7. * * @param {WordArray} data The data to pad. * @param {number} blockSize The multiple that the data should be padded to. * * @static * * @example * * CryptoJS.pad.Pkcs7.pad(wordArray, 4); */ pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; // Create padding var paddingWords = []; for (var i = 0; i < nPaddingBytes; i += 4) { paddingWords.push(paddingWord); } var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding data.concat(padding); }, /** * Unpads data that had been padded using the algorithm defined in PKCS #5/7. * * @param {WordArray} data The data to unpad. * * @static * * @example * * CryptoJS.pad.Pkcs7.unpad(wordArray); */ unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; /** * Abstract base block cipher template. * * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) */ var BlockCipher = C_lib.BlockCipher = Cipher.extend({ /** * Configuration options. * * @property {Mode} mode The block mode to use. Default: CBC * @property {Padding} padding The padding strategy to use. Default: Pkcs7 */ cfg: Cipher.cfg.extend({ mode: CBC, padding: Pkcs7 }), reset: function () { // Reset cipher Cipher.reset.call(this); // Shortcuts var cfg = this.cfg; var iv = cfg.iv; var mode = cfg.mode; // Reset block mode if (this._xformMode == this._ENC_XFORM_MODE) { var modeCreator = mode.createEncryptor; } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding this._minBufferSize = 1; } if (this._mode && this._mode.__creator == modeCreator) { this._mode.init(this, iv && iv.words); } else { this._mode = modeCreator.call(mode, this, iv && iv.words); this._mode.__creator = modeCreator; } }, _doProcessBlock: function (words, offset) { this._mode.processBlock(words, offset); }, _doFinalize: function () { // Shortcut var padding = this.cfg.padding; // Finalize if (this._xformMode == this._ENC_XFORM_MODE) { // Pad data padding.pad(this._data, this.blockSize); // Process final blocks var finalProcessedBlocks = this._process(!!'flush'); } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { // Process final blocks var finalProcessedBlocks = this._process(!!'flush'); // Unpad data padding.unpad(finalProcessedBlocks); } return finalProcessedBlocks; }, blockSize: 128 / 32 }); /** * A collection of cipher parameters. * * @property {WordArray} ciphertext The raw ciphertext. * @property {WordArray} key The key to this ciphertext. * @property {WordArray} iv The IV used in the ciphering operation. * @property {WordArray} salt The salt used with a key derivation function. * @property {Cipher} algorithm The cipher algorithm. * @property {Mode} mode The block mode used in the ciphering operation. * @property {Padding} padding The padding scheme used in the ciphering operation. * @property {number} blockSize The block size of the cipher. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. */ var CipherParams = C_lib.CipherParams = Base.extend({ /** * Initializes a newly created cipher params object. * * @param {Object} cipherParams An object with any of the possible cipher parameters. * * @example * * var cipherParams = CryptoJS.lib.CipherParams.create({ * ciphertext: ciphertextWordArray, * key: keyWordArray, * iv: ivWordArray, * salt: saltWordArray, * algorithm: CryptoJS.algo.AES, * mode: CryptoJS.mode.CBC, * padding: CryptoJS.pad.PKCS7, * blockSize: 4, * formatter: CryptoJS.format.OpenSSL * }); */ init: function (cipherParams) { this.mixIn(cipherParams); }, /** * Converts this cipher params object to a string. * * @param {Format} formatter (Optional) The formatting strategy to use. * * @return {string} The stringified cipher params. * * @throws Error If neither the formatter nor the default formatter is set. * * @example * * var string = cipherParams + ''; * var string = cipherParams.toString(); * var string = cipherParams.toString(CryptoJS.format.OpenSSL); */ toString: function (formatter) { return (formatter || this.formatter).stringify(this); } }); /** * Format namespace. */ var C_format = C.format = {}; /** * OpenSSL formatting strategy. */ var OpenSSLFormatter = C_format.OpenSSL = { /** * Converts a cipher params object to an OpenSSL-compatible string. * * @param {CipherParams} cipherParams The cipher params object. * * @return {string} The OpenSSL-compatible string. * * @static * * @example * * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); */ stringify: function (cipherParams) { // Shortcuts var ciphertext = cipherParams.ciphertext; var salt = cipherParams.salt; // Format if (salt) { var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); } else { var wordArray = ciphertext; } return wordArray.toString(Base64); }, /** * Converts an OpenSSL-compatible string to a cipher params object. * * @param {string} openSSLStr The OpenSSL-compatible string. * * @return {CipherParams} The cipher params object. * * @static * * @example * * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); */ parse: function (openSSLStr) { // Parse base64 var ciphertext = Base64.parse(openSSLStr); // Shortcut var ciphertextWords = ciphertext.words; // Test for salt if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { // Extract salt var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext ciphertextWords.splice(0, 4); ciphertext.sigBytes -= 16; } return CipherParams.create({ciphertext: ciphertext, salt: salt}); } }; /** * A cipher wrapper that returns ciphertext as a serializable cipher params object. */ var SerializableCipher = C_lib.SerializableCipher = Base.extend({ /** * Configuration options. * * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL */ cfg: Base.extend({ format: OpenSSLFormatter }), /** * Encrypts a message. * * @param {Cipher} cipher The cipher algorithm to use. * @param {WordArray|string} message The message to encrypt. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {CipherParams} A cipher params object. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ encrypt: function (cipher, message, key, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Encrypt var encryptor = cipher.createEncryptor(key, cfg); var ciphertext = encryptor.finalize(message); // Shortcut var cipherCfg = encryptor.cfg; // Create and return serializable cipher params return CipherParams.create({ ciphertext: ciphertext, key: key, iv: cipherCfg.iv, algorithm: cipher, mode: cipherCfg.mode, padding: cipherCfg.padding, blockSize: cipher.blockSize, formatter: cfg.format }); }, /** * Decrypts serialized ciphertext. * * @param {Cipher} cipher The cipher algorithm to use. * @param {CipherParams|string} ciphertext The ciphertext to decrypt. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {WordArray} The plaintext. * * @static * * @example * * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ decrypt: function (cipher, ciphertext, key, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Convert string to CipherParams ciphertext = this._parse(ciphertext, cfg.format); // Decrypt var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); return plaintext; }, /** * Converts serialized ciphertext to CipherParams, * else assumed CipherParams already and returns ciphertext unchanged. * * @param {CipherParams|string} ciphertext The ciphertext. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. * * @return {CipherParams} The unserialized ciphertext. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); */ _parse: function (ciphertext, format) { if (typeof ciphertext == 'string') { return format.parse(ciphertext, this); } else { return ciphertext; } } }); /** * Key derivation function namespace. */ var C_kdf = C.kdf = {}; /** * OpenSSL key derivation function. */ var OpenSSLKdf = C_kdf.OpenSSL = { /** * Derives a key and IV from a password. * * @param {string} password The password to derive from. * @param {number} keySize The size in words of the key to generate. * @param {number} ivSize The size in words of the IV to generate. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. * * @return {CipherParams} A cipher params object with the key, IV, and salt. * * @static * * @example * * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); */ execute: function (password, keySize, ivSize, salt) { // Generate random salt if (!salt) { salt = WordArray.random(64 / 8); } // Derive key and IV var key = EvpKDF.create({keySize: keySize + ivSize}).compute(password, salt); // Separate key and IV var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); key.sigBytes = keySize * 4; // Return params return CipherParams.create({key: key, iv: iv, salt: salt}); } }; /** * A serializable cipher wrapper that derives the key from a password, * and returns ciphertext as a serializable cipher params object. */ var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ /** * Configuration options. * * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL */ cfg: SerializableCipher.cfg.extend({ kdf: OpenSSLKdf }), /** * Encrypts a message using a password. * * @param {Cipher} cipher The cipher algorithm to use. * @param {WordArray|string} message The message to encrypt. * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {CipherParams} A cipher params object. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); */ encrypt: function (cipher, message, password, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Derive key and other params var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config cfg.iv = derivedParams.iv; // Encrypt var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params ciphertext.mixIn(derivedParams); return ciphertext; }, /** * Decrypts serialized ciphertext using a password. * * @param {Cipher} cipher The cipher algorithm to use. * @param {CipherParams|string} ciphertext The ciphertext to decrypt. * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {WordArray} The plaintext. * * @static * * @example * * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); */ decrypt: function (cipher, ciphertext, password, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Convert string to CipherParams ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config cfg.iv = derivedParams.iv; // Decrypt var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); return plaintext; } }); }()); /** * Cipher Feedback block mode. */ CryptoJS.mode.CFB = (function () { var CFB = CryptoJS.lib.BlockCipherMode.extend(); CFB.Encryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); CFB.Decryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // This block becomes the previous block this._prevBlock = thisBlock; } }); function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { // Shortcut var iv = this._iv; // Generate keystream if (iv) { var keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } else { var keystream = this._prevBlock; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } return CFB; }()); /** * Electronic Codebook block mode. */ CryptoJS.mode.ECB = (function () { var ECB = CryptoJS.lib.BlockCipherMode.extend(); ECB.Encryptor = ECB.extend({ processBlock: function (words, offset) { this._cipher.encryptBlock(words, offset); } }); ECB.Decryptor = ECB.extend({ processBlock: function (words, offset) { this._cipher.decryptBlock(words, offset); } }); return ECB; }()); /** * ANSI X.923 padding strategy. */ CryptoJS.pad.AnsiX923 = { pad: function (data, blockSize) { // Shortcuts var dataSigBytes = data.sigBytes; var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; // Compute last byte position var lastBytePos = dataSigBytes + nPaddingBytes - 1; // Pad data.clamp(); data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); data.sigBytes += nPaddingBytes; }, unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; /** * ISO 10126 padding strategy. */ CryptoJS.pad.Iso10126 = { pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Pad data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); }, unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; /** * ISO/IEC 9797-1 Padding Method 2. */ CryptoJS.pad.Iso97971 = { pad: function (data, blockSize) { // Add 0x80 byte data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); // Zero pad the rest CryptoJS.pad.ZeroPadding.pad(data, blockSize); }, unpad: function (data) { // Remove zero padding CryptoJS.pad.ZeroPadding.unpad(data); // Remove one more byte -- the 0x80 byte data.sigBytes--; } }; /** * Output Feedback block mode. */ CryptoJS.mode.OFB = (function () { var OFB = CryptoJS.lib.BlockCipherMode.extend(); var Encryptor = OFB.Encryptor = OFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var keystream = this._keystream; // Generate keystream if (iv) { keystream = this._keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); OFB.Decryptor = Encryptor; return OFB; }()); /** * A noop padding strategy. */ CryptoJS.pad.NoPadding = { pad: function () { }, unpad: function () { } }; (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var CipherParams = C_lib.CipherParams; var C_enc = C.enc; var Hex = C_enc.Hex; var C_format = C.format; var HexFormatter = C_format.Hex = { /** * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. * * @param {CipherParams} cipherParams The cipher params object. * * @return {string} The hexadecimally encoded string. * * @static * * @example * * var hexString = CryptoJS.format.Hex.stringify(cipherParams); */ stringify: function (cipherParams) { return cipherParams.ciphertext.toString(Hex); }, /** * Converts a hexadecimally encoded ciphertext string to a cipher params object. * * @param {string} input The hexadecimally encoded string. * * @return {CipherParams} The cipher params object. * * @static * * @example * * var cipherParams = CryptoJS.format.Hex.parse(hexString); */ parse: function (input) { var ciphertext = Hex.parse(input); return CipherParams.create({ciphertext: ciphertext}); } }; }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var BlockCipher = C_lib.BlockCipher; var C_algo = C.algo; // Lookup tables var SBOX = []; var INV_SBOX = []; var SUB_MIX_0 = []; var SUB_MIX_1 = []; var SUB_MIX_2 = []; var SUB_MIX_3 = []; var INV_SUB_MIX_0 = []; var INV_SUB_MIX_1 = []; var INV_SUB_MIX_2 = []; var INV_SUB_MIX_3 = []; // Compute lookup tables (function () { // Compute double table var d = []; for (var i = 0; i < 256; i++) { if (i < 128) { d[i] = i << 1; } else { d[i] = (i << 1) ^ 0x11b; } } // Walk GF(2^8) var x = 0; var xi = 0; for (var i = 0; i < 256; i++) { // Compute sbox var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; SBOX[x] = sx; INV_SBOX[sx] = x; // Compute multiplication var x2 = d[x]; var x4 = d[x2]; var x8 = d[x4]; // Compute sub bytes, mix columns tables var t = (d[sx] * 0x101) ^ (sx * 0x1010100); SUB_MIX_0[x] = (t << 24) | (t >>> 8); SUB_MIX_1[x] = (t << 16) | (t >>> 16); SUB_MIX_2[x] = (t << 8) | (t >>> 24); SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); INV_SUB_MIX_3[sx] = t; // Compute next counter if (!x) { x = xi = 1; } else { x = x2 ^ d[d[d[x8 ^ x2]]]; xi ^= d[d[xi]]; } } }()); // Precomputed Rcon lookup var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; /** * AES block cipher algorithm. */ var AES = C_algo.AES = BlockCipher.extend({ _doReset: function () { // Skip reset of nRounds has been set before and key did not change if (this._nRounds && this._keyPriorReset === this._key) { return; } // Shortcuts var key = this._keyPriorReset = this._key; var keyWords = key.words; var keySize = key.sigBytes / 4; // Compute number of rounds var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows var ksRows = (nRounds + 1) * 4; // Compute key schedule var keySchedule = this._keySchedule = []; for (var ksRow = 0; ksRow < ksRows; ksRow++) { if (ksRow < keySize) { keySchedule[ksRow] = keyWords[ksRow]; } else { var t = keySchedule[ksRow - 1]; if (!(ksRow % keySize)) { // Rot word t = (t << 8) | (t >>> 24); // Sub word t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; // Mix Rcon t ^= RCON[(ksRow / keySize) | 0] << 24; } else if (keySize > 6 && ksRow % keySize == 4) { // Sub word t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; } keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; } } // Compute inv key schedule var invKeySchedule = this._invKeySchedule = []; for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { var ksRow = ksRows - invKsRow; if (invKsRow % 4) { var t = keySchedule[ksRow]; } else { var t = keySchedule[ksRow - 4]; } if (invKsRow < 4 || ksRow <= 4) { invKeySchedule[invKsRow] = t; } else { invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; } } }, encryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); }, decryptBlock: function (M, offset) { // Swap 2nd and 4th rows var t = M[offset + 1]; M[offset + 1] = M[offset + 3]; M[offset + 3] = t; this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows var t = M[offset + 1]; M[offset + 1] = M[offset + 3]; M[offset + 3] = t; }, _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { // Shortcut var nRounds = this._nRounds; // Get input, add round key var s0 = M[offset] ^ keySchedule[0]; var s1 = M[offset + 1] ^ keySchedule[1]; var s2 = M[offset + 2] ^ keySchedule[2]; var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter var ksRow = 4; // Rounds for (var round = 1; round < nRounds; round++) { // Shift rows, sub bytes, mix columns, add round key var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state s0 = t0; s1 = t1; s2 = t2; s3 = t3; } // Shift rows, sub bytes, add round key var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output M[offset] = t0; M[offset + 1] = t1; M[offset + 2] = t2; M[offset + 3] = t3; }, keySize: 256 / 32 }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); */ C.AES = BlockCipher._createHelper(AES); }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var BlockCipher = C_lib.BlockCipher; var C_algo = C.algo; // Permuted Choice 1 constants var PC1 = [ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 ]; // Permuted Choice 2 constants var PC2 = [ 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 ]; // Cumulative bit shift constants var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; // SBOXes and round permutation constants var SBOX_P = [ { 0x0: 0x808200, 0x10000000: 0x8000, 0x20000000: 0x808002, 0x30000000: 0x2, 0x40000000: 0x200, 0x50000000: 0x808202, 0x60000000: 0x800202, 0x70000000: 0x800000, 0x80000000: 0x202, 0x90000000: 0x800200, 0xa0000000: 0x8200, 0xb0000000: 0x808000, 0xc0000000: 0x8002, 0xd0000000: 0x800002, 0xe0000000: 0x0, 0xf0000000: 0x8202, 0x8000000: 0x0, 0x18000000: 0x808202, 0x28000000: 0x8202, 0x38000000: 0x8000, 0x48000000: 0x808200, 0x58000000: 0x200, 0x68000000: 0x808002, 0x78000000: 0x2, 0x88000000: 0x800200, 0x98000000: 0x8200, 0xa8000000: 0x808000, 0xb8000000: 0x800202, 0xc8000000: 0x800002, 0xd8000000: 0x8002, 0xe8000000: 0x202, 0xf8000000: 0x800000, 0x1: 0x8000, 0x10000001: 0x2, 0x20000001: 0x808200, 0x30000001: 0x800000, 0x40000001: 0x808002, 0x50000001: 0x8200, 0x60000001: 0x200, 0x70000001: 0x800202, 0x80000001: 0x808202, 0x90000001: 0x808000, 0xa0000001: 0x800002, 0xb0000001: 0x8202, 0xc0000001: 0x202, 0xd0000001: 0x800200, 0xe0000001: 0x8002, 0xf0000001: 0x0, 0x8000001: 0x808202, 0x18000001: 0x808000, 0x28000001: 0x800000, 0x38000001: 0x200, 0x48000001: 0x8000, 0x58000001: 0x800002, 0x68000001: 0x2, 0x78000001: 0x8202, 0x88000001: 0x8002, 0x98000001: 0x800202, 0xa8000001: 0x202, 0xb8000001: 0x808200, 0xc8000001: 0x800200, 0xd8000001: 0x0, 0xe8000001: 0x8200, 0xf8000001: 0x808002 }, { 0x0: 0x40084010, 0x1000000: 0x4000, 0x2000000: 0x80000, 0x3000000: 0x40080010, 0x4000000: 0x40000010, 0x5000000: 0x40084000, 0x6000000: 0x40004000, 0x7000000: 0x10, 0x8000000: 0x84000, 0x9000000: 0x40004010, 0xa000000: 0x40000000, 0xb000000: 0x84010, 0xc000000: 0x80010, 0xd000000: 0x0, 0xe000000: 0x4010, 0xf000000: 0x40080000, 0x800000: 0x40004000, 0x1800000: 0x84010, 0x2800000: 0x10, 0x3800000: 0x40004010, 0x4800000: 0x40084010, 0x5800000: 0x40000000, 0x6800000: 0x80000, 0x7800000: 0x40080010, 0x8800000: 0x80010, 0x9800000: 0x0, 0xa800000: 0x4000, 0xb800000: 0x40080000, 0xc800000: 0x40000010, 0xd800000: 0x84000, 0xe800000: 0x40084000, 0xf800000: 0x4010, 0x10000000: 0x0, 0x11000000: 0x40080010, 0x12000000: 0x40004010, 0x13000000: 0x40084000, 0x14000000: 0x40080000, 0x15000000: 0x10, 0x16000000: 0x84010, 0x17000000: 0x4000, 0x18000000: 0x4010, 0x19000000: 0x80000, 0x1a000000: 0x80010, 0x1b000000: 0x40000010, 0x1c000000: 0x84000, 0x1d000000: 0x40004000, 0x1e000000: 0x40000000, 0x1f000000: 0x40084010, 0x10800000: 0x84010, 0x11800000: 0x80000, 0x12800000: 0x40080000, 0x13800000: 0x4000, 0x14800000: 0x40004000, 0x15800000: 0x40084010, 0x16800000: 0x10, 0x17800000: 0x40000000, 0x18800000: 0x40084000, 0x19800000: 0x40000010, 0x1a800000: 0x40004010, 0x1b800000: 0x80010, 0x1c800000: 0x0, 0x1d800000: 0x4010, 0x1e800000: 0x40080010, 0x1f800000: 0x84000 }, { 0x0: 0x104, 0x100000: 0x0, 0x200000: 0x4000100, 0x300000: 0x10104, 0x400000: 0x10004, 0x500000: 0x4000004, 0x600000: 0x4010104, 0x700000: 0x4010000, 0x800000: 0x4000000, 0x900000: 0x4010100, 0xa00000: 0x10100, 0xb00000: 0x4010004, 0xc00000: 0x4000104, 0xd00000: 0x10000, 0xe00000: 0x4, 0xf00000: 0x100, 0x80000: 0x4010100, 0x180000: 0x4010004, 0x280000: 0x0, 0x380000: 0x4000100, 0x480000: 0x4000004, 0x580000: 0x10000, 0x680000: 0x10004, 0x780000: 0x104, 0x880000: 0x4, 0x980000: 0x100, 0xa80000: 0x4010000, 0xb80000: 0x10104, 0xc80000: 0x10100, 0xd80000: 0x4000104, 0xe80000: 0x4010104, 0xf80000: 0x4000000, 0x1000000: 0x4010100, 0x1100000: 0x10004, 0x1200000: 0x10000, 0x1300000: 0x4000100, 0x1400000: 0x100, 0x1500000: 0x4010104, 0x1600000: 0x4000004, 0x1700000: 0x0, 0x1800000: 0x4000104, 0x1900000: 0x4000000, 0x1a00000: 0x4, 0x1b00000: 0x10100, 0x1c00000: 0x4010000, 0x1d00000: 0x104, 0x1e00000: 0x10104, 0x1f00000: 0x4010004, 0x1080000: 0x4000000, 0x1180000: 0x104, 0x1280000: 0x4010100, 0x1380000: 0x0, 0x1480000: 0x10004, 0x1580000: 0x4000100, 0x1680000: 0x100, 0x1780000: 0x4010004, 0x1880000: 0x10000, 0x1980000: 0x4010104, 0x1a80000: 0x10104, 0x1b80000: 0x4000004, 0x1c80000: 0x4000104, 0x1d80000: 0x4010000, 0x1e80000: 0x4, 0x1f80000: 0x10100 }, { 0x0: 0x80401000, 0x10000: 0x80001040, 0x20000: 0x401040, 0x30000: 0x80400000, 0x40000: 0x0, 0x50000: 0x401000, 0x60000: 0x80000040, 0x70000: 0x400040, 0x80000: 0x80000000, 0x90000: 0x400000, 0xa0000: 0x40, 0xb0000: 0x80001000, 0xc0000: 0x80400040, 0xd0000: 0x1040, 0xe0000: 0x1000, 0xf0000: 0x80401040, 0x8000: 0x80001040, 0x18000: 0x40, 0x28000: 0x80400040, 0x38000: 0x80001000, 0x48000: 0x401000, 0x58000: 0x80401040, 0x68000: 0x0, 0x78000: 0x80400000, 0x88000: 0x1000, 0x98000: 0x80401000, 0xa8000: 0x400000, 0xb8000: 0x1040, 0xc8000: 0x80000000, 0xd8000: 0x400040, 0xe8000: 0x401040, 0xf8000: 0x80000040, 0x100000: 0x400040, 0x110000: 0x401000, 0x120000: 0x80000040, 0x130000: 0x0, 0x140000: 0x1040, 0x150000: 0x80400040, 0x160000: 0x80401000, 0x170000: 0x80001040, 0x180000: 0x80401040, 0x190000: 0x80000000, 0x1a0000: 0x80400000, 0x1b0000: 0x401040, 0x1c0000: 0x80001000, 0x1d0000: 0x400000, 0x1e0000: 0x40, 0x1f0000: 0x1000, 0x108000: 0x80400000, 0x118000: 0x80401040, 0x128000: 0x0, 0x138000: 0x401000, 0x148000: 0x400040, 0x158000: 0x80000000, 0x168000: 0x80001040, 0x178000: 0x40, 0x188000: 0x80000040, 0x198000: 0x1000, 0x1a8000: 0x80001000, 0x1b8000: 0x80400040, 0x1c8000: 0x1040, 0x1d8000: 0x80401000, 0x1e8000: 0x400000, 0x1f8000: 0x401040 }, { 0x0: 0x80, 0x1000: 0x1040000, 0x2000: 0x40000, 0x3000: 0x20000000, 0x4000: 0x20040080, 0x5000: 0x1000080, 0x6000: 0x21000080, 0x7000: 0x40080, 0x8000: 0x1000000, 0x9000: 0x20040000, 0xa000: 0x20000080, 0xb000: 0x21040080, 0xc000: 0x21040000, 0xd000: 0x0, 0xe000: 0x1040080, 0xf000: 0x21000000, 0x800: 0x1040080, 0x1800: 0x21000080, 0x2800: 0x80, 0x3800: 0x1040000, 0x4800: 0x40000, 0x5800: 0x20040080, 0x6800: 0x21040000, 0x7800: 0x20000000, 0x8800: 0x20040000, 0x9800: 0x0, 0xa800: 0x21040080, 0xb800: 0x1000080, 0xc800: 0x20000080, 0xd800: 0x21000000, 0xe800: 0x1000000, 0xf800: 0x40080, 0x10000: 0x40000, 0x11000: 0x80, 0x12000: 0x20000000, 0x13000: 0x21000080, 0x14000: 0x1000080, 0x15000: 0x21040000, 0x16000: 0x20040080, 0x17000: 0x1000000, 0x18000: 0x21040080, 0x19000: 0x21000000, 0x1a000: 0x1040000, 0x1b000: 0x20040000, 0x1c000: 0x40080, 0x1d000: 0x20000080, 0x1e000: 0x0, 0x1f000: 0x1040080, 0x10800: 0x21000080, 0x11800: 0x1000000, 0x12800: 0x1040000, 0x13800: 0x20040080, 0x14800: 0x20000000, 0x15800: 0x1040080, 0x16800: 0x80, 0x17800: 0x21040000, 0x18800: 0x40080, 0x19800: 0x21040080, 0x1a800: 0x0, 0x1b800: 0x21000000, 0x1c800: 0x1000080, 0x1d800: 0x40000, 0x1e800: 0x20040000, 0x1f800: 0x20000080 }, { 0x0: 0x10000008, 0x100: 0x2000, 0x200: 0x10200000, 0x300: 0x10202008, 0x400: 0x10002000, 0x500: 0x200000, 0x600: 0x200008, 0x700: 0x10000000, 0x800: 0x0, 0x900: 0x10002008, 0xa00: 0x202000, 0xb00: 0x8, 0xc00: 0x10200008, 0xd00: 0x202008, 0xe00: 0x2008, 0xf00: 0x10202000, 0x80: 0x10200000, 0x180: 0x10202008, 0x280: 0x8, 0x380: 0x200000, 0x480: 0x202008, 0x580: 0x10000008, 0x680: 0x10002000, 0x780: 0x2008, 0x880: 0x200008, 0x980: 0x2000, 0xa80: 0x10002008, 0xb80: 0x10200008, 0xc80: 0x0, 0xd80: 0x10202000, 0xe80: 0x202000, 0xf80: 0x10000000, 0x1000: 0x10002000, 0x1100: 0x10200008, 0x1200: 0x10202008, 0x1300: 0x2008, 0x1400: 0x200000, 0x1500: 0x10000000, 0x1600: 0x10000008, 0x1700: 0x202000, 0x1800: 0x202008, 0x1900: 0x0, 0x1a00: 0x8, 0x1b00: 0x10200000, 0x1c00: 0x2000, 0x1d00: 0x10002008, 0x1e00: 0x10202000, 0x1f00: 0x200008, 0x1080: 0x8, 0x1180: 0x202000, 0x1280: 0x200000, 0x1380: 0x10000008, 0x1480: 0x10002000, 0x1580: 0x2008, 0x1680: 0x10202008, 0x1780: 0x10200000, 0x1880: 0x10202000, 0x1980: 0x10200008, 0x1a80: 0x2000, 0x1b80: 0x202008, 0x1c80: 0x200008, 0x1d80: 0x0, 0x1e80: 0x10000000, 0x1f80: 0x10002008 }, { 0x0: 0x100000, 0x10: 0x2000401, 0x20: 0x400, 0x30: 0x100401, 0x40: 0x2100401, 0x50: 0x0, 0x60: 0x1, 0x70: 0x2100001, 0x80: 0x2000400, 0x90: 0x100001, 0xa0: 0x2000001, 0xb0: 0x2100400, 0xc0: 0x2100000, 0xd0: 0x401, 0xe0: 0x100400, 0xf0: 0x2000000, 0x8: 0x2100001, 0x18: 0x0, 0x28: 0x2000401, 0x38: 0x2100400, 0x48: 0x100000, 0x58: 0x2000001, 0x68: 0x2000000, 0x78: 0x401, 0x88: 0x100401, 0x98: 0x2000400, 0xa8: 0x2100000, 0xb8: 0x100001, 0xc8: 0x400, 0xd8: 0x2100401, 0xe8: 0x1, 0xf8: 0x100400, 0x100: 0x2000000, 0x110: 0x100000, 0x120: 0x2000401, 0x130: 0x2100001, 0x140: 0x100001, 0x150: 0x2000400, 0x160: 0x2100400, 0x170: 0x100401, 0x180: 0x401, 0x190: 0x2100401, 0x1a0: 0x100400, 0x1b0: 0x1, 0x1c0: 0x0, 0x1d0: 0x2100000, 0x1e0: 0x2000001, 0x1f0: 0x400, 0x108: 0x100400, 0x118: 0x2000401, 0x128: 0x2100001, 0x138: 0x1, 0x148: 0x2000000, 0x158: 0x100000, 0x168: 0x401, 0x178: 0x2100400, 0x188: 0x2000001, 0x198: 0x2100000, 0x1a8: 0x0, 0x1b8: 0x2100401, 0x1c8: 0x100401, 0x1d8: 0x400, 0x1e8: 0x2000400, 0x1f8: 0x100001 }, { 0x0: 0x8000820, 0x1: 0x20000, 0x2: 0x8000000, 0x3: 0x20, 0x4: 0x20020, 0x5: 0x8020820, 0x6: 0x8020800, 0x7: 0x800, 0x8: 0x8020000, 0x9: 0x8000800, 0xa: 0x20800, 0xb: 0x8020020, 0xc: 0x820, 0xd: 0x0, 0xe: 0x8000020, 0xf: 0x20820, 0x80000000: 0x800, 0x80000001: 0x8020820, 0x80000002: 0x8000820, 0x80000003: 0x8000000, 0x80000004: 0x8020000, 0x80000005: 0x20800, 0x80000006: 0x20820, 0x80000007: 0x20, 0x80000008: 0x8000020, 0x80000009: 0x820, 0x8000000a: 0x20020, 0x8000000b: 0x8020800, 0x8000000c: 0x0, 0x8000000d: 0x8020020, 0x8000000e: 0x8000800, 0x8000000f: 0x20000, 0x10: 0x20820, 0x11: 0x8020800, 0x12: 0x20, 0x13: 0x800, 0x14: 0x8000800, 0x15: 0x8000020, 0x16: 0x8020020, 0x17: 0x20000, 0x18: 0x0, 0x19: 0x20020, 0x1a: 0x8020000, 0x1b: 0x8000820, 0x1c: 0x8020820, 0x1d: 0x20800, 0x1e: 0x820, 0x1f: 0x8000000, 0x80000010: 0x20000, 0x80000011: 0x800, 0x80000012: 0x8020020, 0x80000013: 0x20820, 0x80000014: 0x20, 0x80000015: 0x8020000, 0x80000016: 0x8000000, 0x80000017: 0x8000820, 0x80000018: 0x8020820, 0x80000019: 0x8000020, 0x8000001a: 0x8000800, 0x8000001b: 0x0, 0x8000001c: 0x20800, 0x8000001d: 0x820, 0x8000001e: 0x20020, 0x8000001f: 0x8020800 } ]; // Masks that select the SBOX input var SBOX_MASK = [ 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f ]; /** * DES block cipher algorithm. */ var DES = C_algo.DES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; // Select 56 bits according to PC1 var keyBits = []; for (var i = 0; i < 56; i++) { var keyBitPos = PC1[i] - 1; keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; } // Assemble 16 subkeys var subKeys = this._subKeys = []; for (var nSubKey = 0; nSubKey < 16; nSubKey++) { // Create subkey var subKey = subKeys[nSubKey] = []; // Shortcut var bitShift = BIT_SHIFTS[nSubKey]; // Select 48 bits according to PC2 for (var i = 0; i < 24; i++) { // Select from the left 28 key bits subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); // Select from the right 28 key bits subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); } // Since each subkey is applied to an expanded 32-bit input, // the subkey can be broken into 8 values scaled to 32-bits, // which allows the key to be used without expansion subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); for (var i = 1; i < 7; i++) { subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); } subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); } // Compute inverse subkeys var invSubKeys = this._invSubKeys = []; for (var i = 0; i < 16; i++) { invSubKeys[i] = subKeys[15 - i]; } }, encryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._subKeys); }, decryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._invSubKeys); }, _doCryptBlock: function (M, offset, subKeys) { // Get input this._lBlock = M[offset]; this._rBlock = M[offset + 1]; // Initial permutation exchangeLR.call(this, 4, 0x0f0f0f0f); exchangeLR.call(this, 16, 0x0000ffff); exchangeRL.call(this, 2, 0x33333333); exchangeRL.call(this, 8, 0x00ff00ff); exchangeLR.call(this, 1, 0x55555555); // Rounds for (var round = 0; round < 16; round++) { // Shortcuts var subKey = subKeys[round]; var lBlock = this._lBlock; var rBlock = this._rBlock; // Feistel function var f = 0; for (var i = 0; i < 8; i++) { f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; } this._lBlock = rBlock; this._rBlock = lBlock ^ f; } // Undo swap from last round var t = this._lBlock; this._lBlock = this._rBlock; this._rBlock = t; // Final permutation exchangeLR.call(this, 1, 0x55555555); exchangeRL.call(this, 8, 0x00ff00ff); exchangeRL.call(this, 2, 0x33333333); exchangeLR.call(this, 16, 0x0000ffff); exchangeLR.call(this, 4, 0x0f0f0f0f); // Set output M[offset] = this._lBlock; M[offset + 1] = this._rBlock; }, keySize: 64 / 32, ivSize: 64 / 32, blockSize: 64 / 32 }); // Swap bits across the left and right words function exchangeLR(offset, mask) { var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; this._rBlock ^= t; this._lBlock ^= t << offset; } function exchangeRL(offset, mask) { var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; this._lBlock ^= t; this._rBlock ^= t << offset; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); */ C.DES = BlockCipher._createHelper(DES); /** * Triple-DES block cipher algorithm. */ var TripleDES = C_algo.TripleDES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; // Create DES instances this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2))); this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4))); this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6))); }, encryptBlock: function (M, offset) { this._des1.encryptBlock(M, offset); this._des2.decryptBlock(M, offset); this._des3.encryptBlock(M, offset); }, decryptBlock: function (M, offset) { this._des3.decryptBlock(M, offset); this._des2.encryptBlock(M, offset); this._des1.decryptBlock(M, offset); }, keySize: 192 / 32, ivSize: 64 / 32, blockSize: 64 / 32 }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); */ C.TripleDES = BlockCipher._createHelper(TripleDES); }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; /** * RC4 stream cipher algorithm. */ var RC4 = C_algo.RC4 = StreamCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; var keySigBytes = key.sigBytes; // Init sbox var S = this._S = []; for (var i = 0; i < 256; i++) { S[i] = i; } // Key setup for (var i = 0, j = 0; i < 256; i++) { var keyByteIndex = i % keySigBytes; var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; j = (j + S[i] + keyByte) % 256; // Swap var t = S[i]; S[i] = S[j]; S[j] = t; } // Counters this._i = this._j = 0; }, _doProcessBlock: function (M, offset) { M[offset] ^= generateKeystreamWord.call(this); }, keySize: 256 / 32, ivSize: 0 }); function generateKeystreamWord() { // Shortcuts var S = this._S; var i = this._i; var j = this._j; // Generate keystream word var keystreamWord = 0; for (var n = 0; n < 4; n++) { i = (i + 1) % 256; j = (j + S[i]) % 256; // Swap var t = S[i]; S[i] = S[j]; S[j] = t; keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); } // Update counters this._i = i; this._j = j; return keystreamWord; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); */ C.RC4 = StreamCipher._createHelper(RC4); /** * Modified RC4 stream cipher algorithm. */ var RC4Drop = C_algo.RC4Drop = RC4.extend({ /** * Configuration options. * * @property {number} drop The number of keystream words to drop. Default 192 */ cfg: RC4.cfg.extend({ drop: 192 }), _doReset: function () { RC4._doReset.call(this); // Drop for (var i = this.cfg.drop; i > 0; i--) { generateKeystreamWord.call(this); } } }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); */ C.RC4Drop = StreamCipher._createHelper(RC4Drop); }()); /** @preserve * Counter block mode compatible with Dr Brian Gladman fileenc.c * derived from CryptoJS.mode.CTR * Jan Hruby jhruby.web@gmail.com */ CryptoJS.mode.CTRGladman = (function () { var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); function incWord(word) { if (((word >> 24) & 0xff) === 0xff) { //overflow var b1 = (word >> 16) & 0xff; var b2 = (word >> 8) & 0xff; var b3 = word & 0xff; if (b1 === 0xff) // overflow b1 { b1 = 0; if (b2 === 0xff) { b2 = 0; if (b3 === 0xff) { b3 = 0; } else { ++b3; } } else { ++b2; } } else { ++b1; } word = 0; word += (b1 << 16); word += (b2 << 8); word += b3; } else { word += (0x01 << 24); } return word; } function incCounter(counter) { if ((counter[0] = incWord(counter[0])) === 0) { // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 counter[1] = incWord(counter[1]); } return counter; } var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var counter = this._counter; // Generate keystream if (iv) { counter = this._counter = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } incCounter(counter); var keystream = counter.slice(0); cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); CTRGladman.Decryptor = Encryptor; return CTRGladman; }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; // Reusable objects var S = []; var C_ = []; var G = []; /** * Rabbit stream cipher algorithm */ var Rabbit = C_algo.Rabbit = StreamCipher.extend({ _doReset: function () { // Shortcuts var K = this._key.words; var iv = this.cfg.iv; // Swap endian for (var i = 0; i < 4; i++) { K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); } // Generate initial state values var X = this._X = [ K[0], (K[3] << 16) | (K[2] >>> 16), K[1], (K[0] << 16) | (K[3] >>> 16), K[2], (K[1] << 16) | (K[0] >>> 16), K[3], (K[2] << 16) | (K[1] >>> 16) ]; // Generate initial counter values var C = this._C = [ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) ]; // Carry bit this._b = 0; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } // Modify the counters for (var i = 0; i < 8; i++) { C[i] ^= X[(i + 4) & 7]; } // IV setup if (iv) { // Shortcuts var IV = iv.words; var IV_0 = IV[0]; var IV_1 = IV[1]; // Generate four subvectors var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); var i1 = (i0 >>> 16) | (i2 & 0xffff0000); var i3 = (i2 << 16) | (i0 & 0x0000ffff); // Modify counter values C[0] ^= i0; C[1] ^= i1; C[2] ^= i2; C[3] ^= i3; C[4] ^= i0; C[5] ^= i1; C[6] ^= i2; C[7] ^= i3; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } } }, _doProcessBlock: function (M, offset) { // Shortcut var X = this._X; // Iterate the system nextState.call(this); // Generate four keystream words S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); for (var i = 0; i < 4; i++) { // Swap endian S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); // Encrypt M[offset + i] ^= S[i]; } }, blockSize: 128 / 32, ivSize: 64 / 32 }); function nextState() { // Shortcuts var X = this._X; var C = this._C; // Save old counter values for (var i = 0; i < 8; i++) { C_[i] = C[i]; } // Calculate new counter values C[0] = (C[0] + 0x4d34d34d + this._b) | 0; C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; // Calculate the g-values for (var i = 0; i < 8; i++) { var gx = X[i] + C[i]; // Construct high and low argument for squaring var ga = gx & 0xffff; var gb = gx >>> 16; // Calculate high and low result of squaring var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); // High XOR low G[i] = gh ^ gl; } // Calculate new state values X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); */ C.Rabbit = StreamCipher._createHelper(Rabbit); }()); /** * Counter block mode. */ CryptoJS.mode.CTR = (function () { var CTR = CryptoJS.lib.BlockCipherMode.extend(); var Encryptor = CTR.Encryptor = CTR.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var counter = this._counter; // Generate keystream if (iv) { counter = this._counter = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } var keystream = counter.slice(0); cipher.encryptBlock(keystream, 0); // Increment counter counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); CTR.Decryptor = Encryptor; return CTR; }()); (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; // Reusable objects var S = []; var C_ = []; var G = []; /** * Rabbit stream cipher algorithm. * * This is a legacy version that neglected to convert the key to little-endian. * This error doesn't affect the cipher's security, * but it does affect its compatibility with other implementations. */ var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ _doReset: function () { // Shortcuts var K = this._key.words; var iv = this.cfg.iv; // Generate initial state values var X = this._X = [ K[0], (K[3] << 16) | (K[2] >>> 16), K[1], (K[0] << 16) | (K[3] >>> 16), K[2], (K[1] << 16) | (K[0] >>> 16), K[3], (K[2] << 16) | (K[1] >>> 16) ]; // Generate initial counter values var C = this._C = [ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) ]; // Carry bit this._b = 0; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } // Modify the counters for (var i = 0; i < 8; i++) { C[i] ^= X[(i + 4) & 7]; } // IV setup if (iv) { // Shortcuts var IV = iv.words; var IV_0 = IV[0]; var IV_1 = IV[1]; // Generate four subvectors var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); var i1 = (i0 >>> 16) | (i2 & 0xffff0000); var i3 = (i2 << 16) | (i0 & 0x0000ffff); // Modify counter values C[0] ^= i0; C[1] ^= i1; C[2] ^= i2; C[3] ^= i3; C[4] ^= i0; C[5] ^= i1; C[6] ^= i2; C[7] ^= i3; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } } }, _doProcessBlock: function (M, offset) { // Shortcut var X = this._X; // Iterate the system nextState.call(this); // Generate four keystream words S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); for (var i = 0; i < 4; i++) { // Swap endian S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); // Encrypt M[offset + i] ^= S[i]; } }, blockSize: 128 / 32, ivSize: 64 / 32 }); function nextState() { // Shortcuts var X = this._X; var C = this._C; // Save old counter values for (var i = 0; i < 8; i++) { C_[i] = C[i]; } // Calculate new counter values C[0] = (C[0] + 0x4d34d34d + this._b) | 0; C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; // Calculate the g-values for (var i = 0; i < 8; i++) { var gx = X[i] + C[i]; // Construct high and low argument for squaring var ga = gx & 0xffff; var gb = gx >>> 16; // Calculate high and low result of squaring var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); // High XOR low G[i] = gh ^ gl; } // Calculate new state values X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); */ C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); }()); /** * Zero padding strategy. */ CryptoJS.pad.ZeroPadding = { pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Pad data.clamp(); data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); }, unpad: function (data) { // Shortcut var dataWords = data.words; // Unpad var i = data.sigBytes - 1; while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { i--; } data.sigBytes = i + 1; } }; return CryptoJS; })); function getResCode1() { var encrypted = CryptoJS.AES.encrypt( CryptoJS.enc.Utf8.parse(Math.floor(new Date().getTime() / 1000).toString()), CryptoJS.enc.Utf8.parse('1234567887654321'), { iv: CryptoJS.enc.Utf8.parse('1234567887654321'), mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 } ); return CryptoJS.enc.Base64.stringify(encrypted.ciphertext); } function my_decode(data) { var encrypted = CryptoJS.AES.decrypt( data, CryptoJS.enc.Utf8.parse('h5.jiucaishuo.comaaaaaaaaaaaaaaa'), { iv: CryptoJS.enc.Utf8.parse('h5.jiucaishuo.com'), mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 } ); return encrypted.toString(CryptoJS.enc.Utf8); } function new_my_decode(data) { let key = CryptoJS.enc.Utf8.parse('bieyanjiulexixishuibatoufameill1'); // 密钥需要是32字节,这里可能需要调整 let iv = CryptoJS.enc.Utf8.parse('nengnongchulainbl1'); // 向量通常是16字节 let decrypted = CryptoJS.AES.decrypt( data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 } ); return decrypted.toString(CryptoJS.enc.Utf8); } ================================================ FILE: akshare/data/ths.js ================================================ var TOKEN_SERVER_TIME = 1572845499.629; function v_cookie (r, n, t, e, a) { var u = n[0], c = n[1], v = a[0], s = t[0], f = t[1], l = r[0], d = hr(a[1], e[0], t[2]), p = t[3], h = e[1], g = yr(a[2], a[3], e[2]), m = yr(a[4], r[1], t[4]), w = r[2], I = a[5], _ = a[6], y = a[7], E = hr(n[2], r[3], r[4]), A = t[5], C = e[3], b = e[4], B = t[6], R = a[8], T = a[9], S = n[3], k = t[7], x = t[8], O = a[10], L = n[4], M = n[5], N = a[11], P = e[5], j = hr(n[6], e[6], t[9], r[5]), D = t[10], W = e[7], $ = r[6], F = yr(r[7], t[11], e[8], n[7]), X = r[8], H = t[12], K = r[9], U = n[8], V = e[9], Y = r[10], J = e[10], q = r[11], Q = a[12], Z = n[9], G = t[13], z = t[14], rr = t[15], nr = n[10], tr = a[13], er = a[14], ar = e[11], or = r[12], ir = yr(t[16], r[13], r[14], r[15]), ur = t[17], cr = t[18]; function vr () { var r = arguments[n[11]]; return r.split(n[12]).reverse().join(e[12]) } var sr = [new e[13](hr(a[15], n[13], a[16])), new e[13](a[17])]; function fr () { var n = arguments[a[18]]; if (!n) return a[19]; for (var o = t[19], i = e[14], u = e[15]; u < n.length; u++) { var c = n.charCodeAt(u), v = c ^ i; i = c, o += r[16].fromCharCode(v) } return o } var lr = '', dr; ! function (o) { var i = e[18], c = e[19]; o[e[20]] = a[21]; function v (t, a, o, i, u) { var c, v, s; c = v = s = r; var f, l, d; f = l = d = n; var p, h, g; p = h = g = e; var m = t + g[21] + a; i && (m += l[15] + i), u && (m += h[22] + u), o && (m += v[17] + o), l[14][g[23]] = m } o[e[24]] = l; function s (t, e, a) { var o = n[16]; this.setCookie(t, r[18], i + o + c, e, a) } o[t[22]] = f; function f (o) { var i = vr(e[25], a[22]), c = a[23][n[17]], v = u + i + o + t[23], s = ''; if (s == -r[19]) { if (v = o + t[23], c.substr(a[24], v.length) != v) return; s = a[24] } var f = s + v[r[20]], l = ''; return l == -e[26] && (l = c[t[24]]) } o[e[27]] = v; function l () { var r, t, a; r = t = a = e; var i, u, c; i = u = c = n; var v = u[18]; this.setCookie(v, a[28]), this.getCookie(v) || (o[i[19]] = u[20]), this.delCookie(v) } o[n[21]] = s }(dr || (dr = {})); var pr; function hr () { var r = arguments[a[25]]; if (!r) return a[19]; for (var e = a[19], o = t[25], i = n[22], u = t[18]; u < r.length; u++) { var c = r.charCodeAt(u); i = (i + t[26]) % o.length, c ^= o.charCodeAt(i), e += String.fromCharCode(c) } return e } ! function (o) { var i, u, d; i = u = d = a; var p, h, g; p = h = g = t; var m, w, I; m = w = I = r; var _, y, E; _ = y = E = n; var b, B, R; b = B = R = e; var T = B[29], S = y[23], k = m[22], x = w[0], O = E[24], L = (C, Ar, R[30]), M = b[31], N = T + S, P = p[28], j, W = m[23][y[25]], $, F; function X (r) { return function () { F.appendChild(j), j.addBehavior(u[26]), j.load(N); var n = r(); return F.removeChild(j), n } } function H () { var r = A; r = D; try { return !!(N in B[32] && b[32][N]) } catch (n) { return void B[15] } } function K (r) { return P ? G(r) : j ? Y(r) : void _[26] } function U () { if (P = H(), P) j = _[27][N]; else if (W[k + c][I[24]]) try { $ = new ActiveXObject(vr(I[25], y[28], w[26])), $.open(), $.write(y[29]), $.close(), F = $.w[B[33]][I[27]][_[30]], j = F.createElement(I[28]) } catch (r) { j = W.createElement(N), F = W[vr(I[29], d[27])] || W.getElementsByTagName(b[17])[I[27]] || W[m[30]] } } o[w[31]] = U; function V (r, n) { var t = J; if (void 0 === n) return Z(r); if (t = sr, P) z(r, n); else { if (!j) return void B[15]; Q(r, n) } } o[v + x] = V; function Y (r) { X(function () { return r = J(r), j.getAttribute(r) })() } function J (r) { var n = z; n = v; var t = vr(Ir, w[32]), e = new y[31](t + O + s + L, b[31]); return r.replace(new B[13](d[28]), b[34]).replace(e, p[29]) } function q (r) { try { j.removeItem(r) } catch (n) { } } o[M + f + l] = K; function Q (r, n) { var t = G; t = cr, X(function () { var t = M; r = J(r), t = K; try { j.setAttribute(r, n), j.save(N) } catch (e) { } })() } function Z (r) { var n, t, e; if (n = t = e = g, P) q(r); else { if (!j) return void t[18]; rr(r) } } function G (r) { try { return j.getItem(r) } catch (n) { return y[20] } } o[fr(w[33], p[30], R[35])] = Z; function z (r, n) { try { j.setItem(r, n) } catch (t) { } } function rr (r) { X(function () { r = J(r), j.removeAttribute(r), j.save(N) })() } }(pr || (pr = {})); var gr = function () { var o, i, u; o = i = u = e; var c, v, s; c = v = s = a; var f, l, g; f = l = g = n; var m, w, I; m = w = I = t; var _, E, A; _ = E = A = r; var C = yr(Cr, U, _[34]), b = vr(A[35], m[31]), R = hr(g[32], c[29], i[36]), T = hr(l[33], g[34], i[37], tr); function S (r) { this[m[32]] = r; for (var n = o[15], t = r[i[38]]; t > n; n++) this[n] = i[15] } return S[d + p + C][b + h] = function () { for (var r = this[vr(h, E[36], E[37])], n = [], t = -I[26], e = o[15], a = r[A[20]]; a > e; e++) for (var u = this[e], f = r[e], d = t += f; n[d] = u & parseInt(v[30], l[35]), --f != s[24];)--d, u >>= parseInt(i[39], c[31]); return n }, S[vr(w[33], v[32])][_[38]] = function (r) { var n = dr, t = this[vr(y, l[36], A[39])], e = f[26]; n = B; for (var a = v[24], o = t[l[37]]; o > a; a++) { var i = t[a], u = l[26]; do u = (u << parseInt(R + T, g[35])) + r[e++]; while (--i > w[18]); this[a] = u >>> w[18] } }, S }(), mr; ! function (o) { var i, u, c; i = u = c = n; var v, s, f; v = s = f = e; var l, d, p; l = d = p = a; var h, w, I; h = w = I = r; var _, y, E; _ = y = E = t; var A = y[34], C = (nr, U, h[40]), b = p[25]; function B (r) { for (var n = y[35], t = f[15], e = r[vr(c[38], I[41], H)], a = []; e > t;) { var o = k[r.charAt(t++)] << parseInt(g + A, d[31]) | k[r.charAt(t++)] << parseInt(n + m, h[42]) | k[r.charAt(t++)] << parseInt(I[43], i[35]) | k[r.charAt(t++)]; a.push(o >> parseInt(_[36], h[42]), o >> l[31] & parseInt(u[39], i[40]), o & parseInt(d[30], c[35])) } return a } function T (r) { for (var n = (O, R, p[24]), t = I[27], e = r[E[24]]; e > t; t++) n = (n << E[37]) - n + r[t]; return n & parseInt(E[38], p[33]) } for (var S = s[40], k = {}, x = s[15]; x < parseInt(I[44], l[34]); x++) k[S.charAt(x)] = x; function L (r) { var n = B(r), t = n[u[26]]; if (t != b) return error = yr(V, u[41], s[41], v[42]), void 0; var e = n[s[26]], a = []; return P(n, +_[39], a, +_[18], e), T(a) == e ? a : void 0 } function M (r) { var n = T(r), t = [b, n]; return P(r, +l[24], t, +p[25], n), N(t) } function N (r) { var n, t, e; n = t = e = f; var a, o, u; a = o = u = y; var c, v, s; c = v = s = h; var d, p, g; d = p = g = l; var m, w, I; m = w = I = i; for (var _ = m[42], E = d[24], A = r[c[20]], b = []; A > E;) { var B = r[E++] << parseInt(fr(Z, d[35]), o[39]) | r[E++] << g[31] | r[E++]; b.push(S.charAt(B >> parseInt(m[43], t[43])), S.charAt(B >> parseInt(p[36], o[40]) & parseInt(I[44], I[45])), S.charAt(B >> n[44] & parseInt(_ + C, n[42])), S.charAt(B & parseInt(fr(d[37], c[45], or), a[41]))) } return b.join(o[19]) } function P (r, n, t, e, a) { var o, i, u; o = i = u = w; var c, v, s; c = v = s = E; for (var f = r[v[24]]; f > n;) t[e++] = r[n++] ^ a & parseInt(u[46], s[42]), a = ~(a * parseInt(v[43], v[40])) } o[E[44]] = N, o[_[45]] = B, o[v[45]] = M, o[y[46]] = L }(mr || (mr = {})); var wr; ! function (o) { var i = a[38], u = r[47], c = t[47], v = vr(n[46], a[39], a[40]), s = e[46], f = e[47], l = a[41], d = a[42]; function p (o) { var i = a[43], u = vr(n[47], e[48], n[48]), c = {}, v = function (o, c) { var s, f, l, d; for (c = c.replace(n[49], n[12]), c = c.substring(e[26], c[e[38]] - e[26]), s = c.split(e[49]), l = a[24]; l < s[yr(v, sr, t[48])]; l++) if (f = s[l].split(n[50]), f && !(f[a[44]] < t[39])) { for (d = n[35]; d < f[r[20]]; d++) f[n[11]] = f[n[11]] + r[48] + f[d]; f[n[26]] = new a[45](r[49]).test(f[n[26]]) ? f[e[15]].substring(r[19], f[e[15]][a[44]] - n[11]) : f[n[26]], f[n[11]] = new r[50](i + u + w).test(f[n[11]]) ? f[e[26]].substring(t[26], f[r[19]][n[37]] - t[26]) : f[a[18]], o[f[r[27]]] = f[n[11]] } return o }; return new a[45](I + _).test(o) && (c = v(c, o)), c } function h (n) { for (var t = [], e = a[24]; e < n[r[20]]; e++) t.push(n.charCodeAt(e)); return t } function g (o) { var u = a[46]; if (typeof o === vr(O, a[47], or) && o[a[48]]) try { var c = parseInt(o[a[48]]); switch (c) { case parseInt(i + u, t[42]): break; case parseInt(yr(t[49], r[51], e[50]), e[43]): top[t[50]][n[51]] = o[e[51]]; break; case parseInt(yr(a[25], j, e[52]), n[52]): top[n[53]][t[51]] = o[t[52]] } } catch (v) { } } function m (r, n, t) { } function L () { var e, a, o; e = a = o = r; var i, u, c; i = u = c = n; var v, s, f; v = s = f = t; var l = f[53], d = c[54], p = new e[52]; return typeof TOKEN_SERVER_TIME == y + l + d ? s[18] : (time = parseInt(TOKEN_SERVER_TIME), time) } function M () { var o = new t[54]; try { return time = n[2].now(), time / parseInt(fr(a[50], a[51], r[53]), t[40]) >>> e[15] } catch (i) { return time = o.getTime(), time / parseInt(e[53], a[25]) >>> r[27] } } function N (r) { for (var a = t[18], o = r[t[24]] - n[11]; o >= e[15]; o--) a = a << e[26] | +r[o]; return a } function P (a) { var o = new r[50](n[55]); if (K(a)) return a; var i = o.test(a) ? -e[54] : -t[39], u = a.split(r[54]); return u.slice(i).join(fr(n[56], t[55], E)) } function j (t) { for (var o = n[26], i = e[15], u = t[vr(r[55], a[52], D)]; u > i; i++) o = (o << r[56]) - o + t.charCodeAt(i), o >>>= n[26]; return o } function W (n, o) { var i = new a[45](t[56], yr(r[57], $, t[57], r[58])), u = new a[45](t[58]); if (n) { var c = n.match(i); if (c) { var v = c[e[26]]; return o && u.test(v) && (v = v.split(t[59]).pop().split(r[48])[e[15]]), v } } } function $ (o) { var i = n[57], u = vr(e[55], e[56]), f = e[4]; if (!(o > t[60])) { o = o || a[24]; var l = parseInt(E + c + A, r[42]), d = n[14].createElement(e[57]); d[r[59]] = n[58] + parseInt((new a[53]).getTime() / l) + r[60], d[r[61]] = function () { var n = a[46]; cr = r[19], setTimeout(function () { $(++o) }, o * parseInt(C + n, a[33])) }, d[t[61]] = d[hr(a[54], a[55], t[62])] = function () { var a = n[59]; this[i + v + u + b] && this[e[58]] !== n[60] && this[s + B + a + f] !== e[59] && this[t[63]] !== n[61] || (cr = e[15], d[hr(N, r[62], n[62], e[25])] = d[t[64]] = r[63]) }, e[60][e[61]].appendChild(d) } } function F () { var r = a[56]; return Math.random() * parseInt(R + T + f + r, t[42]) >>> n[26] } function X (r) { var e = new n[31](fr(t[65], t[66], a[57]), yr(c, n[63], t[57])); if (r) { var o = r.match(e); return o } } o[S + k] = p, o[r[64]] = $, o[t[67]] = g, o[t[68]] = h, o[t[69]] = j, o[t[70]] = F, o[r[65]] = K, o[x + l] = P, o[t[71]] = W, o[t[72]] = X, o[hr(r[66], t[73], r[67], C)] = N, o[t[74]] = M, o[d + O] = L; function K (n) { return new r[50](t[75]).test(n) } o[r[68]] = m }(wr || (wr = {})); var Ir; ! function (o) { var i = t[76], u = t[77], c = n[65], v = t[78], s = a[24], f = n[26], l = t[18], d = t[18], p = e[15], h = a[24], g = r[69], m = ''; wr.eventBind(e[60], n[67], E), wr.eventBind(r[71], t[79], E), wr.eventBind(t[20], hr(e[64], A, a[59]), b), wr.eventBind(e[60], r[72], y); function w () { return f } function I (r) { f++ } function _ () { return { x: p, y: h, trusted: g } } function y (r) { d++ } function E (r) { s++ } function C () { return l } function b (r) { var o, i, u; o = i = u = n; var c, s, f; c = s = f = t; var d, m, w; d = m = w = e; var I, _, y; I = _ = y = a; var E = I[60], A = d[65]; l++ , g = void 0 == r[E + A + v] || r[yr(f[80], s[81], i[68])], p = r[s[82]], h = r[c[83]] } function B () { return d } function R () { return s } o[r[73]] = R, o[a[61]] = w, o[fr(a[62], n[69])] = C, o[n[70]] = B, o[r[74]] = _ }(Ir || (Ir = {})); var _r; ! function (u) { var v = fr(n[71], t[84]), s = r[75], f = yr(dr, n[72], e[66], $), l = r[76], d = e[67], p = r[77], h = hr(dr, r[78], a[63], n[73]), g = r[79], m = n[74]; BROWSER_LIST = { }; function w () { var t, e, a; t = e = a = r; var o, i, u; o = i = u = n; return wr.booleanToDecimal(c) } function I (t) { for (var o = n[26]; o < y[e[38]]; o++) { var i = y[o][r[94]]; if (t.test(i)) return !a[24] } return !a[18] } function E (t) { } function A () { return a[73] } function B () { return n[20] } function T () { return I(new t[93](r[96])) } function S () { return I(new a[45](t[98], r[97])) } function k () { for (var r in BROWSER_LIST) if (BROWSER_LIST.hasOwnProperty(r)) { var n = BROWSER_LIST[r]; if (n()) return + r.substr(a[18]) } return e[15] } function x () { var n, a, o; n = a = o = r; var i, u, c; i = u = c = t; var v, s, f; v = s = f = e; var l = s[75], d = s[76]; return I(new u[93](o[98], v[71])) || E(l + F + d + X) } function O () { } function L () { var r, n, t; r = n = t = a; var o, i, u; o = i = u = e; var c = l; return c = p } function M () { var r, n, a; r = n = a = t; var o, i, u; o = i = u = e; var c; try { c = i[60].createElement(a[99]).getContext(i[78]) } catch (v) { } return !!c } function J () { var t, e, o; t = e = o = n; var i, u, c; i = u = c = a; var v, s, f; return v = s = f = r, -parseInt(s[100], c[31]) === (new e[2]).getTimezoneOffset() } function Q () { try { } catch (e) { return r[101] } } function Z () { var n, a, o; n = a = o = e; var i, u, c; i = u = c = r; var v, s, f; return v = s = f = t, plugin_num = s[18], plugin_num } var z = [R, x, S, T, L, Q, b, V, O, J, M, q, Y, B, tr, A]; var nr = [new e[13](n[85]), new n[31](e[82]), new r[50](e[83]), new r[50](t[102]), new n[31](e[84]), new a[45](a[78]), new a[45](e[85]), new e[13](t[103]), new a[45](r[103]), new t[93](r[104]), new a[45](r[105])]; function tr () { return e[86] } u[e[87]] = rr, u[a[79]] = k, u[yr(c, e[88], r[106])] = Z, u[K + U + m] = w }(_r || (_r = {})); function yr () { var o = arguments[a[25]]; if (!o) return t[19]; for (var i = a[19], u = e[14], c = r[27]; c < o.length; c++) { var v = o.charCodeAt(c), s = v ^ u; u = u * c % a[80] + e[89], i += n[86].fromCharCode(s) } return i } var Er; ! function (o) { var i = a[81], u = t[35], c = r[107], v = vr(S, a[56]), f = r[27], l = r[19], d = a[25], p = n[87], h = parseInt(e[90], r[108]), g = a[82], m = parseInt(vr(s, t[104]), t[39]), w = r[109], I = t[40], _ = parseInt(i + V, n[45]), y = parseInt(u + c, n[52]), E = parseInt(t[105], r[42]), A = e[91], C = parseInt(Y + v, r[42]), b = parseInt(e[92], e[93]), B = t[106], R = parseInt(vr(e[94], e[95]), t[41]), T = parseInt(a[83], e[93]), k; function x () { var r = M(); return r } function O () { var r = t[26], a = n[35], o = e[54], i = n[88]; k = new gr([i, i, i, i, r, r, r, o, a, a, a, a, a, a, a, i, a, r]), k[l] = wr.serverTimeNow(), L(), k[B] = cr, k[T] = ur, k[R] = e[15], k[C] = _r.getBrowserFeature(), k[g] = _r.getBrowserIndex(), k[m] = _r.getPluginNum() } function L () { var a = dr.getCookie(tr) || pr.get(ar); if (a && a[r[20]] == parseInt(e[96], n[52])) { var o = mr.decode(a); if (o && (k.decodeBuffer(o), k[f] != t[18])) return } k[f] = wr.random() } o[a[84]] = O; function M () { k[R]++ , k[l] = wr.serverTimeNow(), k[d] = wr.timeNow(), k[B] = cr, k[w] = Ir.getMouseMove(), k[I] = Ir.getMouseClick(), k[_] = Ir.getMouseWhell(), k[y] = Ir.getKeyDown(), k[E] = Ir.getClickPos().x, k[A] = Ir.getClickPos().y; var r = k.toBuffer(); return mr.encode(r) } o[yr(r[3], n[89], e[97])] = x }(Er || (Er = {})); var Ar; ! function (o) { var i = n[90], u = a[85], v = r[110], s = a[86], f = t[107], p, h, m, w, I, _; function E (r) { return N(r) && dr[a[87]] } function A (o) { var i = wr.getOriginFromUrl(o); return i ? !new n[31](yr(r[42], c, t[110]) + w).test(i[r[108]]) || !new e[13](I).test(i[a[18]]) : t[111] } function C (e) { var o = (_r, g, Er.update()); return e + (new r[50](vr(a[88], a[89])).test(e) ? n[91] : vr(P, a[90], t[112])) + er + t[23] + r[111](o) } function b (o, i, u) { if (r[112] in i) return i.apply(o, u); switch (u[n[37]]) { case n[26]: return i(); case a[18]: return i(u[n[26]]); case r[108]: return i(u[e[15]], u[r[19]]); default: return i(u[n[26]], u[r[108]], u[t[17]]) } } function B () { var r = Er.update(); return r } function k (r, e, o) { if (!r) return n[20]; var i = r[e]; if (!i) return t[111]; var u = o(i); return d || (u[a[97]] = i + t[19]), u[n[97]] = i, r[e] = u, a[21] } function M (o) { var i, u, c; i = u = c = n; var v, s, l; v = s = l = r; var d, p, h; d = p = h = e; var g, m, w; g = m = w = a; var I, _, y; I = _ = y = t; var R = hr(I[121], w[106], d[109]), T; k(o, _[122], function (r) { var n = w[107]; return function () { var t, e, a; t = e = a = _; var o, i, u; o = i = u = l; var c, v, s; c = v = s = w; var f = s[108]; try { A(arguments[s[18]]) && !E(arguments[o[19]]) ? arguments[a[26]] = C(arguments[s[18]]) : T = B(), r.apply(this, arguments), A(arguments[i[19]]) || this.setRequestHeader(ar, T) } catch (d) { return n + f } } }), k(o, g[109], function (r) { var n = b; n = M; var t = vr(_[123], u[107]); return function () { var n = fr(f, c[108], I[124]), e = s[122]; try { if (parseInt(this.status) === parseInt(h[110], v[123])) { for (var a = r.apply(this, arguments), o = new p[13](i[109], n + R), u, l, d = {}; u = o.exec(a);) d[u[m[18]].toLowerCase()] = u[v[108]]; wr.analysisRst(wr.parse(d[ir.toLowerCase()])) } } catch (g) { return e + t } return r.apply(this, arguments) } }) } function N (r) { var n = wr.getHostFromUrl(r, e[28]); return n ? _.test(n) : e[28] } function j () { var cookie_v; cookie_v = B() return cookie_v } o[n[111]] = j }(Ar || (Ar = {})); var Cr; var cookie = (function (a) { function _ () { var cookie_v; Er.Init(); cookie_v = Ar.Init(); return cookie_v } return function y () { try { return _() } catch (r) { return r } } })() return cookie() } function v () { var v; v = v_cookie( ["t", 34, '"$', 36, "\fb", 55, "ure", "lJ#K", "Flash", "getBro", "1", "analys", "CHAMELEON_CALLBACK", 30, "\u256f\u0930\u097b\u09ff\u09a4\u0934\u099d\u09c1\u099d\u09d9\u09a7\u09c3\u0995\u09f0\u09d3\u0a62\u0a6f\u09bc\u09ad\u0934", "F,sp-", String, "; expires=", "", 1, "length", "; ", '', '', "addBehavior", ";^l", ">*]+", 0, "div", "&~!", "", "Init", "('&%$#\"![", ">NJ", "\u254e\u096d\u095f", "W$R", "sdelif_esab", "Or)E", "decodeBuffer", 84, "f", "htgnel", 8, "110", "40", "\u2504\u2562", "255", "o", ":", '^".*"$', RegExp, 40, Date, "e9", ".", 19, 5, "t8JOi", "}B", "src", ".js", "onerror", "*q:", null, "getServerTime", "isIPAddr", "8-", "ZX9Y]V8aWs3VQZ7Y", "eventBind", !0, "wheel", '', "keydown", "getMouseMove", "getClickPos", "vent", "me", "MSG", 41, "th", "safari", "ActiveXObject", "maxHeight", "head", "Google Inc.", "vendor", "sgAppName", "opr", 94, "tugw`pj", "chrome", "2345Explorer", "ome", "TheWorld", "name", "\u2553\u253c\u2572\u251d\u2569\u253d\u254f\u252e\u254d\u2526", "Native Client", "i", "Shockwave", "systemLanguage", "740", !1, "plugins", "^ARM", "^iPod", "^BlackBerry", "\u2550\u0978\u094e\u09c1\u09bc\u0928\u0989\u09d8\u099a\u09f3\u09b7\u09dc", "0", 2, 7, "c", encodeURIComponent, "apply", "headers", "8S:+", "\u2560\u2509\u2567\u2503\u256c\u251b", "\u255e\u2530\u2543\u2526\u2554\u2520\u2562\u2507\u2561\u250e\u257c\u2519", "a", 14, ":dB2", "href", "click", "err", 16, "hostname", "`60w", "\fbf", "&X "], [";", "Element", Date, "par", "i", "DOMMous", 21, "xmT", "wserFe", "h", !0, 1, "", Boolean, '', "; domain=", "n 1970 00:", "cookie", "checkcookie", "allow", !1, "delCookie", 2333, "torage", ")*+,/\\\\:;", '', 0, '', "eliflmth", '', "ducument", RegExp, "W", "qsU", 61, 2, "sdelif_esab", "length", "I", "ff", 16, 45, "3", "10010", "77", 8, "6e%d", "DT{e", "$", / /g, ":", "href", 10, "location", "ned", "\\.com\\.cn$|\\.com\\.hk$", 63, "rea", "https://s.thsi.cn/js/chameleon/time.1", "tat", "loaded", "interactive", "WY:ZYS", "E?`a", "addEventListener", "eScroll", "onmousewheel", "mousemove", "\u255e\u096e\u096e\u09e3\u09a5\u092e\u099a\u09d4\u0990", "\u2550\u2535\u2541\u250c\u2563\u2516\u2565\u2500\u2543\u252f\u2546\u2525\u254e", "getKeyDown", "H69?@[\\]^", "e", "HE9", "tot", "\u2503", "0", "dyS", "se", "getRoot", "NR", "nd", 60, "ng", "s", "get", "mit", 13, 3, 0, "", '', "\u255f\u253a\u255b\u253f", "getCookie", "=", "length", "V587", 1, String, !0, "___", "\u2553\u2536\u255a", "uBot", "base_fileds", 32, "2", "1", "20", 5, "255", 2, 8, 16, 10, "203", "base64Encode", "base64Decode", "decode", "760", "\u255b\u0978\u0954\u09f6\u09a4\u0935", 70, "location", "href", "redirect_url", "efi", Date, "\u2519", "^\\s*(?:https?:)?\\/{2,}([^\\/\\?\\#\\\\]+)", "\u255e", "[@:]", "@", 7, "onload", 'WY$PYS/FLV"P[_7[_R', "readyState", "onreadystatechange", '"^w', "\u2569\u2535\u2546\u256c\u2544\u257b\u2541\u2569\u2501\u2575\u2501\u2571\u2502\u253d\u2507\u252e\u2507\u2538\u2564\u254b\u2530\u2502\u252e\u2553\u257b\u2520\u257e\u2522\u250d\u2551\u256e\u2532\u2511\u254d\u2511\u254c\u2567\u254e", "analysisRst", "strToBytes", "strhash", "random", "getHostFromUrl", "getOriginFromUrl", 83, "timeNow", "^(\\d+\\.)+\\d+$", "d", "v", "ted", "touchmove", 85, "F(K9i", "clientX", "clientY", "\u257a\u2515\u256f\u253c", "postMessage", '', "ActiveXObject", "Apple Computer, Inc.", "Q", "chr", "\u2558\u2535\u2550", "BIDUBrowser", RegExp, "QQBrowser", "ro", "aef", "msDoNotTrack", "PDF|Acrobat", "canvas", "yE", "\u255b\u253a\u2554\u2533\u2546\u2527\u2540\u2525\u2556", "^Android", "^Linux [ix]\\d+", "011", "13", 15, "sub", "addEventListener", "jsonp_ignore", "\u2569", !1, 'L"', "Sj", "T{_,", "q*", "i", "tagName", "et", "{'K", "Pp<", "#x'", "open", "rS", "KN3", "#", "protocol", "\\.", "DEDAOL_NOELEMAHC"], [83, "ffer", "\u2505", "20", "e", "ngsE", Error, "est", "\u2552\u095b\u0956\u09f0\u09a3\u0935\u09c0\u09e2", "1", "sr", "hexin-v", "", RegExp, 9527, 0, "**l>", "head", "Thu, 01 Ja", "00:00 GMT", "allow", "=", "; path=", "cookie", "Init", 33, 1, "setCookie", !0, "localS", "`{|}~]", "g", '', "frames", "___$&", 56, " ", "\b", "length", "10", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", "\u2552\u096f\u0948\u09fe\u09a2", 16, 2, 6, "encode", "rea", "729", "*.", ",", "\u2506\u092c\u090b\u09a0\u09e1\u096d\u09df\u0981\u09c4\u098c", "redirect_url", "\u2506\u092d\u090a\u09a3", "1111101000", 3, 47, "tat", "script", "readyState", "complete", '', "body", "onwheel", "mousewheel", 37, "rus", "\u2554\u0975", "chr", "ActiveXObject", "WeakMap", "aT1Kg", "i", 24, "\u2554\u253c\u254e\u2521\u254c\u2529", "\u2547\u0971\u094f\u09f6\u09b9\u0933\u099d", "Shockwav", "hockwave", "$cdc_asdjflasutopfhvcZLmcfl_", "webgl2", "2>n|", "plugins", "platform", "^Win64", "^Linux armv|Android", "^iPhone", "^MacIntel", !1, "getPlatform", "6Y,", 2333, "100", 12, "14", 10, 36, "01", "60", "\u2542\u096d\u095e\u09f0\u09a4\u0938", "j", 17, "Request", "prototype", "`z}lc", "error", "s", "r", "target", "\u255e", "A", "U", "193", "host", "$"], ["se", "g@g?", Array, "*Y", Number, "^{.", "*}$", "und", "429", "496", "imeNow", "etti", "rg", "v", "hexin-v", Error, "L_%\\T8", ".baidu.", 1, "", Function, !0, " ", '', 0, 2, "#default#userData", "ydob", "^d", 89, "11111111", 8, "epytotorp", 10, 16, "\u2506\u2536\u2506\u2536\u2506", "14", 13, "10", "Syd", 44, "Domain", "serverT", '^"', "length", RegExp, "00", "tcejbo", "status_code", "n", 66, "\u2506\u2531\u2504\u2534", "htgnel", Date, "L%", 67, "5", "?)'", '', "[[?VS", "isT", "getMouseWhell", "}}", "TR", "ActiveXObject", "WE", "python", "Maxthon", 97, "chrome", "Ryp", "UBrowser", 54, !1, "ontouchstart", "\u254d\u0975\u0917\u09f2\u09be", "iso-8859-1", "defaultCharset", "^iPad", "getBrowserIndex", 256, "1", 5, "17", "Init", "XMLHttp", "tar", "allow", "@*", "?\\", "?", "\u2571\u2503\u256a\u2546\u2566\u2556\u2567\u2547\u2501\u2564\u2506\u2526\u2514\u2524\u2511\u2521\u2501\u2531\u2501\u253b\u250b\u253b\u2501\u2531\u2501\u2521\u2566\u252b\u257f", "den", "tia", 94, "ls", "\u2554\u2526\u2543", "_str", 37, "append", "Child", "\u255f", "\u2569\u0975\u094e\u09e5\u09a0\u092e\u09d1\u09ed\u09ce", "srcElement", "parentNode", "\u2543\u2522\u2545\u250b\u256a\u2507\u2562", "}*", "err", "or", "getAllResponseHeaders", "\\.?", "\\."] ); return v } ================================================ FILE: akshare/datasets.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/12/30 15:30 Desc: 导入文件工具,可以正确处理路径问题 """ import pathlib from importlib import resources def get_ths_js(file: str = "ths.js") -> pathlib.Path: """ get path to data "ths.js" text file. :return: 文件路径 :rtype: pathlib.Path """ with resources.path("akshare.data", file) as f: data_file_path = f return data_file_path def get_crypto_info_csv(file: str = "crypto_info.zip") -> pathlib.Path: """ get path to data "ths.js" text file. :return: 文件路径 :rtype: pathlib.Path """ with resources.path("akshare.data", file) as f: data_file_path = f return data_file_path if __name__ == "__main__": get_ths_js_path = get_ths_js(file="ths.js") print(get_ths_js_path) get_crypto_info_csv_path = get_crypto_info_csv(file="crypto_info.zip") print(get_crypto_info_csv_path) ================================================ FILE: akshare/economic/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/10/21 12:08 Desc: """ ================================================ FILE: akshare/economic/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/10/21 21:11 Desc: 宏观经济配置文件 """ # urls-china JS_CHINA_CPI_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_cpi_yoy_all.js?v={}&_={}" ) JS_CHINA_CPI_MONTHLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_cpi_mom_all.js?v={}&_={}" ) JS_CHINA_M2_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_m2_money_supply_yoy_all.js?v={}&_={}" ) JS_CHINA_PPI_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_ppi_yoy_all.js?v={}&_={}" ) JS_CHINA_PMI_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_manufacturing_pmi_all.js?v={}&_={}" ) JS_CHINA_GDP_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_gdp_yoy_all.js?v={}&_={}" ) JS_CHINA_CX_PMI_YEARLY_URL = "https://cdn.jin10.com/dc/reports/dc_chinese_caixin_manufacturing_pmi_all.js?v={}&_={}" JS_CHINA_CX_SERVICE_PMI_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_caixin_services_pmi_all.js?v={}&_={}" ) JS_CHINA_FX_RESERVES_YEARLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_fx_reserves_all.js?v={}&_={}" ) JS_CHINA_ENERGY_DAILY_URL = ( "https://cdn.jin10.com/dc/reports/dc_qihuo_energy_report_all.js?v={}&_={}" ) JS_CHINA_NON_MAN_PMI_MONTHLY_URL = ( "https://cdn.jin10.com/dc/reports/dc_chinese_non_manufacturing_pmi_all.js?v={}&_={}" ) JS_CHINA_RMB_DAILY_URL = "https://cdn.jin10.com/dc/reports/dc_rmb_data_all.js?v={}&_={}" JS_CHINA_MARKET_MARGIN_SZ_URL = ( "https://cdn.jin10.com/dc/reports/dc_market_margin_sz_all.js?v={}&_={}" ) JS_CHINA_MARKET_MARGIN_SH_URL = ( "https://cdn.jin10.com/dc/reports/dc_market_margin_sse_all.js?v={}&_={}" ) JS_CHINA_REPORT_URL = "https://cdn.jin10.com/dc/reports/dc_sge_report_all.js?v={}&_={}" # urls-usa JS_USA_INTEREST_RATE_URL = ( "https://cdn.jin10.com/dc/reports/dc_usa_interest_rate_decision_all.js?v={}&_={}" ) JS_USA_NON_FARM_URL = ( "https://cdn.jin10.com/dc/reports/dc_nonfarm_payrolls_all.js?v={}&_={}" ) JS_USA_UNEMPLOYMENT_RATE_URL = ( "https://cdn.jin10.com/dc/reports/dc_usa_unemployment_rate_all.js??v={}&_={}" ) JS_USA_EIA_CRUDE_URL = ( "https://cdn.jin10.com/dc/reports/dc_eia_crude_oil_all.js?v={}&_={}" ) JS_USA_INITIAL_JOBLESS_URL = ( "https://cdn.jin10.com/dc/reports/dc_initial_jobless_all.js?v={}&_={}" ) JS_USA_CORE_PCE_PRICE_URL = ( "https://cdn.jin10.com/dc/reports/dc_usa_core_pce_price_all.js?v={}&_={}" ) JS_USA_CPI_MONTHLY_URL = "https://cdn.jin10.com/dc/reports/dc_usa_cpi_all.js?v={}&_={}" JS_USA_LMCI_URL = "https://cdn.jin10.com/dc/reports/dc_usa_lmci_all.js?v={}&_={}" JS_USA_ADP_NONFARM_URL = ( "https://cdn.jin10.com/dc/reports/dc_adp_nonfarm_employment_all.js?v={}&_={}" ) JS_USA_GDP_MONTHLY_URL = "https://cdn.jin10.com/dc/reports/dc_usa_gdp_all.js?v={}&_={}" JS_USA_EIA_CRUDE_PRODUCE_URL = ( "https://cdn.jin10.com/dc/reports/dc_eia_crude_oil_produce_all.js?v={}&_={}" ) # urls-euro JS_EURO_RATE_DECISION_URL = ( "https://cdn.jin10.com/dc/reports/dc_interest_rate_decision_all.js?v={}&_={}" ) # urls-constitute JS_CONS_GOLD_ETF_URL = "https://cdn.jin10.com/dc/reports/dc_etf_gold_all.js?v={}&_={}" JS_CONS_SLIVER_ETF_URL = ( "https://cdn.jin10.com/dc/reports/dc_etf_sliver_all.js?v={}&_={}" ) JS_CONS_OPEC_URL = "https://cdn.jin10.com/dc/reports/dc_opec_report_all.js??v={}&_={}" usa_name_url_map = { "美联储决议报告": "//datacenter.jin10.com/reportType/dc_usa_interest_rate_decision", "美国非农就业人数报告": "//datacenter.jin10.com/reportType/dc_nonfarm_payrolls", "美国失业率报告": "//datacenter.jin10.com/reportType/dc_usa_unemployment_rate", "美国CPI月率报告": "//datacenter.jin10.com/reportType/dc_usa_cpi", "美国初请失业金人数报告": "//datacenter.jin10.com/reportType/dc_initial_jobless", "美国核心PCE物价指数年率报告": "//datacenter.jin10.com/reportType/dc_usa_core_pce_price", "美国EIA原油库存报告": "//datacenter.jin10.com/reportType/dc_eia_crude_oil", "美联储劳动力市场状况指数报告": "//datacenter.jin10.com/reportType/dc_usa_lmci", "美国ADP就业人数报告": "//datacenter.jin10.com/reportType/dc_adp_nonfarm_employment", "美国国内生产总值(GDP)报告": "//datacenter.jin10.com/reportType/dc_usa_gdp", "美国原油产量报告": "//datacenter.jin10.com/reportType/dc_eia_crude_oil_produce", "美国零售销售月率报告": "//datacenter.jin10.com/reportType/dc_usa_retail_sales", "美国商品期货交易委员会CFTC外汇类非商业持仓报告": "//datacenter.jin10.com/reportType/dc_cftc_nc_report", "美国NFIB小型企业信心指数报告": "//datacenter.jin10.com/reportType/dc_usa_nfib_small_business", "贝克休斯钻井报告": "//datacenter.jin10.com/reportType/dc_rig_count_summary", "美国谘商会消费者信心指数报告": "//datacenter.jin10.com/reportType/dc_usa_cb_consumer_confidence", "美国FHFA房价指数月率报告": "//datacenter.jin10.com/reportType/dc_usa_house_price_index", "美国个人支出月率报告": "//datacenter.jin10.com/reportType/dc_usa_personal_spending", "美国生产者物价指数(PPI)报告": "//datacenter.jin10.com/reportType/dc_usa_ppi", "美国成屋销售总数年化报告": "//datacenter.jin10.com/reportType/dc_usa_exist_home_sales", "美国成屋签约销售指数月率报告": "//datacenter.jin10.com/reportType/dc_usa_pending_home_sales", "美国S&P/CS20座大城市房价指数年率报告": "//datacenter.jin10.com/reportType/dc_usa_spcs20", "美国进口物价指数报告": "//datacenter.jin10.com/reportType/dc_usa_import_price", "美国营建许可总数报告": "//datacenter.jin10.com/reportType/dc_usa_building_permits", "美国商品期货交易委员会CFTC商品类非商业持仓报告": "//datacenter.jin10.com/reportType/dc_cftc_c_report", "美国挑战者企业裁员人数报告": "//datacenter.jin10.com/reportType/dc_usa_job_cuts", "美国实际个人消费支出季率初值报告": "//datacenter.jin10.com/reportType/dc_usa_real_consumer_spending", "美国贸易帐报告": "//datacenter.jin10.com/reportType/dc_usa_trade_balance", "美国经常帐报告": "//datacenter.jin10.com/reportType/dc_usa_current_account", "美国API原油库存报告": "//datacenter.jin10.com/reportType/dc_usa_api_crude_stock", "美国工业产出月率报告": "//datacenter.jin10.com/reportType/dc_usa_industrial_production", "美国耐用品订单月率报告": "//datacenter.jin10.com/reportType/dc_usa_durable_goods_orders", "美国工厂订单月率报告": "//datacenter.jin10.com/reportType/dc_usa_factory_orders", "Markit服务业PMI终值": "//datacenter.jin10.com/reportType/dc_usa_services_pmi", "商业库存月率": "//datacenter.jin10.com/reportType/dc_usa_business_inventories", "美国ISM非制造业PMI": "//datacenter.jin10.com/reportType/dc_usa_ism_non_pmi", "NAHB房产市场指数": "//datacenter.jin10.com/reportType/dc_usa_nahb_house_market_index", "新屋开工总数年化": "//datacenter.jin10.com/reportType/dc_usa_house_starts", "美国新屋销售总数年化": "//datacenter.jin10.com/reportType/dc_usa_new_home_sales", "美国Markit制造业PMI初值报告": "//datacenter.jin10.com/reportType/dc_usa_pmi", "美国ISM制造业PMI报告": "//datacenter.jin10.com/reportType/dc_usa_ism_pmi", "美国密歇根大学消费者信心指数初值报告": "//datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment", "美国出口价格指数报告": "//datacenter.jin10.com/reportType/dc_usa_export_price", "美国核心生产者物价指数(PPI)报告": "//datacenter.jin10.com/reportType/dc_usa_core_ppi", "美国核心CPI月率报告": "//datacenter.jin10.com/reportType/dc_usa_core_cpi", "美国EIA俄克拉荷马州库欣原油库存报告": "//datacenter.jin10.com/reportType/dc_eia_cushing_oil", "美国EIA精炼油库存报告": "//datacenter.jin10.com/reportType/dc_eia_distillates_stocks", "美国EIA天然气库存报告": "//datacenter.jin10.com/reportType/dc_eia_natural_gas", "美国EIA汽油库存报告": "//datacenter.jin10.com/reportType/dc_eia_gasoline", } china_name_url_map = { "郑州商品交易所期货每日行情": "//datacenter.jin10.com/reportType/dc_czce_futures_data", "中国CPI年率报告": "//datacenter.jin10.com/reportType/dc_chinese_cpi_yoy", "中国PPI年率报告": "//datacenter.jin10.com/reportType/dc_chinese_ppi_yoy", "中国以美元计算出口年率报告": "//datacenter.jin10.com/reportType/dc_chinese_exports_yoy", "中国以美元计算进口年率报告": "//datacenter.jin10.com/reportType/dc_chinese_imports_yoy", "中国以美元计算贸易帐报告": "//datacenter.jin10.com/reportType/dc_chinese_trade_balance", "中国规模以上工业增加值年率报告": "//datacenter.jin10.com/reportType/dc_chinese_industrial_production_yoy", "中国官方制造业PMI报告": "//datacenter.jin10.com/reportType/dc_chinese_manufacturing_pmi", "中国财新制造业PMI终值报告": "//datacenter.jin10.com/reportType/dc_chinese_caixin_manufacturing_pmi", "中国财新服务业PMI报告": "//datacenter.jin10.com/reportType/dc_chinese_caixin_services_pmi", "中国外汇储备报告": "//datacenter.jin10.com/reportType/dc_chinese_fx_reserves", "中国M2货币供应年率报告": "//datacenter.jin10.com/reportType/dc_chinese_m2_money_supply_yoy", "中国GDP年率报告": "//datacenter.jin10.com/reportType/dc_chinese_gdp_yoy", "人民币汇率中间价报告": "//datacenter.jin10.com/reportType/dc_rmb_data", "在岸人民币成交量报告": "//datacenter.jin10.com/reportType/dc_dollar_rmb_report", "上海期货交易所期货合约行情": "//datacenter.jin10.com/reportType/dc_shfe_futures_data", "中国CPI月率报告": "//datacenter.jin10.com/reportType/dc_chinese_cpi_mom", "大连商品交易所期货每日行情": "//datacenter.jin10.com/reportType/dc_dce_futures_data", "中国金融期货交易所期货每日行情": "//datacenter.jin10.com/reportType/dc_cffex_futures_data", "同业拆借报告": "//datacenter.jin10.com/reportType/dc_shibor", "香港同业拆借报告": "//datacenter.jin10.com/reportType/dc_hk_market_info", "深圳融资融券报告": "//datacenter.jin10.com/reportType/dc_market_margin_sz", "上海融资融券报告": "//datacenter.jin10.com/reportType/dc_market_margin_sse", "上海黄金交易所报告": "//datacenter.jin10.com/reportType/dc_sge_report", "上海期货交易所仓单日报": "//datacenter.jin10.com/reportType/dc_shfe_daily_stock", "大连商品交易所仓单日报": "//datacenter.jin10.com/reportType/dc_dce_daily_stock", "郑州商品交易所仓单日报": "//datacenter.jin10.com/reportType/dc_czce_daily_stock", "上海期货交易所指定交割仓库库存周报": "//datacenter.jin10.com/reportType/dc_shfe_weekly_stock", "CCI指数5500大卡动力煤价格报告": "//datacenter.jin10.com/reportType/dc_cci_report", "沿海六大电厂库存动态报告": "//datacenter.jin10.com/reportType/dc_qihuo_energy_report", "国内期货市场实施热度报告": "//datacenter.jin10.com/reportType/dc_futures_market_realtime", "中国官方非制造业PMI报告": "//datacenter.jin10.com/reportType/dc_chinese_non_manufacturing_pmi", } euro_name_url_map = { "欧元区未季调贸易帐报告": "//datacenter.jin10.com/reportType/dc_eurozone_trade_balance_mom", "欧元区季度GDP年率报告": "//datacenter.jin10.com/reportType/dc_eurozone_gdp_yoy", "欧元区CPI年率报告": "//datacenter.jin10.com/reportType/dc_eurozone_cpi_yoy", "欧元区PPI月率报告": "//datacenter.jin10.com/reportType/dc_eurozone_ppi_mom", "欧元区零售销售月率报告": "//datacenter.jin10.com/reportType/dc_eurozone_retail_sales_mom", "欧元区季调后就业人数季率报告": "//datacenter.jin10.com/reportType/dc_eurozone_employment_change_qoq", "欧元区失业率报告": "//datacenter.jin10.com/reportType/dc_eurozone_unemployment_rate_mom", "欧元区CPI月率报告": "//datacenter.jin10.com/reportType/dc_eurozone_cpi_mom", "欧元区经常帐报告": "//datacenter.jin10.com/reportType/dc_eurozone_current_account_mom", "欧元区工业产出月率报告": "//datacenter.jin10.com/reportType/dc_eurozone_industrial_production_mom", "欧元区制造业PMI初值报告": "//datacenter.jin10.com/reportType/dc_eurozone_manufacturing_pmi", "欧元区服务业PMI终值报告": "//datacenter.jin10.com/reportType/dc_eurozone_services_pmi", "欧元区ZEW经济景气指数报告": "//datacenter.jin10.com/reportType/dc_eurozone_zew_economic_sentiment", "欧元区Sentix投资者信心指数报告": "//datacenter.jin10.com/reportType/dc_eurozone_sentix_investor_confidence", } world_central_bank_map = { "美联储决议报告": "//datacenter.jin10.com/reportType/dc_usa_interest_rate_decision", "欧洲央行决议报告": "//datacenter.jin10.com/reportType/dc_interest_rate_decision", "新西兰联储决议报告": "//datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision", "中国央行决议报告": "//datacenter.jin10.com/reportType/dc_china_interest_rate_decision", "瑞士央行决议报告": "//datacenter.jin10.com/reportType/dc_switzerland_interest_rate_decision", "英国央行决议报告": "//datacenter.jin10.com/reportType/dc_english_interest_rate_decision", "澳洲联储决议报告": "//datacenter.jin10.com/reportType/dc_australia_interest_rate_decision", "日本央行决议报告": "//datacenter.jin10.com/reportType/dc_japan_interest_rate_decision", "印度央行决议报告": "//datacenter.jin10.com/reportType/dc_india_interest_rate_decision", "俄罗斯央行决议报告": "//datacenter.jin10.com/reportType/dc_russia_interest_rate_decision", "巴西央行决议报告": "//datacenter.jin10.com/reportType/dc_brazil_interest_rate_decision", } constitute_report_map = { "全球最大黄金ETF—SPDR Gold Trust持仓报告": "//datacenter.jin10.com/reportType/dc_etf_gold", "全球最大白银ETF--iShares Silver Trust持仓报告": "//datacenter.jin10.com/reportType/dc_etf_sliver", "芝加哥商业交易所(CME)能源类商品成交量报告": "//datacenter.jin10.com/reportType/dc_cme_energy_report", "美国商品期货交易委员会CFTC外汇类非商业持仓报告": "//datacenter.jin10.com/reportType/dc_cftc_nc_report", "美国商品期货交易委员会CFTC商品类非商业持仓报告": "//datacenter.jin10.com/reportType/dc_cftc_c_report", "芝加哥商业交易所(CME)金属类商品成交量报告": "//datacenter.jin10.com/reportType/dc_cme_report", "芝加哥商业交易所(CME)外汇类商品成交量报告": "//datacenter.jin10.com/reportType/dc_cme_fx_report", "伦敦金属交易所(LME)库存报告": "//datacenter.jin10.com/reportType/dc_lme_report", "伦敦金属交易所(LME)持仓报告": "//datacenter.jin10.com/reportType/dc_lme_traders_report", "美国商品期货交易委员会CFTC商品类商业持仓报告": "//datacenter.jin10.com/reportType/dc_cftc_merchant_goods", "美国商品期货交易委员会CFTC外汇类商业持仓报告": "//datacenter.jin10.com/reportType/dc_cftc_merchant_currency", } other_map = { "投机情绪报告": "//datacenter.jin10.com/reportType/dc_ssi_trends", "外汇实时波动监控": "//datacenter.jin10.com/reportType/dc_myFxBook_heat_map", "外汇相关性报告": "//datacenter.jin10.com/reportType/dc_myFxBook_correlation", "加密货币实时行情": "//datacenter.jin10.com/reportType/dc_bitcoin_current", } main_map = { "全球最大黄金ETF—SPDR Gold Trust持仓报告": "//datacenter.jin10.com/reportType/dc_etf_gold", "全球最大白银ETF--iShares Silver Trust持仓报告": "//datacenter.jin10.com/reportType/dc_etf_sliver", "美国非农就业人数报告": "//datacenter.jin10.com/reportType/dc_nonfarm_payrolls", "投机情绪报告": "//datacenter.jin10.com/reportType/dc_ssi_trends", "数据达人 — 复合报告": "//datacenter.jin10.com/reportType/dc_complex_report?complexType=1", "投行订单": "//datacenter.jin10.com/banks_orders", "行情报价": "//datacenter.jin10.com/price_wall", "美国EIA原油库存报告": "//datacenter.jin10.com/reportType/dc_eia_crude_oil", "欧佩克报告": "//datacenter.jin10.com/reportType/dc_opec_report", } ================================================ FILE: akshare/economic/macro_australia.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/1/17 15:30 Desc: 东方财富-经济数据-澳大利亚 https://data.eastmoney.com/cjsj/foreign_5_0.html """ import pandas as pd import requests # 零售销售月率 def macro_australia_retail_rate_monthly() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-零售销售月率 https://data.eastmoney.com/cjsj/foreign_5_0.html :return: 零售销售月率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00152903")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df # 贸易帐 def macro_australia_trade() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-贸易帐 https://data.eastmoney.com/cjsj/foreign_5_1.html :return: 贸易帐 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00152793")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df # 失业率 def macro_australia_unemployment_rate() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-失业率 https://data.eastmoney.com/cjsj/foreign_5_2.html :return: 失业率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00101141")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df # 生产者物价指数季率 def macro_australia_ppi_quarterly() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-生产者物价指数季率 https://data.eastmoney.com/cjsj/foreign_5_3.html :return: 生产者物价指数季率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00152722")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df # 消费者物价指数季率 def macro_australia_cpi_quarterly() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-消费者物价指数季率 https://data.eastmoney.com/cjsj/foreign_5_4.html :return: 消费者物价指数季率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00101104")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df # 消费者物价指数年率 def macro_australia_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_5_5.html :return: 消费者物价指数年率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00101093")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df # 央行公布利率决议 def macro_australia_bank_rate() -> pd.DataFrame: """ 东方财富-经济数据-澳大利亚-央行公布利率决议 https://data.eastmoney.com/cjsj/foreign_5_6.html :return: 央行公布利率决议 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_AUSTRALIA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00342255")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(by="发布日期", ignore_index=True, inplace=True) return temp_df if __name__ == "__main__": macro_australia_retail_rate_monthly_df = macro_australia_retail_rate_monthly() print(macro_australia_retail_rate_monthly_df) macro_australia_trade_df = macro_australia_trade() print(macro_australia_trade_df) macro_australia_unemployment_rate_df = macro_australia_unemployment_rate() print(macro_australia_unemployment_rate_df) macro_australia_ppi_quarterly_df = macro_australia_ppi_quarterly() print(macro_australia_ppi_quarterly_df) macro_australia_cpi_quarterly_df = macro_australia_cpi_quarterly() print(macro_australia_cpi_quarterly_df) macro_australia_cpi_yearly_df = macro_australia_cpi_yearly() print(macro_australia_cpi_yearly_df) macro_australia_bank_rate_df = macro_australia_bank_rate() print(macro_australia_bank_rate_df) ================================================ FILE: akshare/economic/macro_bank.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/11/5 17:11 Desc: 金十数据中心-经济指标-央行利率-主要央行利率 https://datacenter.jin10.com/economic 输出数据格式为 float64 美联储利率决议报告 欧洲央行决议报告 新西兰联储决议报告 中国央行决议报告 瑞士央行决议报告 英国央行决议报告 澳洲联储决议报告 日本央行决议报告 俄罗斯央行决议报告 印度央行决议报告 巴西央行决议报告 """ import datetime import time import pandas as pd import requests def __get_interest_rate_data(attr_id: str, name: str = "利率") -> pd.DataFrame: """ 利率决议报告公共函数 https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision :param attr_id: 内置属性 :type attr_id: str :param name: 利率报告名称 :type name: str :return: 利率决议报告数据 :rtype: pandas.Series """ t = time.time() headers = { "Accept": "*/*", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/120.0.0.0 Safari/537.36", "Origin": "https://datacenter.jin10.com", "Referer": "https://datacenter.jin10.com/", "x-app-id": "rU6QIu7JHe2gOUeR", "x-version": "1.0.0", } base_url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": "", "category": "ec", "attr_id": attr_id, "_": str(int(round(t * 1000))), } interest_rate_data = [] try: while True: response = requests.get( url=base_url, params=params, headers=headers, timeout=10 ) data = response.json() if not data.get("data", {}).get("values"): break interest_rate_data.extend(data["data"]["values"]) # Update max_date for pagination last_date = data["data"]["values"][-1][0] next_date = ( datetime.datetime.strptime(last_date, "%Y-%m-%d").date() - datetime.timedelta(days=1) ).isoformat() params["max_date"] = next_date except requests.exceptions.RequestException as e: print(f"Error fetching data: {e}") return pd.DataFrame() # Convert to DataFrame big_df = pd.DataFrame(interest_rate_data) if big_df.empty: return pd.DataFrame() # Process DataFrame big_df["商品"] = name big_df.columns = ["日期", "今值", "预测值", "前值", "商品"] big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] # Convert data types big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date numeric_columns = ["今值", "预测值", "前值"] for col in numeric_columns: big_df[col] = pd.to_numeric(big_df[col], errors="coerce") return big_df.sort_values("日期").reset_index(drop=True) # 金十数据中心-经济指标-央行利率-主要央行利率-美联储利率决议报告 def macro_bank_usa_interest_rate() -> pd.DataFrame: """ 美联储利率决议报告, 数据区间从 19820927-至今 https://datacenter.jin10.com/reportType/dc_usa_interest_rate_decision :return: 美联储利率决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="24", name="美联储利率决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-欧洲央行决议报告 def macro_bank_euro_interest_rate() -> pd.DataFrame: """ 欧洲央行决议报告, 数据区间从 19990101-至今 https://datacenter.jin10.com/reportType/dc_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_interest_rate_decision_all.js?v=1578581663 :return: 欧洲央行决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="21", name="欧洲央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-新西兰联储决议报告 def macro_bank_newzealand_interest_rate() -> pd.DataFrame: """ 新西兰联储决议报告, 数据区间从 19990401-至今 https://datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_newzealand_interest_rate_decision_all.js?v=1578582075 :return: 新西兰联储决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="23", name="新西兰利率决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-中国央行决议报告 def macro_bank_china_interest_rate() -> pd.DataFrame: """ 中国央行决议报告, 数据区间从 19990105-至今 https://datacenter.jin10.com/reportType/dc_newzealand_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_newzealand_interest_rate_decision_all.js?v=1578582075 :return: 新西兰联储决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="91", name="中国央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-瑞士央行决议报告 def macro_bank_switzerland_interest_rate() -> pd.DataFrame: """ 瑞士央行利率决议报告, 数据区间从 20080313-至今 https://datacenter.jin10.com/reportType/dc_switzerland_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_switzerland_interest_rate_decision_all.js?v=1578582240 :return: 瑞士央行利率决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="25", name="瑞士央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-英国央行决议报告 def macro_bank_english_interest_rate() -> pd.DataFrame: """ 英国央行决议报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_english_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_english_interest_rate_decision_all.js?v=1578582331 :return: 英国央行决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="26", name="英国央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-澳洲联储决议报告 def macro_bank_australia_interest_rate() -> pd.DataFrame: """ 澳洲联储决议报告, 数据区间从 19800201-至今 https://datacenter.jin10.com/reportType/dc_australia_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_australia_interest_rate_decision_all.js?v=1578582414 :return: 澳洲联储决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="27", name="澳洲联储决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-日本央行决议报告 def macro_bank_japan_interest_rate() -> pd.DataFrame: """ 日本利率决议报告, 数据区间从 20080214-至今 https://datacenter.jin10.com/reportType/dc_japan_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_japan_interest_rate_decision_all.js?v=1578582485 :return: 日本利率决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="22", name="日本央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-俄罗斯央行决议报告 def macro_bank_russia_interest_rate() -> pd.DataFrame: """ 俄罗斯利率决议报告, 数据区间从 20030601-至今 https://datacenter.jin10.com/reportType/dc_russia_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_russia_interest_rate_decision_all.js?v=1578582572 :return: 俄罗斯利率决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="64", name="俄罗斯央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-印度央行决议报告 def macro_bank_india_interest_rate() -> pd.DataFrame: """ 印度利率决议报告, 数据区间从 20000801-至今 https://datacenter.jin10.com/reportType/dc_india_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_india_interest_rate_decision_all.js?v=1578582645 :return: 印度利率决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="68", name="印度央行决议报告") # 金十数据中心-经济指标-央行利率-主要央行利率-巴西央行决议报告 def macro_bank_brazil_interest_rate() -> pd.DataFrame: """ 巴西利率决议报告, 数据区间从 20080201-至今 https://datacenter.jin10.com/reportType/dc_brazil_interest_rate_decision https://cdn.jin10.com/dc/reports/dc_brazil_interest_rate_decision_all.js?v=1578582718 :return: 巴西利率决议报告-今值(%) :rtype: pandas.Series """ return __get_interest_rate_data(attr_id="55", name="巴西央行决议报告") if __name__ == "__main__": # 金十数据中心-经济指标-央行利率-主要央行利率-美联储利率决议报告 macro_bank_usa_interest_rate_df = macro_bank_usa_interest_rate() print(macro_bank_usa_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-欧洲央行决议报告 macro_bank_euro_interest_rate_df = macro_bank_euro_interest_rate() print(macro_bank_euro_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-新西兰联储决议报告 macro_bank_newzealand_interest_rate_df = macro_bank_newzealand_interest_rate() print(macro_bank_newzealand_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-中国央行决议报告 macro_bank_china_interest_rate_df = macro_bank_china_interest_rate() print(macro_bank_china_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-瑞士央行决议报告 macro_bank_switzerland_interest_rate_df = macro_bank_switzerland_interest_rate() print(macro_bank_switzerland_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-英国央行决议报告 macro_bank_english_interest_rate_df = macro_bank_english_interest_rate() print(macro_bank_english_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-澳洲联储决议报告 macro_bank_australia_interest_rate_df = macro_bank_australia_interest_rate() print(macro_bank_australia_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-日本央行决议报告 macro_bank_japan_interest_rate_df = macro_bank_japan_interest_rate() print(macro_bank_japan_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-俄罗斯央行决议报告 macro_bank_russia_interest_rate_df = macro_bank_russia_interest_rate() print(macro_bank_russia_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-印度央行决议报告 macro_bank_india_interest_rate_df = macro_bank_india_interest_rate() print(macro_bank_india_interest_rate_df) # 金十数据中心-经济指标-央行利率-主要央行利率-巴西央行决议报告 macro_bank_brazil_interest_rate_df = macro_bank_brazil_interest_rate() print(macro_bank_brazil_interest_rate_df) ================================================ FILE: akshare/economic/macro_canada.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/11/27 20:30 Desc: 东方财富-经济数据-加拿大 https://data.eastmoney.com/cjsj/foreign_5_0.html """ import pandas as pd import requests # 新屋开工 def macro_canada_new_house_rate() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-新屋开工 https://data.eastmoney.com/cjsj/foreign_7_0.html :return: 新屋开工 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00342247")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 失业率 def macro_canada_unemployment_rate() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-失业率 https://data.eastmoney.com/cjsj/foreign_7_1.html :return: 失业率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00157746")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 贸易帐 def macro_canada_trade() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-贸易帐 https://data.eastmoney.com/cjsj/foreign_7_2.html :return: 贸易帐 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00102022")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 零售销售月率 def macro_canada_retail_rate_monthly() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-零售销售月率 https://data.eastmoney.com/cjsj/foreign_7_3.html :return: 零售销售月率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG01337094")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 央行公布利率决议 def macro_canada_bank_rate() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-央行公布利率决议 https://data.eastmoney.com/cjsj/foreign_7_4.html :return: 央行公布利率决议 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00342248")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 核心消费者物价指数年率 def macro_canada_core_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-核心消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_7_5.html :return: 核心消费者物价指数年率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00102030")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 核心消费者物价指数月率 def macro_canada_core_cpi_monthly() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-核心消费者物价指数月率 https://data.eastmoney.com/cjsj/foreign_7_6.html :return: 核心消费者物价指数月率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00102044")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 消费者物价指数年率 def macro_canada_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_7_7.html :return: 消费者物价指数年率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00102029")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # 消费者物价指数月率 def macro_canada_cpi_monthly() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-消费者物价指数月率 https://data.eastmoney.com/cjsj/foreign_7_8.html :return: 消费者物价指数月率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00158719")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df # GDP 月率 def macro_canada_gdp_monthly() -> pd.DataFrame: """ 东方财富-经济数据-加拿大-GDP 月率 https://data.eastmoney.com/cjsj/foreign_7_9.html :return: GDP 月率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00159259")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date return temp_df if __name__ == "__main__": macro_canada_new_house_rate_df = macro_canada_new_house_rate() print(macro_canada_new_house_rate_df) macro_canada_unemployment_rate_df = macro_canada_unemployment_rate() print(macro_canada_unemployment_rate_df) macro_canada_trade_df = macro_canada_trade() print(macro_canada_trade_df) macro_canada_retail_rate_monthly_df = macro_canada_retail_rate_monthly() print(macro_canada_retail_rate_monthly_df) macro_canada_bank_rate_df = macro_canada_bank_rate() print(macro_canada_bank_rate_df) macro_canada_core_cpi_yearly_df = macro_canada_core_cpi_yearly() print(macro_canada_core_cpi_yearly_df) macro_canada_core_cpi_monthly_df = macro_canada_core_cpi_monthly() print(macro_canada_core_cpi_monthly_df) macro_canada_cpi_yearly_df = macro_canada_cpi_yearly() print(macro_canada_cpi_yearly_df) macro_canada_cpi_monthly_df = macro_canada_cpi_monthly() print(macro_canada_cpi_monthly_df) macro_canada_gdp_monthly_df = macro_canada_gdp_monthly() print(macro_canada_gdp_monthly_df) ================================================ FILE: akshare/economic/macro_china.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/11/12 15:20 Desc: 宏观数据-中国 """ import datetime import json import math import ssl import time import pandas as pd import requests from requests.adapters import HTTPAdapter from urllib3.poolmanager import PoolManager from akshare.economic.cons import ( JS_CHINA_ENERGY_DAILY_URL, ) from akshare.utils import demjson from akshare.utils.tqdm import get_tqdm class TLSAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False): ctx = ssl.create_default_context() # 降低安全级别以兼容旧服务器 ctx.set_ciphers("DEFAULT@SECLEVEL=1") # 禁用不安全的协议 ctx.options |= ssl.OP_NO_SSLv2 ctx.options |= ssl.OP_NO_SSLv3 # 指定使用 TLSv1.2 self.poolmanager = PoolManager( num_pools=connections, maxsize=maxsize, block=block, ssl_version=ssl.PROTOCOL_TLSv1_2, ssl_context=ctx, ) def __macro_china_base_func(symbol: str, params: dict) -> pd.DataFrame: """ 金十数据中心-经济指标-美国-基础函数 https://datacenter.jin10.com/economic :return: 美国经济指标数据 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings(action="ignore", category=FutureWarning) headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } url = "https://datacenter-api.jin10.com/reports/list_v2" params = params big_df = pd.DataFrame() while True: r = requests.get(url, params=params, headers=headers) data_json = r.json() if not data_json["data"]["values"]: break temp_df = pd.DataFrame(data_json["data"]["values"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) last_date_str = temp_df.iat[-1, 0] last_date_str = ( ( datetime.datetime.strptime(last_date_str, "%Y-%m-%d") - datetime.timedelta(days=1) ) .date() .isoformat() ) params.update({"max_date": f"{last_date_str}"}) big_df.columns = [ "日期", "今值", "预测值", "前值", ] big_df["商品"] = symbol big_df = big_df[ [ "商品", "日期", "今值", "预测值", "前值", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["今值"] = pd.to_numeric(big_df["今值"], errors="coerce") big_df["预测值"] = pd.to_numeric(big_df["预测值"], errors="coerce") big_df["前值"] = pd.to_numeric(big_df["前值"], errors="coerce") big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df # 企业商品价格指数 def macro_china_qyspjg() -> pd.DataFrame: """ 东方财富-经济数据一览-中国-企业商品价格指数 https://data.eastmoney.com/cjsj/qyspjg.html :return: 企业商品价格指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,FARM_BASE,FARM_BASE_SAME," "FARM_BASE_SEQUENTIAL,MINERAL_BASE,MINERAL_BASE_SAME,MINERAL_BASE_SEQUENTIAL," "ENERGY_BASE,ENERGY_BASE_SAME,ENERGY_BASE_SEQUENTIAL", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_GOODS_INDEX", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "REPORT_DATE": "-", "TIME": "月份", "BASE": "总指数-指数值", "BASE_SAME": "总指数-同比增长", "BASE_SEQUENTIAL": "总指数-环比增长", "FARM_BASE": "农产品-指数值", "FARM_BASE_SAME": "农产品-同比增长", "FARM_BASE_SEQUENTIAL": "农产品-环比增长", "MINERAL_BASE": "矿产品-指数值", "MINERAL_BASE_SAME": "矿产品-同比增长", "MINERAL_BASE_SEQUENTIAL": "矿产品-环比增长", "ENERGY_BASE": "煤油电-指数值", "ENERGY_BASE_SAME": "煤油电-同比增长", "ENERGY_BASE_SEQUENTIAL": "煤油电-环比增长", }, inplace=True, ) temp_df = temp_df[ [ "月份", "总指数-指数值", "总指数-同比增长", "总指数-环比增长", "农产品-指数值", "农产品-同比增长", "农产品-环比增长", "矿产品-指数值", "矿产品-同比增长", "矿产品-环比增长", "煤油电-指数值", "煤油电-同比增长", "煤油电-环比增长", ] ] 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" ) 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" ) 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" ) 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" ) return temp_df # 外商直接投资数据 def macro_china_fdi() -> pd.DataFrame: """ 东方财富-经济数据一览-中国-外商直接投资数据 https://data.eastmoney.com/cjsj/fdi.html :return: 外商直接投资数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,ACTUAL_FOREIGN,ACTUAL_FOREIGN_SAME,ACTUAL_FOREIGN_SEQUENTIAL," "ACTUAL_FOREIGN_ACCUMULATE,FOREIGN_ACCUMULATE_SAME", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_FDI", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "当月-同比增长", "当月-环比增长", "累计", "累计-同比增长", ] temp_df = temp_df[ [ "月份", "当月", "当月-同比增长", "当月-环比增长", "累计", "累计-同比增长", ] ] 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") temp_df["累计"] = pd.to_numeric(temp_df["累计"], errors="coerce") temp_df["累计-同比增长"] = pd.to_numeric(temp_df["累计-同比增长"], errors="coerce") temp_df.sort_values(["月份"], ignore_index=True, inplace=True) return temp_df # 中国社会融资规模数据 def macro_china_shrzgm() -> pd.DataFrame: """ 商务数据中心-国内贸易-社会融资规模增量统计 https://data.mofcom.gov.cn/gnmy/shrzgm.shtml :return: 社会融资规模增量统计 :rtype: pandas.DataFrame """ session = requests.Session() session.mount(prefix="https://", adapter=TLSAdapter()) url = "https://data.mofcom.gov.cn/datamofcom/front/gnmy/shrzgmQuery" r = session.post(url) data_json = r.json() temp_df = pd.DataFrame(data_json) temp_df.columns = [ "月份", "其中-未贴现银行承兑汇票", "其中-委托贷款", "其中-委托贷款外币贷款", "其中-人民币贷款", "其中-企业债券", "社会融资规模增量", "其中-非金融企业境内股票融资", "其中-信托贷款", ] temp_df = temp_df[ [ "月份", "社会融资规模增量", "其中-人民币贷款", "其中-委托贷款外币贷款", "其中-委托贷款", "其中-信托贷款", "其中-未贴现银行承兑汇票", "其中-企业债券", "其中-非金融企业境内股票融资", ] ] 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" ) 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" ) temp_df["其中-企业债券"] = pd.to_numeric(temp_df["其中-企业债券"], errors="coerce") temp_df["其中-非金融企业境内股票融资"] = pd.to_numeric( temp_df["其中-非金融企业境内股票融资"], errors="coerce" ) temp_df.sort_values(["月份"], inplace=True) temp_df.reset_index(drop=True, inplace=True) return temp_df def macro_china_urban_unemployment() -> pd.DataFrame: """ 国家统计局-月度数据-城镇调查失业率 https://data.stats.gov.cn/dg/website/page.html#/pc/national/monthData :return: 城镇调查失业率 :rtype: pandas.DataFrame """ url = "https://data.stats.gov.cn/dg/website/publicrelease/web/external/getEsDataByCidAndDt" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36", "Content-Type": "application/json", } payload = { "cid": "ee3b7046b390415b9b7745e3d16f6052", "indicatorIds": [ "3888eac6062945a79c8a27e5f13d4953", "1d550f3ec77a463bb607d4a3427e1465", "1c1b2d9ab24048bfadc5c7d9510dc663", "3921da310de24f14b6457c235657baf9", "bd6da1abb26046c2acb38aa701d90e86", "7bc1bd5daeac48ae8bb413c34ece1d08", "c03a36c9562246b6bc8aab010951ef1c", "1061f276ce354907b0b9900c266cf851", "40ab91b1ef4948e89633c5c7f55b9713" ], "daCatalogId": "", "das": [ { "text": "全国", "value": "000000000000" } ], "dts": ["199001MM-203601MM"], "showType": "1", "rootId": "fc982599aa684be7969d7b90b1bd0e84" } r = requests.post(url, json=payload, headers=headers, timeout=10) data_json = r.json() data_list = [] for month_item in data_json['data']: raw_month = month_item['name'] year_part = raw_month.split('年')[0] month_part = raw_month.split('年')[1].replace('月', '') month_clean = year_part + month_part.zfill(2) for value_item in month_item['values']: if value_item['_name'] == '城镇调查失业率': rate = value_item['value'] if rate: indicator_clean = value_item['i_showname'].replace(' (%)', '') data_list.append([month_clean, indicator_clean, rate]) temp_df = pd.DataFrame(data_list, columns=['date', 'item', 'value']) temp_df.sort_values(by=['date'], ascending=True, inplace=True) temp_df.reset_index(drop=True, inplace=True) return temp_df # 金十数据中心-经济指标-中国-国民经济运行状况-经济状况-中国GDP年率报告 def macro_china_gdp_yearly() -> pd.DataFrame: """ 金十数据中心-中国 GDP 年率报告, 数据区间从 20110120-至今 https://datacenter.jin10.com/reportType/dc_chinese_gdp_yoy :return: 中国 GDP 年率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "57", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国GDP年率报告", params=params) return temp_df # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国CPI年率报告 def macro_china_cpi_yearly() -> pd.DataFrame: """ 中国年度 CPI 数据, 数据区间从 19860201-至今 https://datacenter.jin10.com/reportType/dc_chinese_cpi_yoy :return: 中国年度 CPI 数据 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "56", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国CPI年率报告", params=params) return temp_df # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国CPI月率报告 def macro_china_cpi_monthly() -> pd.DataFrame: """ 中国月度 CPI 数据, 数据区间从 19960201-至今 https://datacenter.jin10.com/reportType/dc_chinese_cpi_mom :return: 中国月度 CPI 数据 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "72", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国CPI月率报告", params=params) return temp_df # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国PPI年率报告 def macro_china_ppi_yearly() -> pd.DataFrame: """ 中国年度 PPI 数据, 数据区间从 19950801-至今 https://datacenter.jin10.com/reportType/dc_chinese_ppi_yoy :return: 中国年度 PPI 数据 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "60", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国PPI年率报告", params=params) return temp_df # 金十数据中心-经济指标-中国-贸易状况-以美元计算出口年率报告 def macro_china_exports_yoy() -> pd.DataFrame: """ 中国以美元计算出口年率报告, 数据区间从 19820201-至今 https://datacenter.jin10.com/reportType/dc_chinese_exports_yoy :return: 中国以美元计算出口年率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "66", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func( symbol="中国以美元计算出口年率报告", params=params ) return temp_df # 金十数据中心-经济指标-中国-贸易状况-以美元计算进口年率 def macro_china_imports_yoy() -> pd.DataFrame: """ 中国以美元计算进口年率报告, 数据区间从 19960201-至今 https://datacenter.jin10.com/reportType/dc_chinese_imports_yoy https://cdn.jin10.com/dc/reports/dc_chinese_imports_yoy_all.js?v=1578754588 :return: 中国以美元计算进口年率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "77", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func( symbol="中国以美元计算进口年率报告", params=params ) return temp_df # 金十数据中心-经济指标-中国-贸易状况-以美元计算贸易帐(亿美元) def macro_china_trade_balance() -> pd.DataFrame: """ 中国以美元计算贸易帐报告, 数据区间从 19810201-至今 https://datacenter.jin10.com/reportType/dc_chinese_trade_balance https://cdn.jin10.com/dc/reports/dc_chinese_trade_balance_all.js?v=1578754677 :return: 中国以美元计算贸易帐报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "61", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国以美元计算贸易帐报告", params=params) return temp_df # 金十数据中心-经济指标-中国-产业指标-规模以上工业增加值年率 def macro_china_industrial_production_yoy() -> pd.DataFrame: """ 中国规模以上工业增加值年率报告, 数据区间从19900301-至今 https://datacenter.jin10.com/reportType/dc_chinese_industrial_production_yoy https://cdn.jin10.com/dc/reports/dc_chinese_industrial_production_yoy_all.js?v=1578754779 :return: 中国规模以上工业增加值年率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "58", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func( symbol="中国规模以上工业增加值年率报告", params=params ) return temp_df # 金十数据中心-经济指标-中国-产业指标-官方制造业PMI def macro_china_pmi_yearly() -> pd.DataFrame: """ 中国年度 PMI 数据, 数据区间从 20050201-至今 https://datacenter.jin10.com/reportType/dc_chinese_manufacturing_pmi :return: 中国年度 PMI 数据 :return: pandas.DataFrame """ t = time.time() params = { "category": "ec", "attr_id": "65", "max_date": "", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国官方制造业PMI", params=params) return temp_df # 金十数据中心-经济指标-中国-产业指标-财新制造业PMI终值 def macro_china_cx_pmi_yearly() -> pd.DataFrame: """ 中国年度财新 PMI 数据, 数据区间从 20120120-至今 https://datacenter.jin10.com/reportType/dc_chinese_caixin_manufacturing_pmi :return: 中国年度财新 PMI 数据 :return: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "73", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国财新制造业PMI终值报告", params=params) return temp_df # 金十数据中心-经济指标-中国-产业指标-财新服务业PMI def macro_china_cx_services_pmi_yearly() -> pd.DataFrame: """ 中国财新服务业PMI报告, 数据区间从 20120405-至今 https://datacenter.jin10.com/reportType/dc_chinese_caixin_services_pmi https://cdn.jin10.com/dc/reports/dc_chinese_caixin_services_pmi_all.js?v=1578818109 :return: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "67", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国财新服务业PMI报告", params=params) return temp_df # 金十数据中心-经济指标-中国-产业指标-中国官方非制造业PMI def macro_china_non_man_pmi() -> pd.DataFrame: """ 中国官方非制造业 PMI, 数据区间从 20160101-至今 https://datacenter.jin10.com/reportType/dc_chinese_non_manufacturing_pmi :return: 中国官方非制造业 PMI :return: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "75", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国官方非制造业PMI报告", params=params) return temp_df # 金十数据中心-经济指标-中国-金融指标-外汇储备(亿美元) def macro_china_fx_reserves_yearly() -> pd.DataFrame: """ 中国年度外汇储备数据, 数据区间从 20140115-至今 https://datacenter.jin10.com/reportType/dc_chinese_fx_reserves :return: 中国年度外汇储备数据 :return: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "76", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国外汇储备报告", params=params) return temp_df # 金十数据中心-经济指标-中国-金融指标-M2货币供应年率 def macro_china_m2_yearly() -> pd.DataFrame: """ 中国年度 M2 数据, 数据区间从 19980201-至今 https://datacenter.jin10.com/reportType/dc_chinese_m2_money_supply_yoy :return: 中国年度 M2 数据 :return: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "59", "_": str(int(round(t * 1000))), } temp_df = __macro_china_base_func(symbol="中国M2货币供应年率报告", params=params) return temp_df # 金十数据中心-经济指标-中国-金融指标-上海银行业同业拆借报告 def macro_china_shibor_all() -> pd.DataFrame: """ 上海银行业同业拆借报告, 数据区间从20170317-至今 https://datacenter.jin10.com/reportType/dc_shibor https://cdn.jin10.com/dc/reports/dc_shibor_all.js?v=1578755058 :return: 上海银行业同业拆借报告-今值(%) :rtype: pandas.DataFrame """ import numpy as np t = time.time() params = {"_": t} res = requests.get( url="https://cdn.jin10.com/data_center/reports/il_1.json", params=params ) json_data = res.json() temp_df = pd.DataFrame(json_data["values"]).T big_df = pd.DataFrame() temp_df.fillna(value="--", inplace=True) big_df["O/N-定价"] = temp_df["O/N"].apply(lambda x: x[0]) big_df["O/N-涨跌幅"] = temp_df["O/N"].apply(lambda x: x[1]) big_df["1W-定价"] = temp_df["1W"].apply(lambda x: x[0]) big_df["1W-涨跌幅"] = temp_df["1W"].apply(lambda x: x[1]) big_df["2W-定价"] = temp_df["2W"].apply(lambda x: x[0]) big_df["2W-涨跌幅"] = temp_df["2W"].apply(lambda x: x[1]) big_df["1M-定价"] = temp_df["1M"].apply(lambda x: x[0]) big_df["1M-涨跌幅"] = temp_df["1M"].apply(lambda x: x[1]) big_df["3M-定价"] = temp_df["3M"].apply(lambda x: x[0]) big_df["3M-涨跌幅"] = temp_df["3M"].apply(lambda x: x[1]) big_df["6M-定价"] = temp_df["6M"].apply(lambda x: x[0]) big_df["6M-涨跌幅"] = temp_df["6M"].apply(lambda x: x[1]) big_df["9M-定价"] = temp_df["9M"].apply(lambda x: x[0]) big_df["9M-涨跌幅"] = temp_df["9M"].apply(lambda x: x[1]) big_df["1Y-定价"] = temp_df["1Y"].apply(lambda x: x[0]) big_df["1Y-涨跌幅"] = temp_df["1Y"].apply(lambda x: x[1]) big_df = big_df.apply(lambda x: x.replace("-", np.nan)) big_df = big_df.apply(lambda x: x.replace([None], np.nan)) for item in big_df.columns: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") big_df.sort_index(inplace=True) big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) return big_df # 金十数据中心-经济指标-中国-金融指标-人民币香港银行同业拆息 def macro_china_hk_market_info() -> pd.DataFrame: """ 香港同业拆借报告, 数据区间从 20170320-至今 https://datacenter.jin10.com/reportType/dc_hk_market_info https://cdn.jin10.com/dc/reports/dc_hk_market_info_all.js?v=1578755471 :return: 香港同业拆借报告-今值(%) :rtype: pandas.DataFrame """ import numpy as np t = time.time() params = {"_": t} res = requests.get( url="https://cdn.jin10.com/data_center/reports/il_2.json", params=params ) json_data = res.json() temp_df = pd.DataFrame(json_data["values"]).T big_df = pd.DataFrame() temp_df.fillna(value="--", inplace=True) big_df["1W-定价"] = temp_df["1W"].apply(lambda x: x[0]) big_df["1W-涨跌幅"] = temp_df["1W"].apply(lambda x: x[1]) big_df["2W-定价"] = temp_df["2W"].apply(lambda x: x[0]) big_df["2W-涨跌幅"] = temp_df["2W"].apply(lambda x: x[1]) big_df["1M-定价"] = temp_df["1M"].apply(lambda x: x[0]) big_df["1M-涨跌幅"] = temp_df["1M"].apply(lambda x: x[1]) big_df["3M-定价"] = temp_df["3M"].apply(lambda x: x[0]) big_df["3M-涨跌幅"] = temp_df["3M"].apply(lambda x: x[1]) big_df["6M-定价"] = temp_df["6M"].apply(lambda x: x[0]) big_df["6M-涨跌幅"] = temp_df["6M"].apply(lambda x: x[1]) big_df["1Y-定价"] = temp_df["1Y"].apply(lambda x: x[0]) big_df["1Y-涨跌幅"] = temp_df["1Y"].apply(lambda x: x[1]) big_df["ON-定价"] = temp_df["ON"].apply(lambda x: x[0]) big_df["ON-涨跌幅"] = temp_df["ON"].apply(lambda x: x[1]) big_df["2M-定价"] = temp_df["2M"].apply(lambda x: x[0]) big_df["2M-涨跌幅"] = temp_df["2M"].apply(lambda x: x[1]) big_df = big_df.apply(lambda x: x.replace("-", np.nan)) big_df = big_df.apply(lambda x: x.replace([None], np.nan)) for item in big_df.columns: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") big_df.sort_index(inplace=True) big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) return big_df # 金十数据中心-经济指标-中国-其他-中国日度沿海六大电库存数据 def macro_china_daily_energy() -> pd.DataFrame: """ 中国日度沿海六大电库存数据, 数据区间从20160101-至今 https://datacenter.jin10.com/reportType/dc_qihuo_energy_report :return: pandas.DataFrame """ t = time.time() res = requests.get( JS_CHINA_ENERGY_DAILY_URL.format( str(int(round(t * 1000))), str(int(round(t * 1000)) + 90) ) ) json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1]) date_list = [item["date"] for item in json_data["list"]] value_list = [ item["datas"]["沿海六大电厂库存动态报告"] for item in json_data["list"] ] value_df = pd.DataFrame(value_list) value_df.columns = json_data["kinds"] value_df.index = pd.to_datetime(date_list) temp_df = value_df[["沿海六大电库存", "日耗", "存煤可用天数"]] temp_df.name = "energy" temp_df = temp_df.astype(float) temp_df.reset_index(inplace=True) temp_df.rename(columns={"index": "日期"}, inplace=True) temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date return temp_df # 金十数据中心-经济指标-中国-其他-中国人民币汇率中间价报告 def macro_china_rmb() -> pd.DataFrame: """ 中国人民币汇率中间价报告, 数据区间从 20170103-至今 https://datacenter.jin10.com/reportType/dc_rmb_data :return: 中国人民币汇率中间价报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": t} res = requests.get( "https://cdn.jin10.com/data_center/reports/exchange_rate.json", params=params, ) json_data = res.json() temp_df = pd.DataFrame(json_data["values"]).T big_df = pd.DataFrame() temp_df.fillna(value="--", inplace=True) big_df["美元/人民币_中间价"] = temp_df["美元/人民币"].apply(lambda x: x[0]) big_df["美元/人民币_涨跌幅"] = temp_df["美元/人民币"].apply(lambda x: x[1]) big_df["欧元/人民币_中间价"] = temp_df["欧元/人民币"].apply(lambda x: x[0]) big_df["欧元/人民币_涨跌幅"] = temp_df["欧元/人民币"].apply(lambda x: x[1]) big_df["100日元/人民币_中间价"] = temp_df["100日元/人民币"].apply(lambda x: x[0]) big_df["100日元/人民币_涨跌幅"] = temp_df["100日元/人民币"].apply(lambda x: x[1]) big_df["港元/人民币_中间价"] = temp_df["港元/人民币"].apply(lambda x: x[0]) big_df["港元/人民币_涨跌幅"] = temp_df["港元/人民币"].apply(lambda x: x[1]) big_df["英镑/人民币_中间价"] = temp_df["英镑/人民币"].apply(lambda x: x[0]) big_df["英镑/人民币_涨跌幅"] = temp_df["英镑/人民币"].apply(lambda x: x[1]) big_df["澳元/人民币_中间价"] = temp_df["澳元/人民币"].apply(lambda x: x[0]) big_df["澳元/人民币_涨跌幅"] = temp_df["澳元/人民币"].apply(lambda x: x[1]) big_df["新西兰元/人民币_中间价"] = temp_df["新西兰元/人民币"].apply(lambda x: x[0]) big_df["新西兰元/人民币_涨跌幅"] = temp_df["新西兰元/人民币"].apply(lambda x: x[1]) big_df["新加坡元/人民币_中间价"] = temp_df["新加坡元/人民币"].apply(lambda x: x[0]) big_df["新加坡元/人民币_涨跌幅"] = temp_df["新加坡元/人民币"].apply(lambda x: x[1]) big_df["瑞郎/人民币_中间价"] = temp_df["瑞郎/人民币"].apply(lambda x: x[0]) big_df["瑞郎/人民币_涨跌幅"] = temp_df["瑞郎/人民币"].apply(lambda x: x[1]) big_df["加元/人民币_中间价"] = temp_df["加元/人民币"].apply(lambda x: x[0]) big_df["加元/人民币_涨跌幅"] = temp_df["加元/人民币"].apply(lambda x: x[1]) big_df["人民币/马来西亚林吉特_中间价"] = temp_df["人民币/马来西亚林吉特"].apply( lambda x: x[0] ) big_df["人民币/马来西亚林吉特_涨跌幅"] = temp_df["人民币/马来西亚林吉特"].apply( lambda x: x[1] ) big_df["人民币/俄罗斯卢布_中间价"] = temp_df["人民币/俄罗斯卢布"].apply( lambda x: x[0] ) big_df["人民币/俄罗斯卢布_涨跌幅"] = temp_df["人民币/俄罗斯卢布"].apply( lambda x: x[1] ) big_df["人民币/南非兰特_中间价"] = temp_df["人民币/南非兰特"].apply(lambda x: x[0]) big_df["人民币/南非兰特_涨跌幅"] = temp_df["人民币/南非兰特"].apply(lambda x: x[1]) big_df["人民币/韩元_中间价"] = temp_df["人民币/韩元"].apply(lambda x: x[0]) big_df["人民币/韩元_涨跌幅"] = temp_df["人民币/韩元"].apply(lambda x: x[1]) big_df["人民币/阿联酋迪拉姆_中间价"] = temp_df["人民币/阿联酋迪拉姆"].apply( lambda x: x[0] ) big_df["人民币/阿联酋迪拉姆_涨跌幅"] = temp_df["人民币/阿联酋迪拉姆"].apply( lambda x: x[1] ) big_df["人民币/沙特里亚尔_中间价"] = temp_df["人民币/沙特里亚尔"].apply( lambda x: x[0] ) big_df["人民币/沙特里亚尔_涨跌幅"] = temp_df["人民币/沙特里亚尔"].apply( lambda x: x[1] ) big_df["人民币/匈牙利福林_中间价"] = temp_df["人民币/匈牙利福林"].apply( lambda x: x[0] ) big_df["人民币/匈牙利福林_涨跌幅"] = temp_df["人民币/匈牙利福林"].apply( lambda x: x[1] ) big_df["人民币/波兰兹罗提_中间价"] = temp_df["人民币/波兰兹罗提"].apply( lambda x: x[0] ) big_df["人民币/波兰兹罗提_涨跌幅"] = temp_df["人民币/波兰兹罗提"].apply( lambda x: x[1] ) big_df["人民币/丹麦克朗_中间价"] = temp_df["人民币/丹麦克朗"].apply(lambda x: x[0]) big_df["人民币/丹麦克朗_涨跌幅"] = temp_df["人民币/丹麦克朗"].apply(lambda x: x[1]) big_df["人民币/瑞典克朗_中间价"] = temp_df["人民币/瑞典克朗"].apply(lambda x: x[0]) big_df["人民币/瑞典克朗_涨跌幅"] = temp_df["人民币/瑞典克朗"].apply(lambda x: x[1]) big_df["人民币/挪威克朗_中间价"] = temp_df["人民币/挪威克朗"].apply(lambda x: x[0]) big_df["人民币/挪威克朗_涨跌幅"] = temp_df["人民币/挪威克朗"].apply(lambda x: x[1]) big_df["人民币/土耳其里拉_中间价"] = temp_df["人民币/土耳其里拉"].apply( lambda x: x[0] ) big_df["人民币/土耳其里拉_涨跌幅"] = temp_df["人民币/土耳其里拉"].apply( lambda x: x[1] ) big_df["人民币/墨西哥比索_中间价"] = temp_df["人民币/墨西哥比索"].apply( lambda x: x[0] ) big_df["人民币/墨西哥比索_涨跌幅"] = temp_df["人民币/墨西哥比索"].apply( lambda x: x[1] ) big_df["人民币/泰铢_定价"] = temp_df["人民币/泰铢"].apply(lambda x: x[0]) big_df["人民币/泰铢_涨跌幅"] = temp_df["人民币/泰铢"].apply(lambda x: x[1]) big_df = big_df.apply(lambda x: x.replace("-", pd.NA)) big_df = big_df.apply(lambda x: x.replace([None], pd.NA)) big_df.sort_index(inplace=True) big_df.fillna(0, inplace=True) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) return big_df # 金十数据中心-经济指标-中国-其他-深圳融资融券报告 def macro_china_market_margin_sz() -> pd.DataFrame: """ 深圳融资融券报告, 数据区间从20100331-至今 https://datacenter.jin10.com/reportType/dc_market_margin_sz :return: pandas.DataFrame """ t = time.time() params = {"_": t} res = requests.get( url="https://cdn.jin10.com/data_center/reports/fs_2.json", params=params ) json_data = res.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.columns = [ "融资买入额", "融资余额", "融券卖出量", "融券余量", "融券余额", "融资融券余额", ] temp_df.sort_index(inplace=True) temp_df.index = pd.to_datetime(temp_df.index) temp_df = temp_df.astype("float") temp_df.reset_index(inplace=True) temp_df.rename(columns={"index": "日期"}, inplace=True) temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date return temp_df # 金十数据中心-经济指标-中国-其他-上海融资融券报告 def macro_china_market_margin_sh() -> pd.DataFrame: """ 上海融资融券报告, 数据区间从 20100331-至今 https://datacenter.jin10.com/reportType/dc_market_margin_sse :return: pandas.DataFrame """ url = "https://cdn.jin10.com/data_center/reports/fs_1.json" t = time.time() params = {"_": t} r = requests.get(url, params=params) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.reset_index(inplace=True) temp_df.columns = [ "日期", "融资买入额", "融资余额", "融券卖出量", "融券余量", "融券余额", "融资融券余额", ] temp_df.sort_values(by=["日期"], inplace=True, ignore_index=True) 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") 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") return temp_df # 金十数据中心-经济指标-中国-其他-上海黄金交易所报告 def macro_china_au_report() -> pd.DataFrame: """ 上海黄金交易所报告, 数据区间从20100331-至今 https://datacenter.jin10.com/reportType/dc_sge_report :return: pandas.DataFrame """ t = time.time() params = {"_": t} res = requests.get( url="https://cdn.jin10.com/data_center/reports/sge.json", params=params ) json_data = res.json() big_df = pd.DataFrame() for item in json_data["values"].keys(): temp_df = pd.DataFrame(json_data["values"][item]) temp_df["date"] = item temp_df.columns = [ "商品", "开盘价", "最高价", "最低价", "收盘价", "涨跌", "涨跌幅", "加权平均价", "成交量", "成交金额", "持仓量", "交收方向", "交收量", "日期", ] big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df = big_df[ [ "日期", "商品", "开盘价", "最高价", "最低价", "收盘价", "涨跌", "涨跌幅", "加权平均价", "成交量", "成交金额", "持仓量", "交收方向", "交收量", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], inplace=True, ignore_index=True) big_df["持仓量"] = pd.to_numeric(big_df["持仓量"], errors="coerce") big_df["交收量"] = pd.to_numeric(big_df["交收量"], errors="coerce") return big_df # 中国-利率-贷款报价利率 def macro_china_lpr() -> pd.DataFrame: """ LPR品种详细数据 https://data.eastmoney.com/cjsj/globalRateLPR.html :return: LPR品种详细数据 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings(action="ignore", category=FutureWarning) url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPTA_WEB_RATE", "columns": "ALL", "sortColumns": "TRADE_DATE", "sortTypes": "-1", "token": "894050c76af8597a853f5b408b759f5d", "pageNumber": "1", "pageSize": "500", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df["TRADE_DATE"] = pd.to_datetime(big_df["TRADE_DATE"], errors="coerce").dt.date big_df["LPR1Y"] = pd.to_numeric(big_df["LPR1Y"], errors="coerce") big_df["LPR5Y"] = pd.to_numeric(big_df["LPR5Y"], errors="coerce") big_df["RATE_1"] = pd.to_numeric(big_df["RATE_1"], errors="coerce") big_df["RATE_2"] = pd.to_numeric(big_df["RATE_2"], errors="coerce") big_df.sort_values(by=["TRADE_DATE"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df # 中国-新房价指数 def macro_china_new_house_price( city_first: str = "北京", city_second: str = "上海" ) -> pd.DataFrame: """ 中国-新房价指数 https://data.eastmoney.com/cjsj/newhouse.html :param city_first: 城市; 城市列表见目标网站 :type city_first: str :param city_second: 城市; 城市列表见目标网站 :type city_second: str :return: 新房价指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMY_HOUSE_PRICE", "columns": "REPORT_DATE,CITY,FIRST_COMHOUSE_SAME,FIRST_COMHOUSE_SEQUENTIAL,FIRST_COMHOUSE_BASE," "SECOND_HOUSE_SAME,SECOND_HOUSE_SEQUENTIAL,SECOND_HOUSE_BASE,REPORT_DAY", "filter": f'(CITY in ("{city_first}","{city_second}"))', "pageNumber": "1", "pageSize": "500", "sortColumns": "REPORT_DATE,CITY", "sortTypes": "-1,-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "日期", "城市", "新建商品住宅价格指数-同比", "新建商品住宅价格指数-环比", "新建商品住宅价格指数-定基", "二手住宅价格指数-同比", "二手住宅价格指数-环比", "二手住宅价格指数-定基", "-", ] temp_df = temp_df[ [ "日期", "城市", "新建商品住宅价格指数-同比", "新建商品住宅价格指数-环比", "新建商品住宅价格指数-定基", "二手住宅价格指数-同比", "二手住宅价格指数-环比", "二手住宅价格指数-定基", ] ] 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" ) 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" ) temp_df.sort_values(["日期"], ignore_index=True, inplace=True) return temp_df # 中国-企业景气及企业家信心指数 def macro_china_enterprise_boom_index() -> pd.DataFrame: """ https://data.eastmoney.com/cjsj/qyjqzs.html 中国-企业景气及企业家信心指数 :return: 企业景气及企业家信心指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BOOM_INDEX,FAITH_INDEX,BOOM_INDEX_SAME,BOOM_INDEX_SEQUENTIAL," "FAITH_INDEX_SAME,FAITH_INDEX_SEQUENTIAL", "pageNumber": "1", "pageSize": "500", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_BOOM_INDEX", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "季度", "企业景气指数-指数", "企业家信心指数-指数", "企业景气指数-同比", "企业景气指数-环比", "企业家信心指数-同比", "企业家信心指数-环比", ] temp_df = temp_df[ [ "季度", "企业景气指数-指数", "企业景气指数-同比", "企业景气指数-环比", "企业家信心指数-指数", "企业家信心指数-同比", "企业家信心指数-环比", ] ] 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" ) 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" ) return temp_df # 中国-全国税收收入 def macro_china_national_tax_receipts() -> pd.DataFrame: """ 中国-全国税收收入 https://data.eastmoney.com/cjsj/qgsssr.html :return: 全国税收收入 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,TAX_INCOME,TAX_INCOME_SAME,TAX_INCOME_SEQUENTIAL", "pageNumber": "1", "pageSize": "500", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_TAX", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = ["-", "季度", "税收收入合计", "较上年同期", "季度环比"] temp_df = temp_df[["季度", "税收收入合计", "较上年同期", "季度环比"]] 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") return temp_df # 中国-银行理财产品发行数量 def macro_china_bank_financing() -> pd.DataFrame: """ 银行理财产品发行数量 https://data.eastmoney.com/cjsj/hyzs_list_EMI01516267.html :return: 银行理财产品发行数量 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "1000", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI01516267")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date temp_df["最新值"] = pd.to_numeric(temp_df["最新值"]) temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"]) temp_df["近3月涨跌幅"] = pd.to_numeric(temp_df["近3月涨跌幅"]) temp_df["近6月涨跌幅"] = pd.to_numeric(temp_df["近6月涨跌幅"]) temp_df["近1年涨跌幅"] = pd.to_numeric(temp_df["近1年涨跌幅"]) temp_df["近2年涨跌幅"] = pd.to_numeric(temp_df["近2年涨跌幅"]) temp_df["近3年涨跌幅"] = pd.to_numeric(temp_df["近3年涨跌幅"]) temp_df.sort_values(["日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df def macro_china_insurance_income() -> pd.DataFrame: """ 原保险保费收入 https://data.eastmoney.com/cjsj/hyzs_list_EMM00088870.html :return: 原保险保费收入 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "1000", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMM00088870")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date temp_df["最新值"] = pd.to_numeric(temp_df["最新值"]) temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"]) temp_df["近3月涨跌幅"] = pd.to_numeric(temp_df["近3月涨跌幅"]) temp_df["近6月涨跌幅"] = pd.to_numeric(temp_df["近6月涨跌幅"]) temp_df["近1年涨跌幅"] = pd.to_numeric(temp_df["近1年涨跌幅"]) temp_df["近2年涨跌幅"] = pd.to_numeric(temp_df["近2年涨跌幅"]) temp_df["近3年涨跌幅"] = pd.to_numeric(temp_df["近3年涨跌幅"]) temp_df.sort_values(["日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df def macro_china_mobile_number() -> pd.DataFrame: """ 手机出货量 https://data.eastmoney.com/cjsj/hyzs_list_EMI00225823.html :return: 手机出货量 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "1000", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00225823")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.drop_duplicates(inplace=True) temp_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] temp_df["日期"] = pd.to_datetime(temp_df["日期"]).dt.date temp_df["最新值"] = pd.to_numeric(temp_df["最新值"]) temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"]) temp_df["近3月涨跌幅"] = pd.to_numeric(temp_df["近3月涨跌幅"]) temp_df["近6月涨跌幅"] = pd.to_numeric(temp_df["近6月涨跌幅"]) temp_df["近1年涨跌幅"] = pd.to_numeric(temp_df["近1年涨跌幅"]) temp_df["近2年涨跌幅"] = pd.to_numeric(temp_df["近2年涨跌幅"]) temp_df["近3年涨跌幅"] = pd.to_numeric(temp_df["近3年涨跌幅"]) temp_df.sort_values(["日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df def macro_china_vegetable_basket() -> pd.DataFrame: """ 菜篮子产品批发价格指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00009275.html :return: 菜篮子产品批发价格指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00009275")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_agricultural_product() -> pd.DataFrame: """ 农产品批发价格总指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00009274.html :return: 农产品批发价格总指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00009274")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_agricultural_index() -> pd.DataFrame: """ 农副指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00662543.html :return: 农副指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00662543")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_energy_index() -> pd.DataFrame: """ 能源指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00662539.html :return: 能源指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00662539")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_commodity_price_index() -> pd.DataFrame: """ 大宗商品价格 https://data.eastmoney.com/cjsj/hyzs_list_EMI00662535.html :return: 大宗商品价格 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00662535")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_global_sox_index() -> pd.DataFrame: """ 费城半导体指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00055562.html :return: 费城半导体指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00055562")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_yw_electronic_index() -> pd.DataFrame: """ 义乌小商品指数-电子元器件 https://data.eastmoney.com/cjsj/hyzs_list_EMI00055551.html :return: 义乌小商品指数-电子元器件 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00055551")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_construction_index() -> pd.DataFrame: """ 建材指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00662541.html :return: 建材指数 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings(action="ignore", category=FutureWarning) url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M," "CHANGERATE_1Y,CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00662541")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"], errors="coerce") big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce") big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"], errors="coerce") big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"], errors="coerce") big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"], errors="coerce") big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"], errors="coerce") big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"], errors="coerce") big_df.sort_values(by=["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_construction_price_index() -> pd.DataFrame: """ 建材价格指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00237146.html :return: 建材价格指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00237146")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_lpi_index() -> pd.DataFrame: """ 物流景气指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00352262.html :return: 物流景气指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00352262")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_bdti_index() -> pd.DataFrame: """ 原油运输指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00107668.html :return: 原油运输指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00107668")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_china_bsi_index() -> pd.DataFrame: """ 超灵便型船运价指数 https://data.eastmoney.com/cjsj/hyzs_list_EMI00107667.html :return: 超灵便型船运价指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMI00107667")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"]) big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"]) big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"]) big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"]) big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"]) big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"]) big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"]) big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def _em_macro_1(em_id) -> pd.DataFrame: """ 东财宏观数据的一种通用函数 :return: 处理后的数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" ind_id = '"' + em_id + '"' params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M," "CHANGERATE_6M,CHANGERATE_1Y,CHANGERATE_2Y,CHANGERATE_3Y", "filter": "(INDICATOR_ID=" + ind_id + ")", "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.drop_duplicates(inplace=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"], errors="coerce") big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce") big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"], errors="coerce") big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"], errors="coerce") big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"], errors="coerce") big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"], errors="coerce") big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"], errors="coerce") big_df.sort_values(by=["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_shipping_bci() -> pd.DataFrame: """ 海岬型运费指数(BCI) https://data.eastmoney.com/cjsj/hyzs_list_EMI00107666.html :return: 海岬型运费指数 :rtype: pandas.DataFrame """ ts = _em_macro_1("EMI00107666") return ts def macro_shipping_bdi() -> pd.DataFrame: """ 波罗的海干散货指数(BDI) https://data.eastmoney.com/cjsj/hyzs_list_EMI00107664.html :return: 波罗的海干散货指数 :rtype: pandas.DataFrame """ ts = _em_macro_1("EMI00107664") return ts def macro_shipping_bpi() -> pd.DataFrame: """ 巴拿马型运费指数(BPI) https://data.eastmoney.com/cjsj/hyzs_list_EMI00107665.html :return: 巴拿马型运费指数 :rtype: pandas.DataFrame """ ts = _em_macro_1("EMI00107665") return ts def macro_shipping_bcti() -> pd.DataFrame: """ 成品油运输指数(BCTI) https://data.eastmoney.com/cjsj/hyzs_list_EMI00107669.html :return: 成品油运输指数 :rtype: pandas.DataFrame """ ts = _em_macro_1("EMI00107669") return ts def macro_china_new_financial_credit() -> pd.DataFrame: """ 中国-新增信贷数据 https://data.eastmoney.com/cjsj/xzxd.html :return: 新增信贷数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,RMB_LOAN,RMB_LOAN_SAME,RMB_LOAN_SEQUENTIAL," "RMB_LOAN_ACCUMULATE,LOAN_ACCUMULATE_SAME", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_RMB_LOAN", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "当月-同比增长", "当月-环比增长", "累计", "累计-同比增长", ] temp_df = temp_df[ ["月份", "当月", "当月-同比增长", "当月-环比增长", "累计", "累计-同比增长"] ] 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") temp_df["累计"] = pd.to_numeric(temp_df["累计"], errors="coerce") temp_df["累计-同比增长"] = pd.to_numeric(temp_df["累计-同比增长"], errors="coerce") return temp_df def macro_china_fx_gold() -> pd.DataFrame: """ 东方财富-外汇和黄金储备 https://data.eastmoney.com/cjsj/hjwh.html :return: 外汇和黄金储备 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", } params = { "columns": "REPORT_DATE,TIME,GOLD_RESERVES,GOLD_RESERVES_SAME," "GOLD_RESERVES_SEQUENTIAL,FOREX,FOREX_SAME,FOREX_SEQUENTIAL", "pageNumber": "1", "pageSize": "1000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_GOLD_CURRENCY", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "黄金储备-数值", "黄金储备-同比", "黄金储备-环比", "国家外汇储备-数值", "国家外汇储备-同比", "国家外汇储备-环比", ] temp_df = temp_df[ [ "月份", "黄金储备-数值", "黄金储备-同比", "黄金储备-环比", "国家外汇储备-数值", "国家外汇储备-同比", "国家外汇储备-环比", ] ] 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" ) 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") temp_df.sort_values(by=["月份"], inplace=True, ignore_index=True) return temp_df def macro_china_stock_market_cap() -> pd.DataFrame: """ 东方财富-全国股票交易统计表 https://data.eastmoney.com/cjsj/gpjytj.html :return: 全国股票交易统计表 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", } params = { "reportName": "RPT_ECONOMY_STOCK_STATISTICS", "columns": "REPORT_DATE,TIME,TOTAL_SHARES_SH,TOTAL_MARKE_SH,DEAL_AMOUNT_SH,VOLUME_SH,HIGH_INDEX_SH," "LOW_INDEX_SH,TOTAL_SZARES_SZ,TOTAL_MARKE_SZ,DEAL_AMOUNT_SZ,VOLUME_SZ,HIGH_INDEX_SZ,LOW_INDEX_SZ", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageNumber": "1", "pageSize": "1000", "source": "WEB", "client": "WEB", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "数据日期", "发行总股本-上海", "市价总值-上海", "成交金额-上海", "成交量-上海", "A股最高综合股价指数-上海", "A股最低综合股价指数-上海", "发行总股本-深圳", "市价总值-深圳", "成交金额-深圳", "成交量-深圳", "A股最高综合股价指数-深圳", "A股最低综合股价指数-深圳", ] temp_df = temp_df[ [ "数据日期", "发行总股本-上海", "发行总股本-深圳", "市价总值-上海", "市价总值-深圳", "成交金额-上海", "成交金额-深圳", "成交量-上海", "成交量-深圳", "A股最高综合股价指数-上海", "A股最高综合股价指数-深圳", "A股最低综合股价指数-上海", "A股最低综合股价指数-深圳", ] ] 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") 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") temp_df["成交量-上海"] = pd.to_numeric(temp_df["成交量-上海"], errors="coerce") temp_df["成交量-深圳"] = pd.to_numeric(temp_df["成交量-深圳"], errors="coerce") temp_df["A股最高综合股价指数-上海"] = pd.to_numeric( temp_df["A股最高综合股价指数-上海"], errors="coerce" ) temp_df["A股最高综合股价指数-深圳"] = pd.to_numeric( temp_df["A股最高综合股价指数-深圳"], errors="coerce" ) temp_df["A股最低综合股价指数-上海"] = pd.to_numeric( temp_df["A股最低综合股价指数-上海"], errors="coerce" ) temp_df["A股最低综合股价指数-深圳"] = pd.to_numeric( temp_df["A股最低综合股价指数-深圳"], errors="coerce" ) return temp_df def macro_china_money_supply() -> pd.DataFrame: """ 东方财富-货币供应量 https://data.eastmoney.com/cjsj/hbgyl.html :return: 货币供应量 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASIC_CURRENCY,BASIC_CURRENCY_SAME,BASIC_CURRENCY_SEQUENTIAL,CURRENCY," "CURRENCY_SAME,CURRENCY_SEQUENTIAL,FREE_CASH,FREE_CASH_SAME,FREE_CASH_SEQUENTIAL", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_CURRENCY_SUPPLY", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "货币和准货币(M2)-数量(亿元)", "货币和准货币(M2)-同比增长", "货币和准货币(M2)-环比增长", "货币(M1)-数量(亿元)", "货币(M1)-同比增长", "货币(M1)-环比增长", "流通中的现金(M0)-数量(亿元)", "流通中的现金(M0)-同比增长", "流通中的现金(M0)-环比增长", ] temp_df = temp_df[ [ "月份", "货币和准货币(M2)-数量(亿元)", "货币和准货币(M2)-同比增长", "货币和准货币(M2)-环比增长", "货币(M1)-数量(亿元)", "货币(M1)-同比增长", "货币(M1)-环比增长", "流通中的现金(M0)-数量(亿元)", "流通中的现金(M0)-同比增长", "流通中的现金(M0)-环比增长", ] ] temp_df["货币和准货币(M2)-数量(亿元)"] = pd.to_numeric( temp_df["货币和准货币(M2)-数量(亿元)"], errors="coerce" ) temp_df["货币和准货币(M2)-同比增长"] = pd.to_numeric( temp_df["货币和准货币(M2)-同比增长"], errors="coerce" ) temp_df["货币和准货币(M2)-环比增长"] = pd.to_numeric( temp_df["货币和准货币(M2)-环比增长"], errors="coerce" ) temp_df["货币(M1)-数量(亿元)"] = pd.to_numeric( temp_df["货币(M1)-数量(亿元)"], errors="coerce" ) temp_df["货币(M1)-同比增长"] = pd.to_numeric( temp_df["货币(M1)-同比增长"], errors="coerce" ) temp_df["货币(M1)-环比增长"] = pd.to_numeric( temp_df["货币(M1)-环比增长"], errors="coerce" ) temp_df["流通中的现金(M0)-数量(亿元)"] = pd.to_numeric( temp_df["流通中的现金(M0)-数量(亿元)"], errors="coerce" ) temp_df["流通中的现金(M0)-同比增长"] = pd.to_numeric( temp_df["流通中的现金(M0)-同比增长"], errors="coerce" ) temp_df["流通中的现金(M0)-环比增长"] = pd.to_numeric( temp_df["流通中的现金(M0)-环比增长"], errors="coerce" ) return temp_df def macro_china_cpi() -> pd.DataFrame: """ 东方财富-中国居民消费价格指数 https://data.eastmoney.com/cjsj/cpi.html :return: 东方财富-中国居民消费价格指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,NATIONAL_SAME,NATIONAL_BASE,NATIONAL_SEQUENTIAL,NATIONAL_ACCUMULATE," "CITY_SAME,CITY_BASE,CITY_SEQUENTIAL,CITY_ACCUMULATE,RURAL_SAME," "RURAL_BASE,RURAL_SEQUENTIAL,RURAL_ACCUMULATE", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_CPI", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "全国-同比增长", "全国-当月", "全国-环比增长", "全国-累计", "城市-同比增长", "城市-当月", "城市-环比增长", "城市-累计", "农村-同比增长", "农村-当月", "农村-环比增长", "农村-累计", ] temp_df = temp_df[ [ "月份", "全国-当月", "全国-同比增长", "全国-环比增长", "全国-累计", "城市-当月", "城市-同比增长", "城市-环比增长", "城市-累计", "农村-当月", "农村-同比增长", "农村-环比增长", "农村-累计", ] ] 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") 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") 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") 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") return temp_df def macro_china_gdp() -> pd.DataFrame: """ 东方财富-中国国内生产总值 https://data.eastmoney.com/cjsj/gdp.html :return: 东方财富中国国内生产总值 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,DOMESTICL_PRODUCT_BASE,FIRST_PRODUCT_BASE,SECOND_PRODUCT_BASE," "THIRD_PRODUCT_BASE,SUM_SAME,FIRST_SAME,SECOND_SAME,THIRD_SAME", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_GDP", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "季度", "国内生产总值-绝对值", "第一产业-绝对值", "第二产业-绝对值", "第三产业-绝对值", "国内生产总值-同比增长", "第一产业-同比增长", "第二产业-同比增长", "第三产业-同比增长", ] temp_df = temp_df[ [ "季度", "国内生产总值-绝对值", "国内生产总值-同比增长", "第一产业-绝对值", "第一产业-同比增长", "第二产业-绝对值", "第二产业-同比增长", "第三产业-绝对值", "第三产业-同比增长", ] ] 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" ) 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" ) temp_df["第三产业-绝对值"] = pd.to_numeric( temp_df["第三产业-绝对值"], errors="coerce" ) temp_df["第三产业-同比增长"] = pd.to_numeric( temp_df["第三产业-同比增长"], errors="coerce" ) return temp_df def macro_china_ppi() -> pd.DataFrame: """ 东方财富-中国工业品出厂价格指数 https://data.eastmoney.com/cjsj/ppi.html :return: 东方财富中国工业品出厂价格指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_ACCUMULATE", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_PPI", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "当月同比增长", "累计", ] temp_df = temp_df[ [ "月份", "当月", "当月同比增长", "累计", ] ] 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") return temp_df def macro_china_pmi() -> pd.DataFrame: """ 东方财富-中国采购经理人指数 https://data.eastmoney.com/cjsj/pmi.html :return: 东方财富中国采购经理人指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,MAKE_INDEX,MAKE_SAME,NMAKE_INDEX,NMAKE_SAME", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_PMI", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "制造业-指数", "制造业-同比增长", "非制造业-指数", "非制造业-同比增长", ] temp_df = temp_df[ [ "月份", "制造业-指数", "制造业-同比增长", "非制造业-指数", "非制造业-同比增长", ] ] 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") temp_df["非制造业-同比增长"] = pd.to_numeric( temp_df["非制造业-同比增长"], errors="coerce" ) return temp_df def macro_china_gdzctz() -> pd.DataFrame: """ 东方财富-中国城镇固定资产投资 https://data.eastmoney.com/cjsj/gdzctz.html :return: 东方财富中国城镇固定资产投资 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,BASE_ACCUMULATE", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_ASSET_INVEST", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "同比增长", "环比增长", "自年初累计", ] temp_df = temp_df[ [ "月份", "当月", "同比增长", "环比增长", "自年初累计", ] ] 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") temp_df["自年初累计"] = pd.to_numeric(temp_df["自年初累计"], errors="coerce") return temp_df def macro_china_hgjck() -> pd.DataFrame: """ 东方财富-海关进出口增减情况一览表 https://data.eastmoney.com/cjsj/hgjck.html :return: 东方财富-海关进出口增减情况一览表 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,EXIT_BASE,IMPORT_BASE,EXIT_BASE_SAME,IMPORT_BASE_SAME," "EXIT_BASE_SEQUENTIAL,IMPORT_BASE_SEQUENTIAL,EXIT_ACCUMULATE," "IMPORT_ACCUMULATE,EXIT_ACCUMULATE_SAME,IMPORT_ACCUMULATE_SAME", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_CUSTOMS", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "REPORT_DATE": "-", "TIME": "月份", "EXIT_BASE": "当月出口额-金额", "IMPORT_BASE": "当月进口额-金额", "EXIT_BASE_SAME": "当月出口额-同比增长", "IMPORT_BASE_SAME": "当月进口额-同比增长", "EXIT_BASE_SEQUENTIAL": "当月出口额-环比增长", "IMPORT_BASE_SEQUENTIAL": "当月进口额-环比增长", "EXIT_ACCUMULATE": "累计出口额-金额", "IMPORT_ACCUMULATE": "累计进口额-金额", "EXIT_ACCUMULATE_SAME": "累计出口额-同比增长", "IMPORT_ACCUMULATE_SAME": "累计进口额-同比增长", }, inplace=True, ) temp_df = temp_df[ [ "月份", "当月出口额-金额", "当月出口额-同比增长", "当月出口额-环比增长", "当月进口额-金额", "当月进口额-同比增长", "当月进口额-环比增长", "累计出口额-金额", "累计出口额-同比增长", "累计进口额-金额", "累计进口额-同比增长", ] ] 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" ) 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" ) 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" ) temp_df["累计进口额-同比增长"] = pd.to_numeric( temp_df["累计进口额-同比增长"], errors="coerce" ) return temp_df def macro_china_czsr() -> pd.DataFrame: """ 东方财富-财政收入 https://data.eastmoney.com/cjsj/czsr.html :return: 东方财富-财政收入 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,BASE_ACCUMULATE,ACCUMULATE_SAME", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_INCOME", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "当月-同比增长", "当月-环比增长", "累计", "累计-同比增长", ] temp_df = temp_df[ [ "月份", "当月", "当月-同比增长", "当月-环比增长", "累计", "累计-同比增长", ] ] 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") temp_df["累计"] = pd.to_numeric(temp_df["累计"], errors="coerce") temp_df["累计-同比增长"] = pd.to_numeric(temp_df["累计-同比增长"], errors="coerce") temp_df.sort_values(by=["月份"], ignore_index=True, inplace=True) return temp_df def macro_china_whxd() -> pd.DataFrame: """ 东方财富-外汇贷款数据 https://data.eastmoney.com/cjsj/whxd.html :return: 东方财富-外汇贷款数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,BASE_ACCUMULATE", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_FOREX_LOAN", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "同比增长", "环比增长", "累计", ] temp_df = temp_df[ [ "月份", "当月", "同比增长", "环比增长", "累计", ] ] 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") temp_df["累计"] = pd.to_numeric(temp_df["累计"], errors="coerce") temp_df.sort_values(by=["月份"], ignore_index=True, inplace=True) return temp_df def macro_china_wbck() -> pd.DataFrame: """ 东方财富-本外币存款 https://data.eastmoney.com/cjsj/wbck.html :return: 东方财富-本外币存款 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE,BASE_SAME,BASE_SEQUENTIAL,BASE_ACCUMULATE", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_FOREX_DEPOSIT", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "同比增长", "环比增长", "累计", ] temp_df = temp_df[ [ "月份", "当月", "同比增长", "环比增长", "累计", ] ] 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") temp_df["累计"] = pd.to_numeric(temp_df["累计"], errors="coerce") return temp_df def macro_china_xfzxx() -> pd.DataFrame: """ 东方财富网-经济数据一览-消费者信心指数 https://data.eastmoney.com/cjsj/xfzxx.html :return: 消费者信心指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,CONSUMERS_FAITH_INDEX,FAITH_INDEX_SAME,FAITH_INDEX_SEQUENTIAL," "CONSUMERS_ASTIS_INDEX,ASTIS_INDEX_SAME,ASTIS_INDEX_SEQUENTIAL,CONSUMERS_EXPECT_INDEX," "EXPECT_INDEX_SAME,EXPECT_INDEX_SEQUENTIAL", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_FAITH_INDEX", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "消费者信心指数-指数值", "消费者信心指数-同比增长", "消费者信心指数-环比增长", "消费者满意指数-指数值", "消费者满意指数-同比增长", "消费者满意指数-环比增长", "消费者预期指数-指数值", "消费者预期指数-同比增长", "消费者预期指数-环比增长", ] temp_df = temp_df[ [ "月份", "消费者信心指数-指数值", "消费者信心指数-同比增长", "消费者信心指数-环比增长", "消费者满意指数-指数值", "消费者满意指数-同比增长", "消费者满意指数-环比增长", "消费者预期指数-指数值", "消费者预期指数-同比增长", "消费者预期指数-环比增长", ] ] 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" ) 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" ) 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" ) return temp_df def macro_china_gyzjz() -> pd.DataFrame: """ 东方财富网-经济数据-工业增加值增长 https://data.eastmoney.com/cjsj/gyzjz.html :return: 工业增加值增长 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,TIME,BASE_SAME,BASE_ACCUMULATE", "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_INDUS_GROW", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "发布时间", "月份", "同比增长", "累计增长", ] temp_df = temp_df[ [ "月份", "同比增长", "累计增长", "发布时间", ] ] temp_df["同比增长"] = pd.to_numeric(temp_df["同比增长"], errors="coerce") temp_df["累计增长"] = pd.to_numeric(temp_df["累计增长"], errors="coerce") temp_df["发布时间"] = pd.to_datetime(temp_df["发布时间"], errors="coerce").dt.date temp_df.sort_values(["发布时间"], ignore_index=True, inplace=True) return temp_df def macro_china_reserve_requirement_ratio() -> pd.DataFrame: """ 存款准备金率 https://data.eastmoney.com/cjsj/ckzbj.html :return: 存款准备金率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "columns": "REPORT_DATE,PUBLISH_DATE,TRADE_DATE,INTEREST_RATE_BB,INTEREST_RATE_BA,CHANGE_RATE_B," "INTEREST_RATE_SB,INTEREST_RATE_SA,CHANGE_RATE_S,NEXT_SH_RATE,NEXT_SZ_RATE,REMARK", "pageNumber": "1", "pageSize": "2000", "sortColumns": "PUBLISH_DATE,TRADE_DATE", "sortTypes": "-1,-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_DEPOSIT_RESERVE", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "公布时间", "生效时间", "大型金融机构-调整前", "大型金融机构-调整后", "大型金融机构-调整幅度", "中小金融机构-调整前", "中小金融机构-调整后", "中小金融机构-调整幅度", "消息公布次日指数涨跌-上证", "消息公布次日指数涨跌-深证", "备注", ] temp_df = temp_df[ [ "公布时间", "生效时间", "大型金融机构-调整前", "大型金融机构-调整后", "大型金融机构-调整幅度", "中小金融机构-调整前", "中小金融机构-调整后", "中小金融机构-调整幅度", "消息公布次日指数涨跌-上证", "消息公布次日指数涨跌-深证", "备注", ] ] 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" ) 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" ) 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" ) return temp_df def macro_china_consumer_goods_retail() -> pd.DataFrame: """ 东方财富-经济数据-社会消费品零售总额 https://data.eastmoney.com/cjsj/xfp.html :return: 社会消费品零售总额 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", } params = { "columns": "REPORT_DATE,TIME,RETAIL_TOTAL,RETAIL_TOTAL_SAME,RETAIL_TOTAL_SEQUENTIAL," "RETAIL_TOTAL_ACCUMULATE,RETAIL_ACCUMULATE_SAME", "pageNumber": "1", "pageSize": "1000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "reportName": "RPT_ECONOMY_TOTAL_RETAIL", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "月份", "当月", "同比增长", "环比增长", "累计", "累计-同比增长", ] temp_df = temp_df[ [ "月份", "当月", "同比增长", "环比增长", "累计", "累计-同比增长", ] ] 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") temp_df["累计"] = pd.to_numeric(temp_df["累计"], errors="coerce") temp_df["累计-同比增长"] = pd.to_numeric(temp_df["累计-同比增长"], errors="coerce") return temp_df def macro_china_society_electricity() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-全社会用电分类情况表 https://finance.sina.com.cn/mac/#industry-6-0-31-1 :return: 全社会用电分类情况表 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601557771972/MacPage_Service.get_pagedata" params = { "cate": "industry", "event": "6", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) for i in range(1, page_num): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.columns = [ "统计时间", "全社会用电量", "全社会用电量同比", "各行业用电量合计", "各行业用电量合计同比", "第一产业用电量", "第一产业用电量同比", "第二产业用电量", "第二产业用电量同比", "第三产业用电量", "第三产业用电量同比", "城乡居民生活用电量合计", "城乡居民生活用电量合计同比", "城镇居民用电量", "城镇居民用电量同比", "乡村居民用电量", "乡村居民用电量同比", ] for item in big_df.columns[1:]: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") big_df.sort_values(["统计时间"], inplace=True, ignore_index=True) return big_df def macro_china_society_traffic_volume() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-全社会客货运输量 https://finance.sina.com.cn/mac/#industry-10-0-31-1 :return: 全社会客货运输量 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601559094538/MacPage_Service.get_pagedata" params = { "cate": "industry", "event": "10", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]["非累计"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num), leave=False): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]["非累计"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] big_df["货运量"] = pd.to_numeric(big_df["货运量"], errors="coerce") big_df["货运量同比增长"] = pd.to_numeric(big_df["货运量同比增长"], errors="coerce") big_df["货物周转量"] = pd.to_numeric(big_df["货物周转量"], errors="coerce") big_df["公里货物周转量同比增长"] = pd.to_numeric( big_df["公里货物周转量同比增长"], errors="coerce" ) big_df["客运量"] = pd.to_numeric(big_df["客运量"], errors="coerce") big_df["客运量同比增长"] = pd.to_numeric(big_df["客运量同比增长"], errors="coerce") big_df["旅客周转量"] = pd.to_numeric(big_df["旅客周转量"], errors="coerce") big_df["公里旅客周转量同比增长"] = pd.to_numeric( big_df["公里旅客周转量同比增长"], errors="coerce" ) big_df["沿海主要港口货物吞吐量"] = pd.to_numeric( big_df["沿海主要港口货物吞吐量"], errors="coerce" ) big_df["沿海主要港口货物吞吐量同比增长"] = pd.to_numeric( big_df["沿海主要港口货物吞吐量同比增长"], errors="coerce" ) big_df["其中:外贸货物吞吐量"] = pd.to_numeric( big_df["其中:外贸货物吞吐量"], errors="coerce" ) big_df["其中:外贸货物吞吐量同比增长"] = pd.to_numeric( big_df["其中:外贸货物吞吐量同比增长"], errors="coerce" ) big_df["民航总周转量"] = pd.to_numeric(big_df["民航总周转量"], errors="coerce") big_df["公里民航总周转"] = pd.to_numeric(big_df["公里民航总周转"], errors="coerce") return big_df def macro_china_postal_telecommunicational() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-邮电业务基本情况 https://finance.sina.com.cn/mac/#industry-11-0-31-1 :return: 邮电业务基本情况 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601624495046/MacPage_Service.get_pagedata" params = { "cate": "industry", "event": "11", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]["非累计"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num), leave=False): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]["非累计"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] for item in big_df.columns[1:]: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") return big_df def macro_china_international_tourism_fx() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-国际旅游外汇收入构成 https://finance.sina.com.cn/mac/#industry-15-0-31-3 :return: 国际旅游外汇收入构成 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "industry", "event": "15", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num)): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] big_df["数量"] = pd.to_numeric(big_df["数量"], errors="coerce") big_df["比重"] = pd.to_numeric(big_df["比重"], errors="coerce") return big_df def macro_china_passenger_load_factor() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-民航客座率及载运率 https://finance.sina.com.cn/mac/#industry-20-0-31-1 :return: 民航客座率及载运率 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "industry", "event": "20", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num)): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] big_df["客座率"] = pd.to_numeric(big_df["客座率"], errors="coerce") big_df["载运率"] = pd.to_numeric(big_df["载运率"], errors="coerce") return big_df def _macro_china_freight_index() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-航贸运价指数 https://finance.sina.com.cn/mac/#industry-22-0-31-2 :return: 航贸运价指数 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "industry", "event": "22", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num)): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = big_df.append(temp_df, ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] return big_df def macro_china_freight_index() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-航贸运价指数 https://finance.sina.com.cn/mac/#industry-22-0-31-2 :return: 航贸运价指数 :rtype: pandas.DataFrame """ url = "http://quotes.sina.cn/mac/view/vMacExcle.php" params = { "cate": "industry", "event": "22", "from": "0", "num": 5000, "condition": "", } r = requests.get(url, params=params) columns_list = r.content.decode("gbk").split("\n")[2].split(", ") columns_list = [item.strip() for item in columns_list] content_list = r.content.decode("gbk").split("\n")[3:] big_df = ( pd.DataFrame([item.split(", ") for item in content_list], columns=columns_list) .dropna(axis=1, how="all") .dropna(axis=0) .iloc[:, :-1] ) big_df["波罗的海好望角型船运价指数BCI"] = pd.to_numeric( big_df["波罗的海好望角型船运价指数BCI"] ) big_df["灵便型船综合运价指数BHMI"] = pd.to_numeric( big_df["灵便型船综合运价指数BHMI"] ) big_df["波罗的海超级大灵便型船BSI指数"] = pd.to_numeric( big_df["波罗的海超级大灵便型船BSI指数"] ) big_df["波罗的海综合运价指数BDI"] = pd.to_numeric(big_df["波罗的海综合运价指数BDI"]) big_df["HRCI国际集装箱租船指数"] = pd.to_numeric(big_df["HRCI国际集装箱租船指数"]) big_df["油轮运价指数成品油运价指数BCTI"] = pd.to_numeric( big_df["油轮运价指数成品油运价指数BCTI"] ) big_df["油轮运价指数原油运价指数BDTI"] = pd.to_numeric( big_df["油轮运价指数原油运价指数BDTI"] ) return big_df def macro_china_central_bank_balance() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-央行货币当局资产负债 https://finance.sina.com.cn/mac/#fininfo-8-0-31-2 :return: 央行货币当局资产负债 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "fininfo", "event": "8", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num)): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] for item in big_df.columns[1:]: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") return big_df def macro_china_insurance() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-保险业经营情况 https://finance.sina.com.cn/mac/#fininfo-19-0-31-3 :return: 保险业经营情况 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "fininfo", "event": "19", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num)): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] for item in big_df.columns[2:]: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") return big_df def macro_china_supply_of_money() -> pd.DataFrame: """ 新浪财经-中国宏观经济数据-货币供应量 https://finance.sina.com.cn/mac/#fininfo-1-0-31-1 :return: 货币供应量 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "fininfo", "event": "1", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num)): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] for item in big_df.columns[1:]: big_df[item] = pd.to_numeric(big_df[item], errors="coerce") return big_df def macro_china_foreign_exchange_gold() -> pd.DataFrame: """ 央行黄金和外汇储备 https://finance.sina.com.cn/mac/#fininfo-5-0-31-2 :return: 央行黄金和外汇储备 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "fininfo", "event": "5", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num), leave=False): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] big_df.sort_values(by=["统计时间"], ignore_index=True, inplace=True) big_df["黄金储备"] = pd.to_numeric(big_df["黄金储备"], errors="coerce") big_df["国家外汇储备"] = pd.to_numeric(big_df["国家外汇储备"], errors="coerce") return big_df def macro_china_retail_price_index() -> pd.DataFrame: """ 商品零售价格指数 https://finance.sina.com.cn/mac/#price-12-0-31-1 :return: 商品零售价格指数 :rtype: pandas.DataFrame """ url = "https://quotes.sina.cn/mac/api/jsonp_v3.php/SINAREMOTECALLCALLBACK1601651495761/MacPage_Service.get_pagedata" params = { "cate": "price", "event": "12", "from": "0", "num": "31", "condition": "", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) page_num = math.ceil(int(data_json["count"]) / 31) big_df = pd.DataFrame(data_json["data"]) tqdm = get_tqdm() for i in tqdm(range(1, page_num), leave=False): params.update({"from": i * 31}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -3]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = [item[1] for item in data_json["config"]["all"]] big_df.sort_values(by=["统计月份"], ignore_index=True, inplace=True) big_df["零售商品价格指数"] = pd.to_numeric( big_df["零售商品价格指数"], errors="coerce" ) return big_df def macro_china_real_estate() -> pd.DataFrame: """ 国房景气指数 https://data.eastmoney.com/cjsj/hyzs_list_EMM00121987.html :return: 国房景气指数 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", } params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "1000", "pageNumber": "1", "reportName": "RPT_INDUSTRY_INDEX", "columns": "REPORT_DATE,INDICATOR_VALUE,CHANGE_RATE,CHANGERATE_3M,CHANGERATE_6M,CHANGERATE_1Y," "CHANGERATE_2Y,CHANGERATE_3Y", "filter": '(INDICATOR_ID="EMM00121987")', "source": "WEB", "client": "WEB", } r = requests.get(url, params=params, headers=headers) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageNumber": page}) r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df.columns = [ "日期", "最新值", "涨跌幅", "近3月涨跌幅", "近6月涨跌幅", "近1年涨跌幅", "近2年涨跌幅", "近3年涨跌幅", ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["最新值"] = pd.to_numeric(big_df["最新值"], errors="coerce") big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce") big_df["近3月涨跌幅"] = pd.to_numeric(big_df["近3月涨跌幅"], errors="coerce") big_df["近6月涨跌幅"] = pd.to_numeric(big_df["近6月涨跌幅"], errors="coerce") big_df["近1年涨跌幅"] = pd.to_numeric(big_df["近1年涨跌幅"], errors="coerce") big_df["近2年涨跌幅"] = pd.to_numeric(big_df["近2年涨跌幅"], errors="coerce") big_df["近3年涨跌幅"] = pd.to_numeric(big_df["近3年涨跌幅"], errors="coerce") big_df.sort_values(by=["日期"], inplace=True) big_df.drop_duplicates(inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df if __name__ == "__main__": # 企业商品价格指数 macro_china_qyspjg_df = macro_china_qyspjg() print(macro_china_qyspjg_df) # 外商直接投资数据 macro_china_fdi_df = macro_china_fdi() print(macro_china_fdi_df) # 社会融资规模增量 macro_china_shrzgm_df = macro_china_shrzgm() print(macro_china_shrzgm_df) # 城镇调查失业率 macro_china_urban_unemployment_df = macro_china_urban_unemployment() print(macro_china_urban_unemployment_df) # 金十数据中心-经济指标-中国-国民经济运行状况-经济状况-中国GDP年率报告 macro_china_gdp_yearly_df = macro_china_gdp_yearly() print(macro_china_gdp_yearly_df) # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国CPI年率报告 macro_china_cpi_yearly_df = macro_china_cpi_yearly() print(macro_china_cpi_yearly_df) # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国CPI月率报告 macro_china_cpi_monthly_df = macro_china_cpi_monthly() print(macro_china_cpi_monthly_df) # 金十数据中心-经济指标-中国-国民经济运行状况-物价水平-中国PPI年率报告 macro_china_ppi_yearly_df = macro_china_ppi_yearly() print(macro_china_ppi_yearly_df) # 金十数据中心-经济指标-中国-贸易状况-以美元计算出口年率报告 macro_china_exports_yoy_df = macro_china_exports_yoy() print(macro_china_exports_yoy_df) # 金十数据中心-经济指标-中国-贸易状况-以美元计算进口年率 macro_china_imports_yoy_df = macro_china_imports_yoy() print(macro_china_imports_yoy_df) # 金十数据中心-经济指标-中国-贸易状况-以美元计算贸易帐(亿美元) macro_china_trade_balance_df = macro_china_trade_balance() print(macro_china_trade_balance_df) # 金十数据中心-经济指标-中国-产业指标-规模以上工业增加值年率 macro_china_industrial_production_yoy_df = macro_china_industrial_production_yoy() print(macro_china_industrial_production_yoy_df) # 金十数据中心-经济指标-中国-产业指标-官方制造业PMI macro_china_pmi_yearly_df = macro_china_pmi_yearly() print(macro_china_pmi_yearly_df) # 金十数据中心-经济指标-中国-产业指标-财新制造业PMI终值 macro_china_cx_pmi_yearly_df = macro_china_cx_pmi_yearly() print(macro_china_cx_pmi_yearly_df) # 金十数据中心-经济指标-中国-产业指标-财新服务业PMI macro_china_cx_services_pmi_yearly_df = macro_china_cx_services_pmi_yearly() print(macro_china_cx_services_pmi_yearly_df) # 金十数据中心-经济指标-中国-产业指标-中国官方非制造业PMI macro_china_non_man_pmi_df = macro_china_non_man_pmi() print(macro_china_non_man_pmi_df) # 金十数据中心-经济指标-中国-金融指标-外汇储备(亿美元) macro_china_fx_reserves_yearly_df = macro_china_fx_reserves_yearly() print(macro_china_fx_reserves_yearly_df) # 金十数据中心-经济指标-中国-金融指标-M2货币供应年率 macro_china_m2_yearly_df = macro_china_m2_yearly() print(macro_china_m2_yearly_df) # 金十数据中心-经济指标-中国-金融指标-上海银行业同业拆借报告 macro_china_shibor_all_df = macro_china_shibor_all() print(macro_china_shibor_all_df) # 金十数据中心-经济指标-中国-金融指标-人民币香港银行同业拆息 macro_china_hk_market_info_df = macro_china_hk_market_info() print(macro_china_hk_market_info_df) # 金十数据中心-经济指标-中国-其他-中国日度沿海六大电库存数据 macro_china_daily_energy_df = macro_china_daily_energy() print(macro_china_daily_energy_df) # 金十数据中心-经济指标-中国-其他-中国人民币汇率中间价报告 macro_china_rmb_df = macro_china_rmb() print(macro_china_rmb_df) # 金十数据中心-经济指标-中国-其他-深圳融资融券报告 macro_china_market_margin_sz_df = macro_china_market_margin_sz() print(macro_china_market_margin_sz_df) # 金十数据中心-经济指标-中国-其他-上海融资融券报告 macro_china_market_margin_sh_df = macro_china_market_margin_sh() print(macro_china_market_margin_sh_df) # 金十数据中心-经济指标-中国-其他-上海黄金交易所报告 macro_china_au_report_df = macro_china_au_report() print(macro_china_au_report_df) # 中国-新房价指数 macro_china_new_house_price_df = macro_china_new_house_price() print(macro_china_new_house_price_df) # 中国-企业景气及企业家信心指数 macro_china_enterprise_boom_index_df = macro_china_enterprise_boom_index() print(macro_china_enterprise_boom_index_df) # 中国-全国税收收入 macro_china_national_tax_receipts_df = macro_china_national_tax_receipts() print(macro_china_national_tax_receipts_df) # 中国-新增信贷数据 macro_china_new_financial_credit_df = macro_china_new_financial_credit() print(macro_china_new_financial_credit_df) # 中国-外汇和黄金储备 macro_china_fx_gold_df = macro_china_fx_gold() print(macro_china_fx_gold_df) macro_china_stock_market_cap_df = macro_china_stock_market_cap() print(macro_china_stock_market_cap_df) macro_china_money_supply_df = macro_china_money_supply() print(macro_china_money_supply_df) macro_china_cpi_df = macro_china_cpi() print(macro_china_cpi_df) macro_china_gdp_df = macro_china_gdp() print(macro_china_gdp_df) macro_china_ppi_df = macro_china_ppi() print(macro_china_ppi_df) macro_china_pmi_df = macro_china_pmi() print(macro_china_pmi_df) macro_china_gdzctz_df = macro_china_gdzctz() print(macro_china_gdzctz_df) macro_china_hgjck_df = macro_china_hgjck() print(macro_china_hgjck_df) macro_china_czsr_df = macro_china_czsr() print(macro_china_czsr_df) macro_china_whxd_df = macro_china_whxd() print(macro_china_whxd_df) macro_china_wbck_df = macro_china_wbck() print(macro_china_wbck_df) macro_china_xfzxx_df = macro_china_xfzxx() print(macro_china_xfzxx_df) macro_china_gyzjz_df = macro_china_gyzjz print(macro_china_gyzjz_df) macro_china_reserve_requirement_ratio_df = macro_china_reserve_requirement_ratio() print(macro_china_reserve_requirement_ratio_df) macro_china_consumer_goods_retail_df = macro_china_consumer_goods_retail() print(macro_china_consumer_goods_retail_df) macro_china_society_electricity_df = macro_china_society_electricity() print(macro_china_society_electricity_df) macro_china_society_traffic_volume_df = macro_china_society_traffic_volume() print(macro_china_society_traffic_volume_df) macro_china_postal_telecommunicational_df = macro_china_postal_telecommunicational() print(macro_china_postal_telecommunicational_df) macro_china_international_tourism_fx_df = macro_china_international_tourism_fx() print(macro_china_international_tourism_fx_df) macro_china_passenger_load_factor_df = macro_china_passenger_load_factor() print(macro_china_passenger_load_factor_df) macro_china_freight_index_df = macro_china_freight_index() print(macro_china_freight_index_df) macro_china_central_bank_balance_df = macro_china_central_bank_balance() print(macro_china_central_bank_balance_df) macro_china_insurance_df = macro_china_insurance() print(macro_china_insurance_df) macro_china_supply_of_money_df = macro_china_supply_of_money() print(macro_china_supply_of_money_df) macro_china_foreign_exchange_gold_df = macro_china_foreign_exchange_gold() print(macro_china_foreign_exchange_gold_df) macro_china_retail_price_index_df = macro_china_retail_price_index() print(macro_china_retail_price_index_df) macro_china_real_estate_df = macro_china_real_estate() print(macro_china_real_estate_df) macro_shipping_bci_df = macro_shipping_bci() print(macro_shipping_bci_df) macro_shipping_bdi_df = macro_shipping_bdi() print(macro_shipping_bdi_df) macro_shipping_bpi_df = macro_shipping_bpi() print(macro_shipping_bpi_df) macro_shipping_bcti_df = macro_shipping_bcti() print(macro_shipping_bcti_df) ================================================ FILE: akshare/economic/macro_china_hk.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/3 16:21 Desc: 中国-香港-宏观指标 https://data.eastmoney.com/cjsj/foreign_8_0.html """ import pandas as pd import requests def macro_china_hk_core(symbol: str = "EMG00341602") -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-宏观经济-日本-核心代码 https://data.eastmoney.com/cjsj/foreign_1_0.html :param symbol: 代码 :type symbol: str :return: 指定 symbol 的数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_HK", "columns": "ALL", "filter": f'(INDICATOR_ID="{symbol}")', "pageNumber": "1", "pageSize": "5000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "COUNTRY": "-", "INDICATOR_ID": "-", "INDICATOR_NAME": "-", "REPORT_DATE_CH": "时间", "REPORT_DATE": "-", "PUBLISH_DATE": "发布日期", "VALUE": "现值", "PRE_VALUE": "前值", "INDICATOR_IDOLD": "-", }, inplace=True, ) temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True) return temp_df def macro_china_hk_cpi() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-消费者物价指数 https://data.eastmoney.com/cjsj/foreign_8_0.html :return: 消费者物价指数 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG01336996") return temp_df def macro_china_hk_cpi_ratio() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_8_1.html :return: 消费者物价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG00059282") return temp_df def macro_china_hk_rate_of_unemployment() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-失业率 https://data.eastmoney.com/cjsj/foreign_8_2.html :return: 失业率 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG00059647") return temp_df def macro_china_hk_gbp() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港 GDP https://data.eastmoney.com/cjsj/foreign_8_3.html :return: 香港 GDP :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG01337008") return temp_df def macro_china_hk_gbp_ratio() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港 GDP 同比 https://data.eastmoney.com/cjsj/foreign_8_4.html :return: 香港 GDP 同比 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG01337009") return temp_df def macro_china_hk_building_volume() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港楼宇买卖合约数量 https://data.eastmoney.com/cjsj/foreign_8_5.html :return: 香港楼宇买卖合约数量 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG00158055") return temp_df def macro_china_hk_building_amount() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港楼宇买卖合约成交金额 https://data.eastmoney.com/cjsj/foreign_8_6.html :return: 香港楼宇买卖合约成交金额 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG00158066") return temp_df def macro_china_hk_trade_diff_ratio() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港商品贸易差额年率 https://data.eastmoney.com/cjsj/foreign_8_7.html :return: 香港商品贸易差额年率 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG00157898") return temp_df def macro_china_hk_ppi() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港制造业 PPI 年率 https://data.eastmoney.com/cjsj/foreign_8_8.html :return: 香港制造业 PPI 年率 :rtype: pandas.DataFrame """ temp_df = macro_china_hk_core(symbol="EMG00157818") return temp_df if __name__ == "__main__": macro_china_hk_cpi_df = macro_china_hk_cpi() print(macro_china_hk_cpi_df) macro_china_hk_cpi_ratio_df = macro_china_hk_cpi_ratio() print(macro_china_hk_cpi_ratio_df) macro_china_hk_rate_of_unemployment_df = macro_china_hk_rate_of_unemployment() print(macro_china_hk_rate_of_unemployment_df) macro_china_hk_gbp_df = macro_china_hk_gbp() print(macro_china_hk_gbp_df) macro_china_hk_gbp_ratio_df = macro_china_hk_gbp_ratio() print(macro_china_hk_gbp_ratio_df) marco_china_hk_building_volume_df = macro_china_hk_building_volume() print(marco_china_hk_building_volume_df) macro_china_hk_building_amount_df = macro_china_hk_building_amount() print(macro_china_hk_building_amount_df) macro_china_hk_trade_diff_ratio_df = macro_china_hk_trade_diff_ratio() print(macro_china_hk_trade_diff_ratio_df) macro_china_hk_ppi_df = macro_china_hk_ppi() print(macro_china_hk_ppi_df) ================================================ FILE: akshare/economic/macro_china_nbs.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/6/30 22:00 Desc: 中国-国家统计局-宏观数据 https://data.stats.gov.cn/easyquery.htm """ import time from functools import lru_cache from typing import Union, Literal, List, Dict import jsonpath as jp import numpy as np import pandas as pd import requests import urllib3 from urllib3.exceptions import InsecureRequestWarning # 忽略InsecureRequestWarning警告 urllib3.disable_warnings(InsecureRequestWarning) @lru_cache def _get_nbs_tree(idcode: str, dbcode: str) -> List[Dict]: """ 获取指标目录树 :param idcode: 指标编码 :param dbcode: 库编码 :return: json数据 """ url = "https://data.stats.gov.cn/easyquery.htm" params = {"id": idcode, "dbcode": dbcode, "wdcode": "zb", "m": "getTree"} r = requests.post(url, params=params, verify=False, allow_redirects=True) data_json = r.json() return data_json @lru_cache def _get_nbs_wds_tree(idcode: str, dbcode: str, rowcode: str) -> List[Dict]: """ 获取地区数据的可选指标目录树 :param idcode: 指标编码 :param dbcode: 库编码 :param rowcode: 值为zb是返回地区的编码,值为reg时返回可选指标的编码 :return: json数据 """ url = "https://data.stats.gov.cn/easyquery.htm" params = { "m": "getOtherWds", "dbcode": dbcode, "rowcode": rowcode, "colcode": "sj", "wds": '[{"wdcode":"zb","valuecode":"%s"}]' % idcode, "k1": str(time.time_ns())[:13], } r = requests.post(url, params=params, verify=False, allow_redirects=True) data_json = r.json() data_json = data_json["returndata"][0]["nodes"] return data_json def _get_code_from_nbs_tree(tree: List[Dict], name: str, target: str = "id") -> str: """ 根据指标名称从目录树中获取target编码 :param tree: 目录树 :param name: 指标名称 :param target: 指标编码属性名 :return: 指标编码 """ expr = f'$[?(@.name == "{name}")].{target}' ret = jp.jsonpath(tree, expr) if ret is False: raise ValueError("Please check if the data path or indicator is correct.") return ret[0] def macro_china_nbs_nation( kind: Literal["月度数据", "季度数据", "年度数据"], path: str, period: str = "LAST10" ) -> pd.DataFrame: """ 国家统计局全国数据通用接口 https://data.stats.gov.cn/easyquery.htm :param kind: 数据类别 :param path: 数据路径 :param period: 时间区间,例如'LAST10', '2016-2023', '2016-'等 :return: 国家统计局统计数据 :rtype: pandas.DataFrame """ # 获取dbcode kind_code = {"月度数据": "hgyd", "季度数据": "hgjd", "年度数据": "hgnd"} dbcode = kind_code[kind] # 获取最终id parent_tree = _get_nbs_tree("zb", dbcode) path_split = path.replace(" ", "").split(">") indicator_id = _get_code_from_nbs_tree(parent_tree, path_split[0]) path_split.pop(0) while path_split: temp_tree = _get_nbs_tree(indicator_id, dbcode) indicator_id = _get_code_from_nbs_tree(temp_tree, path_split[0]) path_split.pop(0) # 请求数据 url = "https://data.stats.gov.cn/easyquery.htm" params = { "m": "QueryData", "dbcode": dbcode, "rowcode": "zb", "colcode": "sj", "wds": "[]", "dfwds": '[{"wdcode":"zb","valuecode":"%s"}, ' '{"wdcode":"sj","valuecode":"%s"}]' % (indicator_id, period), "k1": str(time.time_ns())[:13], } r = requests.get(url, params=params, verify=False, allow_redirects=True) data_json = r.json() # 整理为dataframe temp_df = pd.DataFrame(data_json["returndata"]["datanodes"]) temp_df["data"] = temp_df["data"].apply( lambda x: x["data"] if x["hasdata"] else None ) wdnodes = data_json["returndata"]["wdnodes"] wn_df_list = [] for wn in wdnodes: wn_df_list.append( pd.DataFrame(wn["nodes"]) .assign( funit=lambda df: df["unit"].apply(lambda x: "(" + x + ")" if x else x) ) .assign(fname=lambda df: df["cname"] + df["funit"]), ) row_name, column_name = ( wn_df_list[0]["fname"], wn_df_list[1]["fname"], ) data_ndarray = np.reshape(temp_df["data"], (len(row_name), len(column_name))) data_df = pd.DataFrame(data=data_ndarray, columns=column_name, index=row_name) data_df.index.name = None data_df.columns.name = None return data_df def macro_china_nbs_region( kind: Literal[ "分省月度数据", "分省季度数据", "分省年度数据", "主要城市月度价格", "主要城市年度数据", "港澳台月度数据", "港澳台年度数据", ], path: str, indicator: Union[str, None], region: Union[str, None] = None, period: str = "LAST10", ) -> pd.DataFrame: """ 国家统计局地区数据通用接口 https://data.stats.gov.cn/easyquery.htm :param kind: 数据类别 :param path: 数据路径 :param indicator: 指定指标 :param region: 指定地区 当指定region时,将symbol设为None可以同时获得所有可选指标的值 :param period: 时间区间,例如'LAST10', '2016-2023', '2016-'等 :return: 国家统计局统计数据 :rtype: pandas.DataFrame """ if indicator is None and region is None: raise AssertionError("The indicator and region parameters cannot both be None.") # 获取dbcode kind_dict = { "分省月度数据": "fsyd", "分省季度数据": "fsjd", "分省年度数据": "fsnd", "主要城市月度价格": "csyd", "主要城市年度数据": "csnd", "港澳台月度数据": "gatyd", "港澳台年度数据": "gatnd", } dbcode = kind_dict[kind] # 获取最终id parent_tree = _get_nbs_tree("zb", dbcode) path_split = path.replace(" ", "").split(">") indicator_id = _get_code_from_nbs_tree(parent_tree, path_split[0]) path_split.pop(0) while path_split: temp_tree = _get_nbs_tree(indicator_id, dbcode) indicator_id = _get_code_from_nbs_tree(temp_tree, path_split[0]) path_split.pop(0) # 参数设定 if region is None: indicator_tree = _get_nbs_wds_tree(indicator_id, dbcode, "reg") indicator_id = _get_code_from_nbs_tree(indicator_tree, indicator, target="code") rowcode = "reg" colcode = "sj" wds = '[{"wdcode":"zb","valuecode":"%s"}]' % indicator_id dfwds = '[{"wdcode":"sj","valuecode":"%s"}]' % period else: if indicator is not None: indicator_tree = _get_nbs_wds_tree(indicator_id, dbcode, "reg") indicator_id = _get_code_from_nbs_tree( indicator_tree, indicator, target="code" ) region_tree = _get_nbs_wds_tree(indicator_id, dbcode, "zb") region_id = _get_code_from_nbs_tree(region_tree, region, target="code") rowcode = "zb" colcode = "sj" wds = '[{"wdcode":"reg","valuecode":"%s"}]' % region_id dfwds = ( '[{"wdcode":"zb","valuecode":"%s"}, ' '{"wdcode":"sj","valuecode":"%s"}]' % (indicator_id, period) ) # 请求数据 url = "https://data.stats.gov.cn/easyquery.htm" params = { "m": "QueryData", "dbcode": dbcode, "rowcode": rowcode, "colcode": colcode, "wds": wds, "dfwds": dfwds, "k1": str(time.time_ns())[:13], } r = requests.get(url, params=params, verify=False, allow_redirects=True) data_json = r.json() # 整理为dataframe temp_df = pd.DataFrame(data_json["returndata"]["datanodes"]) temp_df["data"] = temp_df["data"].apply( lambda x: x["data"] if x["hasdata"] else None ) wdnodes = data_json["returndata"]["wdnodes"] wn_df_list = [] for wn in wdnodes: wn_df_list.append( pd.DataFrame(wn["nodes"]) .assign( funit=lambda df: df["unit"].apply(lambda x: "(" + x + ")" if x else x) ) .assign(fname=lambda df: df["cname"] + df["funit"]), ) if region is None: row_name, column_name = wn_df_list[1]["fname"], wn_df_list[2]["fname"] title_name = wn_df_list[0]["fname"][0] else: row_name, column_name = wn_df_list[0]["fname"], wn_df_list[2]["fname"] title_name = wn_df_list[1]["fname"][0] data_ndarray = np.reshape(temp_df["data"], (len(row_name), len(column_name))) data_df = pd.DataFrame(data=data_ndarray, columns=column_name, index=row_name) data_df.index.name = None data_df.columns.name = title_name return data_df if __name__ == "__main__": macro_china_nbs_nation_df = macro_china_nbs_nation( kind="月度数据", path="工业 > 工业分大类行业出口交货值(2018-至今) > 废弃资源综合利用业", period="LAST5", ) print(macro_china_nbs_nation_df) macro_china_nbs_region_df = macro_china_nbs_region( kind="分省季度数据", path="人民生活 > 居民人均可支配收入", period="2018-2022", indicator=None, region="北京市", ) print(macro_china_nbs_region_df) macro_china_nbs_region_df = macro_china_nbs_region( kind="分省季度数据", path="国民经济核算 > 地区生产总值", period="2018-", indicator="地区生产总值_累计值(亿元)", ) print(macro_china_nbs_region_df) ================================================ FILE: akshare/economic/macro_constitute.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/3 16:08 Desc: 金十数据-数据中心-主要机构-宏观经济 https://datacenter.jin10.com/ """ import datetime import time import pandas as pd import requests from tqdm import tqdm def macro_cons_gold() -> pd.DataFrame: """ 全球最大黄金 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今 https://datacenter.jin10.com/reportType/dc_etf_gold :return: 持仓报告 :rtype: pandas.DataFrame """ t = time.time() headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "category": "etf", "attr_id": "1", "max_date": "", "_": str(int(round(t * 1000))), } big_df = pd.DataFrame() while True: r = requests.get(url, params=params, headers=headers) data_json = r.json() if not data_json["data"]["values"]: break temp_df = pd.DataFrame(data_json["data"]["values"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) last_date_str = temp_df.iat[-1, 0] last_date_str = ( ( datetime.datetime.strptime(last_date_str, "%Y-%m-%d") - datetime.timedelta(days=1) ) .date() .isoformat() ) params.update({"max_date": f"{last_date_str}"}) big_df.columns = [ "日期", "总库存", "增持/减持", "总价值", ] big_df["商品"] = "黄金" big_df = big_df[ [ "商品", "日期", "总库存", "增持/减持", "总价值", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["总库存"] = pd.to_numeric(big_df["总库存"], errors="coerce") big_df["增持/减持"] = pd.to_numeric(big_df["增持/减持"], errors="coerce") big_df["总价值"] = pd.to_numeric(big_df["总价值"], errors="coerce") big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_cons_silver() -> pd.DataFrame: """ 全球最大白银 ETF—SPDR Gold Trust 持仓报告, 数据区间从 20041118-至今 https://datacenter.jin10.com/reportType/dc_etf_sliver :return: 持仓报告 :rtype: pandas.DataFrame """ t = time.time() headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "category": "etf", "attr_id": "2", "max_date": "", "_": str(int(round(t * 1000))), } big_df = pd.DataFrame() while True: r = requests.get(url, params=params, headers=headers) data_json = r.json() if not data_json["data"]["values"]: break temp_df = pd.DataFrame(data_json["data"]["values"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) last_date_str = temp_df.iat[-1, 0] last_date_str = ( ( datetime.datetime.strptime(last_date_str, "%Y-%m-%d") - datetime.timedelta(days=1) ) .date() .isoformat() ) params.update({"max_date": f"{last_date_str}"}) big_df.columns = [ "日期", "总库存", "增持/减持", "总价值", ] big_df["商品"] = "白银" big_df = big_df[ [ "商品", "日期", "总库存", "增持/减持", "总价值", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["总库存"] = pd.to_numeric(big_df["总库存"], errors="coerce") big_df["增持/减持"] = pd.to_numeric(big_df["增持/减持"], errors="coerce") big_df["总价值"] = pd.to_numeric(big_df["总价值"], errors="coerce") big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def macro_cons_opec_month() -> pd.DataFrame: """ 欧佩克报告-月度, 数据区间从 20170118-至今 这里返回的具体索引日期的数据为上一个月的数据, 由于某些国家的数据有缺失 只选择有数据的国家返回 20200312:fix:由于 “厄瓜多尔” 已经有几个月没有更新数据,在这里加以剔除 https://datacenter.jin10.com/reportType/dc_opec_report :return: 欧佩克报告-月度 :rtype: pandas.DataFrame """ t = time.time() big_df = pd.DataFrame() headers = { "accept": "*/*", "accept-encoding": "gzip, deflate, br", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", "cache-control": "no-cache", "origin": "https://datacenter.jin10.com", "pragma": "no-cache", "referer": "https://datacenter.jin10.com/reportType/dc_opec_report", "sec-fetch-mode": "cors", "sec-fetch-site": "same-site", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/79.0.3945.117 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "", "x-version": "1.0.0", } res = requests.get( url=f"https://datacenter-api.jin10.com/reports/dates?category=opec&_={str(int(round(t * 1000)))}", headers=headers, ) # 日期序列 all_date_list = res.json()["data"] bar = tqdm(reversed(all_date_list)) for item in bar: bar.set_description(f"Please wait for a moment, now downloading {item}'s data") res = requests.get( url=f"https://datacenter-api.jin10.com/reports/list?" f"category=opec&date={item}&_={str(int(round(t * 1000)))}", headers=headers, ) temp_df = pd.DataFrame( res.json()["data"]["values"], columns=pd.DataFrame(res.json()["data"]["keys"])["name"].tolist(), ).T temp_df.columns = temp_df.iloc[0, :] temp_df = temp_df.iloc[1:, :] try: temp_df = temp_df[ [ "阿尔及利亚", "安哥拉", "加蓬", "伊朗", "伊拉克", "科威特", "利比亚", "尼日利亚", "沙特", "阿联酋", "委内瑞拉", "欧佩克产量", ] ].iloc[-2, :] except: # noqa: E722 temp_df = temp_df[ [ "阿尔及利亚", "安哥拉", "加蓬", "伊朗", "伊拉克", "科威特", "利比亚", "尼日利亚", "沙特", "阿联酋", "委内瑞拉", "欧佩克产量", ] ].iloc[-1, :] temp_df.dropna(inplace=True) big_df[temp_df.name] = temp_df big_df = big_df.T big_df = big_df.astype(float) big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.columns.name = None return big_df if __name__ == "__main__": macro_cons_gold_df = macro_cons_gold() print(macro_cons_gold_df) macro_cons_silver_df = macro_cons_silver() print(macro_cons_silver_df) macro_cons_opec_month_df = macro_cons_opec_month() print(macro_cons_opec_month_df) ================================================ FILE: akshare/economic/macro_euro.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/3 17:08 Desc: 金十数据中心-经济指标-欧元区 金十数据中心-经济指标-欧元区-国民经济运行状况-经济状况 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场 金十数据中心-经济指标-欧元区-贸易状况 金十数据中心-经济指标-欧元区-产业指标 金十数据中心-经济指标-欧元区-领先指标 """ import time import pandas as pd import requests from tqdm import tqdm # 金十数据中心-经济指标-欧元区-国民经济运行状况 # 金十数据中心-经济指标-欧元区-国民经济运行状况-经济状况 # 金十数据中心-经济指标-欧元区-国民经济运行状况-经济状况-欧元区季度GDP年率报告 def macro_euro_gdp_yoy() -> pd.DataFrame: """ 欧元区季度 GDP 年率报告, 数据区间从 20131114-至今 https://datacenter.jin10.com/reportType/dc_eurozone_gdp_yoy :return: 欧元区季度 GDP 年率报告 :rtype: pandas.DataFrame """ ec = 84 url = "https://datacenter-api.jin10.com/reports/dates" params = {"category": "ec", "attr_id": ec} headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区季度GDP年率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区CPI月率报告 def macro_euro_cpi_mom() -> pd.DataFrame: """ 欧元区 CPI 月率报告, 数据区间从 19900301-至今 https://datacenter.jin10.com/reportType/dc_eurozone_cpi_mom https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_mom_all.js?v=1578578318 :return: 欧元区CPI月率报告 :rtype: pandas.Series """ ec = 84 url = "https://datacenter-api.jin10.com/reports/dates" params = {"category": "ec", "attr_id": ec} headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区CPI月率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区CPI年率报告 def macro_euro_cpi_yoy() -> pd.DataFrame: """ 欧元区CPI年率报告, 数据区间从19910201-至今 https://datacenter.jin10.com/reportType/dc_eurozone_cpi_yoy https://cdn.jin10.com/dc/reports/dc_eurozone_cpi_yoy_all.js?v=1578578404 :return: 欧元区CPI年率报告-今值(%) :rtype: pandas.Series """ ec = 8 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区CPI年率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区PPI月率报告 def macro_euro_ppi_mom() -> pd.DataFrame: """ 欧元区PPI月率报告, 数据区间从19810301-至今 https://datacenter.jin10.com/reportType/dc_eurozone_ppi_mom https://cdn.jin10.com/dc/reports/dc_eurozone_ppi_mom_all.js?v=1578578493 :return: 欧元区PPI月率报告-今值(%) :rtype: pandas.Series """ ec = 36 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区PPI月率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区零售销售月率报告 def macro_euro_retail_sales_mom() -> pd.DataFrame: """ 欧元区零售销售月率报告, 数据区间从20000301-至今 https://datacenter.jin10.com/reportType/dc_eurozone_retail_sales_mom https://cdn.jin10.com/dc/reports/dc_eurozone_retail_sales_mom_all.js?v=1578578576 :return: 欧元区零售销售月率报告-今值(%) :rtype: pandas.Series """ ec = 38 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区零售销售月率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场-欧元区季调后就业人数季率报告 def macro_euro_employment_change_qoq() -> pd.DataFrame: """ 欧元区季调后就业人数季率报告, 数据区间从20083017-至今 https://datacenter.jin10.com/reportType/dc_eurozone_employment_change_qoq https://cdn.jin10.com/dc/reports/dc_eurozone_employment_change_qoq_all.js?v=1578578699 :return: 欧元区季调后就业人数季率报告-今值(%) :rtype: pandas.Series """ ec = 14 url = "https://datacenter-api.jin10.com/reports/dates" params = {"category": "ec", "attr_id": ec} headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区季调后就业人数季率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场-欧元区失业率报告 def macro_euro_unemployment_rate_mom() -> pd.DataFrame: """ 欧元区失业率报告, 数据区间从19980501-至今 https://datacenter.jin10.com/reportType/dc_eurozone_unemployment_rate_mom https://cdn.jin10.com/dc/reports/dc_eurozone_unemployment_rate_mom_all.js?v=1578578767 :return: 欧元区失业率报告-今值(%) :rtype: pandas.Series """ ec = 46 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区失业率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-贸易状况-欧元区未季调贸易帐报告 def macro_euro_trade_balance() -> pd.DataFrame: """ 欧元区未季调贸易帐报告, 数据区间从19990201-至今 https://datacenter.jin10.com/reportType/dc_eurozone_trade_balance_mom https://cdn.jin10.com/dc/reports/dc_eurozone_trade_balance_mom_all.js?v=1578577862 :return: 欧元区未季调贸易帐报告-今值(亿欧元) :rtype: pandas.Series """ ec = 43 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区未季调贸易帐" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-贸易状况-欧元区经常帐报告 def macro_euro_current_account_mom() -> pd.DataFrame: """ 欧元区经常帐报告, 数据区间从20080221-至今, 前两个值需要去掉 https://datacenter.jin10.com/reportType/dc_eurozone_current_account_mom https://cdn.jin10.com/dc/reports/dc_eurozone_current_account_mom_all.js?v=1578577976 :return: 欧元区经常帐报告-今值(亿欧元) :rtype: pandas.Series """ ec = 11 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区经常帐" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-产业指标-欧元区工业产出月率报告 def macro_euro_industrial_production_mom() -> pd.DataFrame: """ 欧元区工业产出月率报告, 数据区间从19910301-至今 https://datacenter.jin10.com/reportType/dc_eurozone_industrial_production_mom https://cdn.jin10.com/dc/reports/dc_eurozone_industrial_production_mom_all.js?v=1578577377 :return: 欧元区工业产出月率报告-今值(%) :rtype: pandas.Series """ ec = 19 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区工业产出月率" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-产业指标-欧元区制造业PMI初值报告 def macro_euro_manufacturing_pmi() -> pd.DataFrame: """ 欧元区制造业PMI初值报告, 数据区间从20080222-至今 https://datacenter.jin10.com/reportType/dc_eurozone_manufacturing_pmi https://cdn.jin10.com/dc/reports/dc_eurozone_manufacturing_pmi_all.js?v=1578577537 :return: 欧元区制造业PMI初值报告-今值 :rtype: pandas.Series """ ec = 30 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区制造业PMI初值" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-产业指标-欧元区服务业PMI终值报告 def macro_euro_services_pmi() -> pd.DataFrame: """ 欧元区服务业PMI终值报告, 数据区间从 20080222-至今 https://datacenter.jin10.com/reportType/dc_eurozone_services_pmi https://cdn.jin10.com/dc/reports/dc_eurozone_services_pmi_all.js?v=1578577639 :return: 欧元区服务业PMI终值报告-今值 :rtype: pandas.Series """ ec = 41 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区服务业PMI终值" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-领先指标-欧元区ZEW经济景气指数报告 def macro_euro_zew_economic_sentiment() -> pd.DataFrame: """ 欧元区ZEW经济景气指数报告, 数据区间从20080212-至今 https://datacenter.jin10.com/reportType/dc_eurozone_zew_economic_sentiment https://cdn.jin10.com/dc/reports/dc_eurozone_zew_economic_sentiment_all.js?v=1578577013 :return: 欧元区ZEW经济景气指数报告-今值 :rtype: pandas.Series """ ec = 48 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区ZEW经济景气指数" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-经济指标-欧元区-领先指标-欧元区Sentix投资者信心指数报告 def macro_euro_sentix_investor_confidence() -> pd.DataFrame: """ 欧元区Sentix投资者信心指数报告, 数据区间从20020801-至今 https://datacenter.jin10.com/reportType/dc_eurozone_sentix_investor_confidence https://cdn.jin10.com/dc/reports/dc_eurozone_sentix_investor_confidence_all.js?v=1578577195 :return: 欧元区Sentix投资者信心指数报告-今值 :rtype: pandas.Series """ ec = 40 url = "https://datacenter-api.jin10.com/reports/dates" params = { "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() date_list = data_json["data"] date_point_list = [item for num, item in enumerate(date_list) if num % 20 == 0] big_df = pd.DataFrame() for date in tqdm(date_point_list, leave=False): url = "https://datacenter-api.jin10.com/reports/list_v2" params = { "max_date": f"{date}", "category": "ec", "attr_id": ec, } headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame( data_json["data"]["values"], columns=[item["name"] for item in data_json["data"]["keys"]], ) big_df = pd.concat([big_df, temp_df], ignore_index=True) big_df["商品"] = "欧元区Sentix投资者信心指数" big_df = big_df[["商品", "日期", "今值", "预测值", "前值"]] big_df["今值"] = pd.to_numeric(big_df["今值"]) big_df["预测值"] = pd.to_numeric(big_df["预测值"]) big_df["前值"] = pd.to_numeric(big_df["前值"]) big_df["日期"] = pd.to_datetime(big_df["日期"]).dt.date big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-伦敦金属交易所(LME)-持仓报告 def macro_euro_lme_holding() -> pd.DataFrame: """ 伦敦金属交易所(LME)-持仓报告, 数据区间从 20151022-至今 https://datacenter.jin10.com/reportType/dc_lme_traders_report https://cdn.jin10.com/data_center/reports/lme_position.json?_=1591533934658 :return: 伦敦金属交易所(LME)-持仓报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/lme_position.json", params=params ) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.fillna(value="[0, 0, 0]", inplace=True) big_df = pd.DataFrame() for item in temp_df.columns: for i in range(3): inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i]) inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"] big_df = pd.concat(objs=[big_df, inner_temp_df], axis=1) big_df = big_df.astype("float") big_df = big_df.iloc[:-1, :].copy() big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-伦敦金属交易所(LME)-库存报告 def macro_euro_lme_stock() -> pd.DataFrame: """ 伦敦金属交易所(LME)-库存报告, 数据区间从 20140702-至今 https://datacenter.jin10.com/reportType/dc_lme_report https://cdn.jin10.com/data_center/reports/lme_stock.json?_=1591535304783 :return: 伦敦金属交易所(LME)-库存报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/lme_stock.json", params=params ) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T big_df = pd.DataFrame() for item in temp_df.columns: for i in range(3): inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i]) inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"] big_df = pd.concat(objs=[big_df, inner_temp_df], axis=1) big_df.sort_index(inplace=True) big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) return big_df if __name__ == "__main__": # 金十数据中心-经济指标-欧元区-国民经济运行状况 # 金十数据中心-经济指标-欧元区-国民经济运行状况-经济状况 # 金十数据中心-经济指标-欧元区-国民经济运行状况-经济状况-欧元区季度GDP年率报告 macro_euro_gdp_yoy_df = macro_euro_gdp_yoy() print(macro_euro_gdp_yoy_df) # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平 # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区CPI月率报告 macro_euro_cpi_mom_df = macro_euro_cpi_mom() print(macro_euro_cpi_mom_df) # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区CPI年率报告 macro_euro_cpi_yoy_df = macro_euro_cpi_yoy() print(macro_euro_cpi_yoy_df) # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区PPI月率报告 macro_euro_ppi_mom_df = macro_euro_ppi_mom() print(macro_euro_ppi_mom_df) # 金十数据中心-经济指标-欧元区-国民经济运行状况-物价水平-欧元区零售销售月率报告 macro_euro_retail_sales_mom_df = macro_euro_retail_sales_mom() print(macro_euro_retail_sales_mom_df) # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场 # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场-欧元区季调后就业人数季率报告 macro_euro_employment_change_qoq_df = macro_euro_employment_change_qoq() print(macro_euro_employment_change_qoq_df) # 金十数据中心-经济指标-欧元区-国民经济运行状况-劳动力市场-欧元区失业率报告 macro_euro_unemployment_rate_mom_df = macro_euro_unemployment_rate_mom() print(macro_euro_unemployment_rate_mom_df) # 金十数据中心-经济指标-欧元区-贸易状况 # 金十数据中心-经济指标-欧元区-贸易状况-欧元区未季调贸易帐报告 macro_euro_trade_balance_df = macro_euro_trade_balance() print(macro_euro_trade_balance_df) # 金十数据中心-经济指标-欧元区-贸易状况-欧元区经常帐报告 macro_euro_current_account_mom_df = macro_euro_current_account_mom() print(macro_euro_current_account_mom_df) # 金十数据中心-经济指标-欧元区-产业指标 # 金十数据中心-经济指标-欧元区-产业指标-欧元区工业产出月率报告 macro_euro_industrial_production_mom_df = macro_euro_industrial_production_mom() print(macro_euro_industrial_production_mom_df) # 金十数据中心-经济指标-欧元区-产业指标-欧元区制造业PMI初值报告 macro_euro_manufacturing_pmi_df = macro_euro_manufacturing_pmi() print(macro_euro_manufacturing_pmi_df) # 金十数据中心-经济指标-欧元区-产业指标-欧元区服务业PMI终值报告 macro_euro_services_pmi_df = macro_euro_services_pmi() print(macro_euro_services_pmi_df) # 金十数据中心-经济指标-欧元区-领先指标 # 金十数据中心-经济指标-欧元区-领先指标-欧元区ZEW经济景气指数报告 macro_euro_zew_economic_sentiment_df = macro_euro_zew_economic_sentiment() print(macro_euro_zew_economic_sentiment_df) # 金十数据中心-经济指标-欧元区-领先指标-欧元区Sentix投资者信心指数报告 macro_euro_sentix_investor_confidence_df = macro_euro_sentix_investor_confidence() print(macro_euro_sentix_investor_confidence_df) # 金十数据中心-伦敦金属交易所(LME)-持仓报告 macro_euro_lme_holding_df = macro_euro_lme_holding() print(macro_euro_lme_holding_df) # 金十数据中心-伦敦金属交易所(LME)-库存报告 macro_euro_lme_stock_df = macro_euro_lme_stock() print(macro_euro_lme_stock_df) ================================================ FILE: akshare/economic/macro_finance_ths.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/10/21 20:00 Desc: 同花顺-数据中心-宏观数据-股票筹资 https://data.10jqka.com.cn/macro/finance/ """ from io import StringIO import pandas as pd import requests def macro_stock_finance() -> pd.DataFrame: """ 同花顺-数据中心-宏观数据-股票筹资 https://data.10jqka.com.cn/macro/finance/ :return: 股票筹资 :rtype: pandas.DataFrame """ url = "https://data.10jqka.com.cn/macro/finance/" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" } r = requests.get(url, headers=headers) temp_df = pd.read_html(StringIO(r.text))[0] temp_df.rename( columns={ "月份": "月份", "募集资金(亿元)": "募集资金", "首发募集资金(亿元)": "首发募集资金", "增发募集资金(亿元)": "增发募集资金", "配股募集资金(亿元)": "配股募集资金", }, inplace=True, ) temp_df = temp_df[ ["月份", "募集资金", "首发募集资金", "增发募集资金", "配股募集资金"] ] 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") temp_df["配股募集资金"] = pd.to_numeric(temp_df["配股募集资金"], errors="coerce") temp_df.sort_values(by=["月份"], inplace=True, ignore_index=True) return temp_df def macro_rmb_loan() -> pd.DataFrame: """ 同花顺-数据中心-宏观数据-新增人民币贷款 https://data.10jqka.com.cn/macro/loan/ :return: 新增人民币贷款 :rtype: pandas.DataFrame """ url = "https://data.10jqka.com.cn/macro/loan/" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" } r = requests.get(url, headers=headers) temp_df = pd.read_html(StringIO(r.text), skiprows=0)[0] temp_df.columns = [ "月份", "新增人民币贷款-总额", "新增人民币贷款-同比", "新增人民币贷款-环比", "累计人民币贷款-总额", "累计人民币贷款-同比", ] temp_df["新增人民币贷款-总额"] = pd.to_numeric( temp_df["新增人民币贷款-总额"], errors="coerce" ) temp_df["累计人民币贷款-总额"] = pd.to_numeric( temp_df["累计人民币贷款-总额"], errors="coerce" ) temp_df.sort_values(by=["月份"], inplace=True, ignore_index=True) return temp_df def macro_rmb_deposit() -> pd.DataFrame: """ 同花顺-数据中心-宏观数据-人民币存款余额 https://data.10jqka.com.cn/macro/rmb/ :return: 人民币存款余额 :rtype: pandas.DataFrame """ url = "https://data.10jqka.com.cn/macro/rmb/" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" } r = requests.get(url, headers=headers) temp_df = pd.read_html(StringIO(r.text), skiprows=0)[0] temp_df.columns = [ "月份", "新增存款-数量", "新增存款-同比", "新增存款-环比", "新增企业存款-数量", "新增企业存款-同比", "新增企业存款-环比", "新增储蓄存款-数量", "新增储蓄存款-同比", "新增储蓄存款-环比", "新增其他存款-数量", "新增其他存款-同比", "新增其他存款-环比", ] 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" ) temp_df["新增储蓄存款-数量"] = pd.to_numeric( temp_df["新增储蓄存款-数量"], errors="coerce" ) temp_df["新增其他存款-数量"] = pd.to_numeric( temp_df["新增其他存款-数量"], errors="coerce" ) temp_df.sort_values(by=["月份"], inplace=True, ignore_index=True) return temp_df if __name__ == "__main__": macro_stock_finance_df = macro_stock_finance() print(macro_stock_finance_df) macro_rmb_loan_df = macro_rmb_loan() print(macro_rmb_loan_df) macro_rmb_deposit_df = macro_rmb_deposit() print(macro_rmb_deposit_df) ================================================ FILE: akshare/economic/macro_germany.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/11/5 17:08 Desc: 东方财富-德国-经济数据 """ import pandas as pd import requests def macro_germany_core(symbol: str = "EMG00179154") -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-宏观经济-德国-核心代码 https://data.eastmoney.com/cjsj/foreign_1_0.html :param symbol: 代码 :type symbol: str :return: 指定 symbol 的数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_GER", "columns": "ALL", "filter": f'(INDICATOR_ID="{symbol}")', "pageNumber": "1", "pageSize": "5000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "COUNTRY": "-", "INDICATOR_ID": "-", "INDICATOR_NAME": "-", "REPORT_DATE_CH": "时间", "REPORT_DATE": "-", "PUBLISH_DATE": "发布日期", "VALUE": "现值", "PRE_VALUE": "前值", "INDICATOR_IDOLD": "-", }, inplace=True, ) temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"]) temp_df["现值"] = pd.to_numeric(temp_df["现值"]) temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True) return temp_df # 东方财富-德国-经济数据-IFO商业景气指数 def macro_germany_ifo() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-IFO商业景气指数 https://data.eastmoney.com/cjsj/foreign_1_0.html :return: IFO商业景气指数 :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG00179154") return temp_df # 东方财富-德国-经济数据-消费者物价指数月率终值 def macro_germany_cpi_monthly() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-消费者物价指数月率终值 https://data.eastmoney.com/cjsj/foreign_1_1.html :return: 消费者物价指数月率终值 :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG00009758") return temp_df # 东方财富-德国-经济数据-消费者物价指数年率终值 def macro_germany_cpi_yearly() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-消费者物价指数年率终值 https://data.eastmoney.com/cjsj/foreign_1_2.html :return: 消费者物价指数年率终值 :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG00009756") return temp_df # 东方财富-德国-经济数据-贸易帐(季调后) def macro_germany_trade_adjusted() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-贸易帐(季调后) https://data.eastmoney.com/cjsj/foreign_1_3.html :return: 贸易帐(季调后) :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG00009753") return temp_df # 东方财富-德国-经济数据-GDP def macro_germany_gdp() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-GDP https://data.eastmoney.com/cjsj/foreign_1_4.html :return: GDP :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG00009720") return temp_df # 东方财富-德国-经济数据-实际零售销售月率 def macro_germany_retail_sale_monthly() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-实际零售销售月率 https://data.eastmoney.com/cjsj/foreign_1_5.html :return: 实际零售销售月率 :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG01333186") return temp_df # 东方财富-德国-经济数据-实际零售销售年率 def macro_germany_retail_sale_yearly() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-实际零售销售年率 https://data.eastmoney.com/cjsj/foreign_1_6.html :return: 实际零售销售年率 :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG01333192") return temp_df # 东方财富-德国-经济数据-ZEW 经济景气指数 def macro_germany_zew() -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-德国-ZEW 经济景气指数 https://data.eastmoney.com/cjsj/foreign_1_7.html :return: ZEW 经济景气指数 :rtype: pandas.DataFrame """ temp_df = macro_germany_core(symbol="EMG00172577") return temp_df if __name__ == "__main__": macro_germany_ifo_df = macro_germany_ifo() print(macro_germany_ifo_df) macro_germany_cpi_monthly_df = macro_germany_cpi_monthly() print(macro_germany_cpi_monthly_df) macro_germany_cpi_yearly_df = macro_germany_cpi_yearly() print(macro_germany_cpi_yearly_df) macro_germany_trade_adjusted_df = macro_germany_trade_adjusted() print(macro_germany_trade_adjusted_df) macro_germany_gdp_df = macro_germany_gdp() print(macro_germany_gdp_df) macro_germany_retail_sale_monthly_df = macro_germany_retail_sale_monthly() print(macro_germany_retail_sale_monthly_df) macro_germany_retail_sale_yearly_df = macro_germany_retail_sale_yearly() print(macro_germany_retail_sale_yearly_df) macro_germany_zew_df = macro_germany_zew() print(macro_germany_zew_df) ================================================ FILE: akshare/economic/macro_info_ws.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/5/15 18:20 Desc: 华尔街见闻-日历-宏观 https://wallstreetcn.com/calendar """ from datetime import datetime, timedelta import numpy as np import pandas as pd import requests def __convert_date_format(date: str) -> str: """ 将日期字符串从格式'%Y%m%d'转换为格式'%Y-%m-%d %H:%M:%S'。 :param date: 日期字符串,格式为'%Y%m%d' :return: 转换后的日期字符串,格式为'%Y-%m-%d %H:%M:%S' """ datetime_obj = datetime.strptime(date, "%Y%m%d") return datetime_obj.strftime("%Y-%m-%d %H:%M:%S") def __format_date(date: str) -> int: """ 将日期字符串转换为Unix时间戳。 :param date: 日期字符串,格式为'%Y-%m-%d %H:%M:%S' :return: Unix时间戳 """ datetime_obj = datetime.strptime(date, "%Y-%m-%d %H:%M:%S") return int(datetime_obj.timestamp()) def macro_info_ws(date: str = "20240514") -> pd.DataFrame: """ 华尔街见闻-日历-宏观 https://wallstreetcn.com/calendar :param date: 日期 :type date: str :return: 日历-宏观 :rtype: pandas.DataFrame """ date = __convert_date_format(date) url = "https://api-one-wscn.awtmt.com/apiv1/finance/macrodatas" datetime_obj = datetime.strptime(date, "%Y-%m-%d %H:%M:%S") one_day = timedelta(days=1) new_datetime = datetime_obj + one_day date_str = new_datetime.strftime("%Y-%m-%d %H:%M:%S") params = {"start": __format_date(date), "end": __format_date(date_str)} r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["items"]) temp_df["public_date"] = pd.to_datetime( temp_df["public_date"], errors="coerce", unit="s", utc=True ).dt.tz_convert("Asia/Shanghai") temp_df["public_date"] = temp_df["public_date"].dt.strftime("%Y-%m-%d %H:%M:%S") temp_df = temp_df.rename( columns={ "public_date": "时间", "country": "地区", "title": "事件", "importance": "重要性", "actual": "今值", "forecast": "预期", "previous": "前值", "revised": "修正", "uri": "链接", } ) temp_df = temp_df[ [ "时间", "地区", "事件", "重要性", "今值", "预期", "前值", "修正", "链接", ] ] 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") temp_df["修正"] = pd.to_numeric(temp_df["修正"], errors="coerce") temp_df["前值"] = np.where( temp_df["修正"].notnull(), temp_df["修正"], temp_df["前值"] ) del temp_df["修正"] return temp_df if __name__ == "__main__": macro_info_ws_df = macro_info_ws(date="20240514") print(macro_info_ws_df) ================================================ FILE: akshare/economic/macro_japan.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/3 16:00 Desc: 东方财富-经济数据-日本 https://data.eastmoney.com/cjsj/foreign_3_0.html """ import pandas as pd import requests def macro_japan_core(symbol: str = "EMG00341602") -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-宏观经济-日本-核心代码 https://data.eastmoney.com/cjsj/foreign_1_0.html :param symbol: 代码 :type symbol: str :return: 指定 symbol 的数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_JPAN", "columns": "ALL", "filter": f'(INDICATOR_ID="{symbol}")', "pageNumber": "1", "pageSize": "5000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "COUNTRY": "-", "INDICATOR_ID": "-", "INDICATOR_NAME": "-", "REPORT_DATE_CH": "时间", "REPORT_DATE": "-", "PUBLISH_DATE": "发布日期", "VALUE": "现值", "PRE_VALUE": "前值", "INDICATOR_IDOLD": "-", }, inplace=True, ) temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True) return temp_df # 央行公布利率决议 def macro_japan_bank_rate() -> pd.DataFrame: """ 东方财富-经济数据-日本-央行公布利率决议 https://data.eastmoney.com/cjsj/foreign_3_0.html :return: 央行公布利率决议 :rtype: pandas.DataFrame """ temp_df = macro_japan_core(symbol="EMG00342252") return temp_df # 全国消费者物价指数年率 def macro_japan_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-日本-全国消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_3_1.html :return: 全国消费者物价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_japan_core(symbol="EMG00005004") return temp_df # 全国核心消费者物价指数年率 def macro_japan_core_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-日本-全国核心消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_2_2.html :return: 全国核心消费者物价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_japan_core(symbol="EMG00158099") return temp_df # 失业率 def macro_japan_unemployment_rate() -> pd.DataFrame: """ 东方财富-经济数据-日本-失业率 https://data.eastmoney.com/cjsj/foreign_2_3.html :return: 失业率 :rtype: pandas.DataFrame """ temp_df = macro_japan_core(symbol="EMG00005047") return temp_df # 领先指标终值 def macro_japan_head_indicator() -> pd.DataFrame: """ 东方财富-经济数据-日本-领先指标终值 https://data.eastmoney.com/cjsj/foreign_3_4.html :return: 领先指标终值 :rtype: pandas.DataFrame """ temp_df = macro_japan_core(symbol="EMG00005117") return temp_df if __name__ == "__main__": macro_japan_bank_rate_df = macro_japan_bank_rate() print(macro_japan_bank_rate_df) macro_japan_cpi_yearly_df = macro_japan_cpi_yearly() print(macro_japan_cpi_yearly_df) macro_japan_core_cpi_yearly_df = macro_japan_core_cpi_yearly() print(macro_japan_core_cpi_yearly_df) macro_japan_unemployment_rate_df = macro_japan_unemployment_rate() print(macro_japan_unemployment_rate_df) macro_japan_head_indicator_df = macro_japan_head_indicator() print(macro_japan_head_indicator_df) ================================================ FILE: akshare/economic/macro_other.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/3 16:36 Desc: 金十数据-其他-加密货币实时行情 """ from datetime import datetime import pandas as pd import requests def crypto_js_spot() -> pd.DataFrame: """ 主流加密货币的实时行情数据, 一次请求返回具体某一时刻行情数据 https://datacenter.jin10.com/reportType/dc_bitcoin_current :return: pandas.DataFrame """ url = "https://datacenter-api.jin10.com/crypto_currency/list" headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } r = requests.get(url, headers=headers) data_json = r.json() data_df = pd.DataFrame(data_json["data"]) data_df["reported_at"] = pd.to_datetime(data_df["reported_at"]) data_df.columns = [ "市场", "交易品种", "最近报价", "涨跌额", "涨跌幅", "24小时最高", "24小时最低", "24小时成交量", "更新时间", ] data_df["最近报价"] = pd.to_numeric(data_df["最近报价"], errors="coerce") data_df["涨跌额"] = pd.to_numeric(data_df["涨跌额"], errors="coerce") data_df["涨跌幅"] = pd.to_numeric(data_df["涨跌幅"], errors="coerce") data_df["24小时最高"] = pd.to_numeric(data_df["24小时最高"], errors="coerce") data_df["24小时最低"] = pd.to_numeric(data_df["24小时最低"], errors="coerce") data_df["24小时成交量"] = pd.to_numeric(data_df["24小时成交量"], errors="coerce") data_df["更新时间"] = data_df["更新时间"].astype(str) return data_df def macro_fx_sentiment( start_date: str = "20221011", end_date: str = "20221017" ) -> pd.DataFrame: """ 金十数据-外汇-投机情绪报告 外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。 报告内容: 品种: 澳元兑日元、澳元兑美元、欧元兑美元、欧元兑澳元、欧元兑日元、英镑兑美元、英镑兑日元、纽元兑美元、美元兑加元、美元兑瑞郎、美元兑日元以及现货黄金兑美元。 数据: 由Shark - fx整合全球8家交易平台( 包括 Oanda、 FXCM、 Insta、 Dukas、 MyFxBook以及FiboGroup) 的多空投机仓位数据而成。 名词释义: 外汇投机情绪报告显示当前市场多空仓位比例,数据由8家交易平台提供,涵盖11个主要货币对和1个黄金品种。 工具使用策略: Shark-fx声明表示,基于“主流通常都是错误的”的事实,当空头头寸超过60%,交易者就应该建立多头仓位; 同理,当市场多头头寸超过60%,交易者则应该建立空头仓位。此外,当多空仓位比例接近50%的情况下,我们则倾向于建议交易者不要进场,保持观望。 https://datacenter.jin10.com/reportType/dc_ssi_trends :param start_date: 具体交易日 :type start_date: str :param end_date: 具体交易日, 与 end_date 相同 :type end_date: str :return: 投机情绪报告 :rtype: pandas.DataFrame """ start_date = "-".join([start_date[:4], start_date[4:6], start_date[6:]]) end_date = "-".join([end_date[:4], end_date[4:6], end_date[6:]]) url = "https://datacenter-api.jin10.com/sentiment/datas" params = { "start_date": start_date, "end_date": end_date, "currency_pair": "", } headers = { "accept": "*/*", "accept-encoding": "", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", "cache-control": "no-cache", "origin": "https://datacenter.jin10.com", "pragma": "no-cache", "referer": "https://datacenter.jin10.com/reportType/dc_ssi_trends", "sec-fetch-mode": "cors", "sec-fetch-site": "same-site", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/79.0.3945.130 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "", "x-version": "1.0.0", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["values"]).T temp_df.reset_index(inplace=True) temp_df.rename(columns={"index": "date"}, inplace=True) for col in temp_df.columns[1:]: temp_df[col] = pd.to_numeric(temp_df[col], errors="coerce") return temp_df if __name__ == "__main__": crypto_js_spot_df = crypto_js_spot() print(crypto_js_spot_df) test_date = datetime.now().date().isoformat().replace("-", "") macro_fx_sentiment_df = macro_fx_sentiment(start_date=test_date, end_date=test_date) print(macro_fx_sentiment_df) ================================================ FILE: akshare/economic/macro_swiss.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/11/8 10:00 Desc: 东方财富-经济数据-瑞士 http://data.eastmoney.com/cjsj/foreign_2_0.html """ import pandas as pd import requests def macro_swiss_core(symbol: str = "EMG00341602") -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-宏观经济-瑞士-核心代码 https://data.eastmoney.com/cjsj/foreign_1_0.html :param symbol: 代码 :type symbol: str :return: 指定 symbol 的数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_CH", "columns": "ALL", "filter": f'(INDICATOR_ID="{symbol}")', "pageNumber": "1", "pageSize": "5000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "COUNTRY": "-", "INDICATOR_ID": "-", "INDICATOR_NAME": "-", "REPORT_DATE_CH": "时间", "REPORT_DATE": "-", "PUBLISH_DATE": "发布日期", "VALUE": "现值", "PRE_VALUE": "前值", "INDICATOR_IDOLD": "-", }, inplace=True, ) temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"]) temp_df["现值"] = pd.to_numeric(temp_df["现值"]) temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True) return temp_df # SVME采购经理人指数 def macro_swiss_svme(): """ 东方财富-经济数据-瑞士-SVME采购经理人指数 http://data.eastmoney.com/cjsj/foreign_2_0.html :return: SVME采购经理人指数 :rtype: pandas.DataFrame """ temp_df = macro_swiss_core(symbol="EMG00341602") return temp_df # 贸易帐 def macro_swiss_trade(): """ 东方财富-经济数据-瑞士-贸易帐 http://data.eastmoney.com/cjsj/foreign_2_1.html :return: 贸易帐 :rtype: pandas.DataFrame """ temp_df = macro_swiss_core(symbol="EMG00341603") return temp_df # 消费者物价指数年率 def macro_swiss_cpi_yearly(): """ 东方财富-经济数据-瑞士-消费者物价指数年率 http://data.eastmoney.com/cjsj/foreign_2_2.html :return: 消费者物价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_swiss_core(symbol="EMG00341604") return temp_df # GDP季率 def macro_swiss_gdp_quarterly(): """ 东方财富-经济数据-瑞士-GDP季率 http://data.eastmoney.com/cjsj/foreign_2_3.html :return: GDP季率 :rtype: pandas.DataFrame """ temp_df = macro_swiss_core(symbol="EMG00341600") return temp_df # GDP年率 def macro_swiss_gbd_yearly(): """ 东方财富-经济数据-瑞士-GDP 年率 http://data.eastmoney.com/cjsj/foreign_2_4.html :return: GDP年率 :rtype: pandas.DataFrame """ temp_df = macro_swiss_core(symbol="EMG00341601") return temp_df # 央行公布利率决议 def macro_swiss_gbd_bank_rate(): """ 东方财富-经济数据-瑞士-央行公布利率决议 http://data.eastmoney.com/cjsj/foreign_2_5.html :return: 央行公布利率决议 :rtype: pandas.DataFrame """ temp_df = macro_swiss_core(symbol="EMG00341606") return temp_df if __name__ == "__main__": macro_swiss_svme_df = macro_swiss_svme() print(macro_swiss_svme_df) macro_swiss_trade_df = macro_swiss_trade() print(macro_swiss_trade_df) macro_swiss_cpi_yearly_df = macro_swiss_cpi_yearly() print(macro_swiss_cpi_yearly_df) macro_swiss_gdp_quarterly_df = macro_swiss_gdp_quarterly() print(macro_swiss_gdp_quarterly_df) macro_swiss_gbd_yearly_df = macro_swiss_gbd_yearly() print(macro_swiss_gbd_yearly_df) macro_swiss_gbd_bank_rate_df = macro_swiss_gbd_bank_rate() print(macro_swiss_gbd_bank_rate_df) ================================================ FILE: akshare/economic/macro_uk.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/11/12 17:14 Desc: 东方财富-经济数据-英国 https://data.eastmoney.com/cjsj/foreign_4_0.html """ import pandas as pd import requests def macro_uk_core(symbol: str = "EMG00010348") -> pd.DataFrame: """ 东方财富-数据中心-经济数据一览-宏观经济-英国-核心代码 https://data.eastmoney.com/cjsj/foreign_4_0.html :param symbol: 代码 :type symbol: str :return: 指定 symbol 的数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_BRITAIN", "columns": "ALL", "filter": f'(INDICATOR_ID="{symbol}")', "pageNumber": "1", "pageSize": "5000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.rename( columns={ "COUNTRY": "-", "INDICATOR_ID": "-", "INDICATOR_NAME": "-", "REPORT_DATE_CH": "时间", "REPORT_DATE": "-", "PUBLISH_DATE": "发布日期", "VALUE": "现值", "PRE_VALUE": "前值", "INDICATOR_IDOLD": "-", }, inplace=True, ) temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"]) temp_df["现值"] = pd.to_numeric(temp_df["现值"]) temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"]).dt.date temp_df.sort_values(["发布日期"], inplace=True, ignore_index=True) return temp_df # Halifax房价指数月率 def macro_uk_halifax_monthly() -> pd.DataFrame: """ 东方财富-经济数据-英国-Halifax 房价指数月率 https://data.eastmoney.com/cjsj/foreign_4_0.html :return: Halifax 房价指数月率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00342256") return temp_df # Halifax 房价指数年率 def macro_uk_halifax_yearly() -> pd.DataFrame: """ 东方财富-经济数据-英国-Halifax 房价指数年率 https://data.eastmoney.com/cjsj/foreign_4_1.html :return: Halifax房价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00010370") return temp_df # 贸易帐 def macro_uk_trade() -> pd.DataFrame: """ 东方财富-经济数据-英国-贸易帐 https://data.eastmoney.com/cjsj/foreign_4_2.html :return: 贸易帐 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00158309") return temp_df # 央行公布利率决议 def macro_uk_bank_rate() -> pd.DataFrame: """ 东方财富-经济数据-英国-央行公布利率决议 https://data.eastmoney.com/cjsj/foreign_4_3.html :return: 央行公布利率决议 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00342253") return temp_df # 核心消费者物价指数年率 def macro_uk_core_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-英国-核心消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_4_4.html :return: 核心消费者物价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00010279") return temp_df # 核心消费者物价指数月率 def macro_uk_core_cpi_monthly() -> pd.DataFrame: """ 东方财富-经济数据-英国-核心消费者物价指数月率 https://data.eastmoney.com/cjsj/foreign_4_5.html :return: 核心消费者物价指数月率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00010291") return temp_df # 消费者物价指数年率 def macro_uk_cpi_yearly() -> pd.DataFrame: """ 东方财富-经济数据-英国-消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_4_6.html :return: 消费者物价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00010267") return temp_df # 消费者物价指数月率 def macro_uk_cpi_monthly() -> pd.DataFrame: """ 东方财富-经济数据-英国-消费者物价指数月率 https://data.eastmoney.com/cjsj/foreign_4_7.html :return: 消费者物价指数月率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00010291") return temp_df # 零售销售月率 def macro_uk_retail_monthly() -> pd.DataFrame: """ 东方财富-经济数据-英国-零售销售月率 https://data.eastmoney.com/cjsj/foreign_4_8.html :return: 零售销售月率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00158298") return temp_df # 零售销售年率 def macro_uk_retail_yearly() -> pd.DataFrame: """ 东方财富-经济数据-英国-零售销售年率 https://data.eastmoney.com/cjsj/foreign_4_9.html :return: 零售销售年率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00158297") return temp_df # Rightmove 房价指数年率 def macro_uk_rightmove_yearly() -> pd.DataFrame: """ 东方财富-经济数据-英国-Rightmove 房价指数年率 https://data.eastmoney.com/cjsj/foreign_4_10.html :return: Rightmove 房价指数年率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00341608") return temp_df # Rightmove 房价指数月率 def macro_uk_rightmove_monthly() -> pd.DataFrame: """ 东方财富-经济数据-英国-Rightmove 房价指数月率 https://data.eastmoney.com/cjsj/foreign_4_11.html :return: Rightmove 房价指数月率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00341607") return temp_df # GDP 季率初值 def macro_uk_gdp_quarterly() -> pd.DataFrame: """ 东方财富-经济数据-英国-GDP 季率初值 https://data.eastmoney.com/cjsj/foreign_4_12.html :return: GDP 季率初值 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00158277") return temp_df # GDP 年率初值 def macro_uk_gdp_yearly() -> pd.DataFrame: """ 东方财富-经济数据-英国-GDP 年率初值 https://data.eastmoney.com/cjsj/foreign_4_13.html :return: GDP 年率初值 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00158276") return temp_df # 失业率 def macro_uk_unemployment_rate() -> pd.DataFrame: """ 东方财富-经济数据-英国-失业率 https://data.eastmoney.com/cjsj/foreign_4_14.html :return: 失业率 :rtype: pandas.DataFrame """ temp_df = macro_uk_core(symbol="EMG00010348") return temp_df if __name__ == "__main__": macro_uk_halifax_monthly_df = macro_uk_halifax_monthly() print(macro_uk_halifax_monthly_df) macro_uk_halifax_yearly_df = macro_uk_halifax_yearly() print(macro_uk_halifax_yearly_df) macro_uk_trade_df = macro_uk_trade() print(macro_uk_trade_df) macro_uk_bank_rate_df = macro_uk_bank_rate() print(macro_uk_bank_rate_df) macro_uk_core_cpi_yearly_df = macro_uk_core_cpi_yearly() print(macro_uk_core_cpi_yearly_df) macro_uk_core_cpi_monthly_df = macro_uk_core_cpi_monthly() print(macro_uk_core_cpi_monthly_df) macro_uk_cpi_yearly_df = macro_uk_cpi_yearly() print(macro_uk_cpi_yearly_df) macro_uk_cpi_monthly_df = macro_uk_cpi_monthly() print(macro_uk_cpi_monthly_df) macro_uk_retail_monthly_df = macro_uk_retail_monthly() print(macro_uk_retail_monthly_df) macro_uk_retail_yearly_df = macro_uk_retail_yearly() print(macro_uk_retail_yearly_df) macro_uk_rightmove_yearly_df = macro_uk_rightmove_yearly() print(macro_uk_rightmove_yearly_df) macro_uk_rightmove_monthly_df = macro_uk_rightmove_monthly() print(macro_uk_rightmove_monthly_df) macro_uk_gdp_quarterly_df = macro_uk_gdp_quarterly() print(macro_uk_gdp_quarterly_df) macro_uk_gdp_yearly_df = macro_uk_gdp_yearly() print(macro_uk_gdp_yearly_df) macro_uk_unemployment_rate_df = macro_uk_unemployment_rate() print(macro_uk_unemployment_rate_df) ================================================ FILE: akshare/economic/macro_usa.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/4 18:00 Desc: 金十数据中心-经济指标-美国 https://datacenter.jin10.com/economic """ import datetime import time import pandas as pd import requests def __macro_usa_base_func(symbol: str, params: dict) -> pd.DataFrame: """ 金十数据中心-经济指标-美国-基础函数 https://datacenter.jin10.com/economic :return: 美国经济指标数据 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings(action="ignore", category=FutureWarning) headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "rU6QIu7JHe2gOUeR", "x-csrf-token": "x-csrf-token", "x-version": "1.0.0", } url = "https://datacenter-api.jin10.com/reports/list_v2" params = params big_df = pd.DataFrame() while True: r = requests.get(url, params=params, headers=headers) data_json = r.json() if not data_json["data"]["values"]: break temp_df = pd.DataFrame(data_json["data"]["values"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) last_date_str = temp_df.iat[-1, 0] last_date_str = ( ( datetime.datetime.strptime(last_date_str, "%Y-%m-%d") - datetime.timedelta(days=1) ) .date() .isoformat() ) params.update({"max_date": f"{last_date_str}"}) big_df.columns = [ "日期", "今值", "预测值", "前值", ] big_df["商品"] = symbol big_df = big_df[ [ "商品", "日期", "今值", "预测值", "前值", ] ] big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df["今值"] = pd.to_numeric(big_df["今值"], errors="coerce") big_df["预测值"] = pd.to_numeric(big_df["预测值"], errors="coerce") big_df["前值"] = pd.to_numeric(big_df["前值"], errors="coerce") big_df.sort_values(["日期"], inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df # 东方财富-美国-未决房屋销售月率 def macro_usa_phs() -> pd.DataFrame: """ 东方财富-经济数据一览-美国-未决房屋销售月率 https://data.eastmoney.com/cjsj/foreign_0_5.html :return: 未决房屋销售月率 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_USA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00342249")', "pageNumber": "1", "pageSize": "2000", "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = [ "-", "-", "-", "时间", "-", "发布日期", "现值", "前值", ] temp_df = temp_df[ [ "时间", "前值", "现值", "发布日期", ] ] temp_df["前值"] = pd.to_numeric(temp_df["前值"], errors="coerce") temp_df["现值"] = pd.to_numeric(temp_df["现值"], errors="coerce") temp_df["发布日期"] = pd.to_datetime(temp_df["发布日期"], errors="coerce").dt.date return temp_df # 东方财富-经济指标-美国-物价水平-美国核心CPI月率报告 def macro_usa_cpi_yoy() -> pd.DataFrame: """ 东方财富-经济数据一览-美国-CPI年率, 数据区间从 2008-至今 https://data.eastmoney.com/cjsj/foreign_0_12.html :return: 美国 CPI 年率报告 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_ECONOMICVALUE_USA", "columns": "ALL", "filter": '(INDICATOR_ID="EMG00000733")', "sortColumns": "REPORT_DATE", "sortTypes": "-1", "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() data_list = data_json["result"]["data"] temp_df = pd.DataFrame( data_list, columns=["REPORT_DATE", "PUBLISH_DATE", "VALUE", "PRE_VALUE"] ) temp_df.columns = [ "时间", "发布日期", "现值", "前值", ] 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.sort_values(by=["时间"], inplace=True, ignore_index=True) return temp_df # 金十数据中心-经济指标-美国-经济状况-美国GDP def macro_usa_gdp_monthly() -> pd.DataFrame: """ 金十数据-美国国内生产总值(GDP)报告, 数据区间从 20080228-至今 https://datacenter.jin10.com/reportType/dc_usa_gdp :return: 美国国内生产总值(GDP) :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "53", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国国内生产总值(GDP)", params=params) return temp_df # 金十数据中心-经济指标-美国-物价水平-美国CPI月率报告 def macro_usa_cpi_monthly() -> pd.DataFrame: """ 美国 CPI 月率报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_cpi :return: 美国 CPI 月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "9", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国CPI月率", params=params) return temp_df # 金十数据中心-经济指标-美国-物价水平-美国核心CPI月率报告 def macro_usa_core_cpi_monthly() -> pd.DataFrame: """ 美国核心 CPI 月率报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_core_cpi :return: 美国核心CPI月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "6", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国核心CPI月率", params=params) return temp_df # 金十数据中心-经济指标-美国-物价水平-美国个人支出月率报告 def macro_usa_personal_spending() -> pd.DataFrame: """ 美国个人支出月率报告, 数据区间从19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_personal_spending :return: 美国个人支出月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "35", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国个人支出月率", params=params) return temp_df # 金十数据中心-经济指标-美国-物价水平-美国零售销售月率报告 def macro_usa_retail_sales() -> pd.DataFrame: """ 美国零售销售月率报告, 数据区间从 19920301-至今 https://datacenter.jin10.com/reportType/dc_usa_retail_sales :return: 美国零售销售月率报告-今值(%) :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "39", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国零售销售月率", params=params) return temp_df # 金十数据中心-经济指标-美国-物价水平-美国进口物价指数报告 def macro_usa_import_price() -> pd.DataFrame: """ 美国进口物价指数报告, 数据区间从19890201-至今 https://datacenter.jin10.com/reportType/dc_usa_import_price :return: 美国进口物价指数报告-今值(%) :rtype: pandas.Series """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "18", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国进口物价指数", params=params) return temp_df # 金十数据中心-经济指标-美国-物价水平-美国出口价格指数报告 def macro_usa_export_price() -> pd.DataFrame: """ 美国出口价格指数报告, 数据区间从19890201-至今 https://datacenter.jin10.com/reportType/dc_usa_export_price https://cdn.jin10.com/dc/reports/dc_usa_export_price_all.js?v=1578741832 :return: 美国出口价格指数报告-今值(%) :rtype: pandas.Series """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "79", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国出口价格指数", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-LMCI def macro_usa_lmci() -> pd.DataFrame: """ 美联储劳动力市场状况指数报告, 数据区间从 20141006-至今 https://datacenter.jin10.com/reportType/dc_usa_lmci :return: 美联储劳动力市场状况指数报告-今值(%) :rtype: pandas.Series """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "93", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美联储劳动力市场状况指数", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-失业率-美国失业率报告 def macro_usa_unemployment_rate() -> pd.DataFrame: """ 美国失业率报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_unemployment_rate :return: 获取美国失业率报告 :rtype: pandas.Series """ t = time.time() params = { "category": "ec", "attr_id": "47", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国失业率", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-失业率-美国挑战者企业裁员人数报告 def macro_usa_job_cuts() -> pd.DataFrame: """ 美国挑战者企业裁员人数报告, 数据区间从 19940201-至今 https://datacenter.jin10.com/reportType/dc_usa_job_cuts :return: 美国挑战者企业裁员人数报告 :rtype: pandas.DataFrame """ t = time.time() params = { "category": "ec", "attr_id": "78", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国挑战者企业裁员人数", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-就业人口-美国非农就业人数报告 def macro_usa_non_farm() -> pd.DataFrame: """ 美国非农就业人数报告, 数据区间从19700102-至今 https://datacenter.jin10.com/reportType/dc_nonfarm_payrolls :return: 美国非农就业人数报告 :rtype: pandas.Series """ t = time.time() params = { "category": "ec", "attr_id": "33", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国非农就业人数", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-就业人口-美国ADP就业人数报告 def macro_usa_adp_employment() -> pd.DataFrame: """ 美国ADP就业人数报告, 数据区间从 20010601-至今 https://datacenter.jin10.com/reportType/dc_adp_nonfarm_employment :return: 美国ADP就业人数报告 :rtype: pandas.Series """ t = time.time() params = { "category": "ec", "attr_id": "1", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国ADP就业人数", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-消费者收入与支出-美国核心PCE物价指数年率报告 def macro_usa_core_pce_price() -> pd.DataFrame: """ 美国核心PCE物价指数年率报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_core_pce_price :return: 美国核心PCE物价指数年率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "category": "ec", "attr_id": "80", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国核心PCE物价指数年率", params=params) return temp_df # 金十数据中心-经济指标-美国-劳动力市场-消费者收入与支出-美国实际个人消费支出季率初值报告 def macro_usa_real_consumer_spending() -> pd.DataFrame: """ 美国实际个人消费支出季率初值报告, 数据区间从 20131107-至今 https://datacenter.jin10.com/reportType/dc_usa_real_consumer_spending :return: 美国实际个人消费支出季率初值报告 :rtype: pandas.DataFrame """ t = time.time() params = { "category": "ec", "attr_id": "81", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func( symbol="美国实际个人消费支出季率初值", params=params ) return temp_df # 金十数据中心-经济指标-美国-贸易状况-美国贸易帐报告 def macro_usa_trade_balance() -> pd.DataFrame: """ 美国贸易帐报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_trade_balance :return: 美国贸易帐报告 :rtype: pandas.DataFrame """ t = time.time() params = { "category": "ec", "attr_id": "42", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国贸易帐报告", params=params) return temp_df # 金十数据中心-经济指标-美国-贸易状况-美国经常帐报告 def macro_usa_current_account() -> pd.DataFrame: """ 美国经常帐报告, 数据区间从 20080317-至今 https://datacenter.jin10.com/reportType/dc_usa_current_account :return: 美国经常帐报告 :rtype: pandas.DataFrame """ t = time.time() params = { "category": "ec", "attr_id": "12", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国经常账报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-制造业-贝克休斯钻井报告 def macro_usa_rig_count() -> pd.DataFrame: """ 贝克休斯钻井报告, 数据区间从 20080317-至今 https://datacenter.jin10.com/reportType/dc_rig_count_summary :return: 贝克休斯钻井报告-当周 :rtype: pandas.DataFrame """ t = time.time() params = {"_": t} res = requests.get( url="https://cdn.jin10.com/data_center/reports/baker.json", params=params ) temp_df = pd.DataFrame(res.json().get("values")).T big_df = pd.DataFrame() big_df["钻井总数_钻井数"] = temp_df["钻井总数"].apply(lambda x: x[0]) big_df["钻井总数_变化"] = temp_df["钻井总数"].apply(lambda x: x[1]) big_df["美国石油钻井_钻井数"] = temp_df["美国石油钻井"].apply(lambda x: x[0]) big_df["美国石油钻井_变化"] = temp_df["美国石油钻井"].apply(lambda x: x[1]) big_df["混合钻井_钻井数"] = temp_df["混合钻井"].apply(lambda x: x[0]) big_df["混合钻井_变化"] = temp_df["混合钻井"].apply(lambda x: x[1]) big_df["美国天然气钻井_钻井数"] = temp_df["美国天然气钻井"].apply(lambda x: x[0]) big_df["美国天然气钻井_变化"] = temp_df["美国天然气钻井"].apply(lambda x: x[1]) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], inplace=True, ignore_index=True) return big_df # 金十数据中心-经济指标-美国-产业指标-制造业-美国生产者物价指数(PPI)报告 def macro_usa_ppi() -> pd.DataFrame: """ 美国生产者物价指数(PPI)报告, 数据区间从 20080226-至今 https://datacenter.jin10.com/reportType/dc_usa_ppi :return: 美国生产者物价指数(PPI)报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "37", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国生产者物价指数", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-制造业-美国核心生产者物价指数(PPI)报告 def macro_usa_core_ppi() -> pd.DataFrame: """ 美国核心生产者物价指数(PPI)报告, 数据区间从20080318-至今 https://datacenter.jin10.com/reportType/dc_usa_core_ppi :return: 美国核心生产者物价指数(PPI)报告-今值(%) :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "7", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国核心生产者物价指数", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-制造业-美国API原油库存报告 def macro_usa_api_crude_stock() -> pd.DataFrame: """ 美国 API 原油库存报告, 数据区间从 20120328-至今 https://datacenter.jin10.com/reportType/dc_usa_api_crude_stock https://cdn.jin10.com/dc/reports/dc_usa_api_crude_stock_all.js?v=1578743859 :return: 美国API原油库存报告-今值(万桶) :rtype: pandas.Series """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "69", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国API原油库存", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-制造业-美国Markit制造业PMI初值报告 def macro_usa_pmi() -> pd.DataFrame: """ 美国 Markit 制造业 PMI 初值报告, 数据区间从 20120601-至今 https://datacenter.jin10.com/reportType/dc_usa_pmi :return: 美国 Markit 制造业 PMI 初值报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "74", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国Markit制造业PMI报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-制造业-美国ISM制造业PMI报告 def macro_usa_ism_pmi() -> pd.DataFrame: """ 美国 ISM 制造业 PMI 报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_ism_pmi :return: 美国 ISM 制造业 PMI 报告-今值 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "28", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国ISM制造业PMI报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-工业-美国工业产出月率报告 def macro_usa_industrial_production() -> pd.DataFrame: """ 美国工业产出月率报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_industrial_production :return: 美国工业产出月率报告-今值(%) :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "20", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国工业产出月率报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-工业-美国耐用品订单月率报告 def macro_usa_durable_goods_orders() -> pd.DataFrame: """ 美国耐用品订单月率报告, 数据区间从 20080227-至今 https://datacenter.jin10.com/reportType/dc_usa_durable_goods_orders :return: 美国耐用品订单月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "13", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国耐用品订单月率报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-工业-美国工厂订单月率报告 def macro_usa_factory_orders() -> pd.DataFrame: """ 美国工厂订单月率报告, 数据区间从 19920401-至今 https://datacenter.jin10.com/reportType/dc_usa_factory_orders :return: 美国工厂订单月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "16", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国工厂订单月率报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-服务业-美国Markit服务业PMI初值报告 def macro_usa_services_pmi() -> pd.DataFrame: """ 美国Markit服务业PMI初值报告, 数据区间从 20120701-至今 https://datacenter.jin10.com/reportType/dc_usa_services_pmi :return: 美国Markit服务业PMI初值报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "89", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国Markit服务业PMI初值报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-服务业-美国商业库存月率报告 def macro_usa_business_inventories() -> pd.DataFrame: """ 美国商业库存月率报告, 数据区间从 19920301-至今 https://datacenter.jin10.com/reportType/dc_usa_business_inventories :return: 美国商业库存月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "4", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国商业库存月率报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-服务业-美国ISM非制造业PMI报告 def macro_usa_ism_non_pmi() -> pd.DataFrame: """ 美国ISM非制造业PMI报告, 数据区间从 19970801-至今 https://datacenter.jin10.com/reportType/dc_usa_ism_non_pmi :return: 美国ISM非制造业PMI报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "29", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国ISM非制造业PMI报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国NAHB房产市场指数报告 def macro_usa_nahb_house_market_index() -> pd.DataFrame: """ 美国NAHB房产市场指数报告, 数据区间从 19850201-至今 https://datacenter.jin10.com/reportType/dc_usa_nahb_house_market_index :return: 美国NAHB房产市场指数报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "31", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国NAHB房产市场指数报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国新屋开工总数年化报告 def macro_usa_house_starts() -> pd.DataFrame: """ 美国新屋开工总数年化报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_house_starts :return: 美国新屋开工总数年化报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "17", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国新屋开工总数年化报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国新屋销售总数年化报告 def macro_usa_new_home_sales() -> pd.DataFrame: """ 美国新屋销售总数年化报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_new_home_sales :return: 美国新屋销售总数年化报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "32", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国新屋销售总数年化报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国营建许可总数报告 def macro_usa_building_permits() -> pd.DataFrame: """ 美国营建许可总数报告, 数据区间从 20080220-至今 https://datacenter.jin10.com/reportType/dc_usa_building_permits :return: 美国营建许可总数报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "3", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国营建许可总数报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国成屋销售总数年化报告 def macro_usa_exist_home_sales() -> pd.DataFrame: """ 美国成屋销售总数年化报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_exist_home_sales :return: 美国成屋销售总数年化报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "15", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国成屋销售总数年化报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国FHFA房价指数月率报告 def macro_usa_house_price_index() -> pd.DataFrame: """ 美国FHFA房价指数月率报告, 数据区间从 19910301-至今 https://datacenter.jin10.com/reportType/dc_usa_house_price_index :return: 美国FHFA房价指数月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "51", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国FHFA房价指数月率报告", params=params) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国S&P/CS20座大城市房价指数年率报告 def macro_usa_spcs20() -> pd.DataFrame: """ 美国S&P/CS20座大城市房价指数年率报告, 数据区间从 20010201-至今 https://datacenter.jin10.com/reportType/dc_usa_spcs20 :return: 美国S&P/CS20座大城市房价指数年率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "52", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func( symbol="美国S&P/CS20座大城市房价指数年率", params=params ) return temp_df # 金十数据中心-经济指标-美国-产业指标-房地产-美国成屋签约销售指数月率报告 def macro_usa_pending_home_sales() -> pd.DataFrame: """ 美国成屋签约销售指数月率报告, 数据区间从 20010301-至今 https://datacenter.jin10.com/reportType/dc_usa_pending_home_sales :return: 美国成屋签约销售指数月率报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "34", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func( symbol="美国成屋签约销售指数月率报告", params=params ) return temp_df # 金十数据中心-经济指标-美国-领先指标-美国谘商会消费者信心指数报告 def macro_usa_cb_consumer_confidence() -> pd.DataFrame: """ 金十数据中心-经济指标-美国-领先指标-美国谘商会消费者信心指数报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_usa_cb_consumer_confidence :return: 美国谘商会消费者信心指数报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "5", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国谘商会消费者信心指数", params=params) return temp_df # 金十数据中心-经济指标-美国-领先指标-美国NFIB小型企业信心指数报告 def macro_usa_nfib_small_business() -> pd.DataFrame: """ 美国NFIB小型企业信心指数报告, 数据区间从 19750201-至今 https://datacenter.jin10.com/reportType/dc_usa_nfib_small_business :return: 美国NFIB小型企业信心指数报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "63", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func( symbol="美国NFIB小型企业信心指数报告", params=params ) return temp_df # 金十数据中心-经济指标-美国-领先指标-美国密歇根大学消费者信心指数初值报告 def macro_usa_michigan_consumer_sentiment() -> pd.DataFrame: """ 美国密歇根大学消费者信心指数初值报告, 数据区间从 19700301-至今 https://datacenter.jin10.com/reportType/dc_usa_michigan_consumer_sentiment :return: 美国密歇根大学消费者信心指数初值报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "50", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func( symbol="美国密歇根大学消费者信心指数初值报告", params=params ) return temp_df # 金十数据中心-经济指标-美国-其他-美国EIA原油库存报告 def macro_usa_eia_crude_rate() -> pd.DataFrame: """ 美国 EIA 原油库存报告, 数据区间从 19950801-至今 https://datacenter.jin10.com/reportType/dc_eia_crude_oil :return: 美国 EIA 原油库存报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "10", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国EIA原油库存", params=params) return temp_df # 金十数据中心-经济指标-美国-其他-美国初请失业金人数报告 def macro_usa_initial_jobless() -> pd.DataFrame: """ 美国初请失业金人数报告, 数据区间从 19700101-至今 https://datacenter.jin10.com/reportType/dc_initial_jobless :return: 美国 EIA 原油库存报告 :rtype: pandas.DataFrame """ t = time.time() params = { "max_date": "", "category": "ec", "attr_id": "44", "_": str(int(round(t * 1000))), } temp_df = __macro_usa_base_func(symbol="美国初请失业金人数", params=params) return temp_df # 金十数据中心-经济指标-美国-其他-美国原油产量报告 def macro_usa_crude_inner() -> pd.DataFrame: """ 美国原油产量报告, 数据区间从 19830107-至今 https://datacenter.jin10.com/reportType/dc_eia_crude_oil_produce :return: 美国原油产量报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": t} res = requests.get( url="https://cdn.jin10.com/data_center/reports/usa_oil.json", params=params ) temp_df = pd.DataFrame(res.json().get("values")).T big_df = pd.DataFrame() big_df["美国国内原油总量-产量"] = temp_df["美国国内原油总量"].apply(lambda x: x[0]) big_df["美国国内原油总量-变化"] = temp_df["美国国内原油总量"].apply(lambda x: x[1]) big_df["美国本土48州原油产量-产量"] = temp_df["美国本土48州原油产量"].apply( lambda x: x[0] ) big_df["美国本土48州原油产量-变化"] = temp_df["美国本土48州原油产量"].apply( lambda x: x[1] ) big_df["美国阿拉斯加州原油产量-产量"] = temp_df["美国阿拉斯加州原油产量"].apply( lambda x: x[0] ) big_df["美国阿拉斯加州原油产量-变化"] = temp_df["美国阿拉斯加州原油产量"].apply( lambda x: x[1] ) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-美国商品期货交易委员会CFTC外汇类非商业持仓报告 def macro_usa_cftc_nc_holding() -> pd.DataFrame: """ 美国商品期货交易委员会CFTC外汇类非商业持仓报告, 数据区间从 19830107-至今 https://datacenter.jin10.com/reportType/dc_cftc_nc_report :return: 美国商品期货交易委员会CFTC外汇类非商业持仓报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/cftc_4.json", params=params ) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.fillna(value="[0, 0, 0]", inplace=True) big_df = pd.DataFrame() for item in temp_df.columns: for i in range(3): inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i]) inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"] big_df = pd.concat(objs=[big_df, inner_temp_df], axis=1) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-美国商品期货交易委员会CFTC商品类非商业持仓报告 def macro_usa_cftc_c_holding() -> pd.DataFrame: """ 美国商品期货交易委员会CFTC商品类非商业持仓报告, 数据区间从 19830107-至今 https://datacenter.jin10.com/reportType/dc_cftc_c_report :return: 美国商品期货交易委员会CFTC外汇类非商业持仓报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/cftc_2.json", params=params ) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.fillna(value="[0, 0, 0]", inplace=True) big_df = pd.DataFrame() for item in temp_df.columns: for i in range(3): inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i]) inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"] big_df = pd.concat(objs=[big_df, inner_temp_df], axis=1) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-美国商品期货交易委员会CFTC外汇类商业持仓报告 def macro_usa_cftc_merchant_currency_holding() -> pd.DataFrame: """ 美国商品期货交易委员会CFTC外汇类商业持仓报告, 数据区间从 19860115-至今 https://datacenter.jin10.com/reportType/dc_cftc_merchant_currency :return: 美国商品期货交易委员会CFTC外汇类商业持仓报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/cftc_3.json", params=params ) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.fillna(value="[0, 0, 0]", inplace=True) big_df = pd.DataFrame() for item in temp_df.columns: for i in range(3): inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i]) inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"] big_df = pd.concat(objs=[big_df, inner_temp_df], axis=1) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-美国商品期货交易委员会CFTC商品类商业持仓报告 def macro_usa_cftc_merchant_goods_holding() -> pd.DataFrame: """ 美国商品期货交易委员会CFTC商品类商业持仓报告, 数据区间从 19860115-至今 https://datacenter.jin10.com/reportType/dc_cftc_merchant_goods :return: 美国商品期货交易委员会CFTC商品类商业持仓报告 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/cftc_1.json", params=params ) json_data = r.json() temp_df = pd.DataFrame(json_data["values"]).T temp_df.fillna(value="[0, 0, 0]", inplace=True) big_df = pd.DataFrame() for item in temp_df.columns: for i in range(3): inner_temp_df = temp_df.loc[:, item].apply(lambda x: eval(str(x))[i]) inner_temp_df.name = inner_temp_df.name + "-" + json_data["keys"][i]["name"] big_df = pd.concat(objs=[big_df, inner_temp_df], axis=1) big_df = big_df.astype("float") big_df.reset_index(inplace=True) big_df.rename(columns={"index": "日期"}, inplace=True) big_df.sort_values(by=["日期"], ignore_index=True, inplace=True) return big_df # 金十数据中心-CME-贵金属 def macro_usa_cme_merchant_goods_holding(): """ CME-贵金属, 数据区间从 20180405-至今 https://datacenter.jin10.com/org :return: CME-贵金属 :rtype: pandas.DataFrame """ t = time.time() params = {"_": str(int(round(t * 1000)))} r = requests.get( url="https://cdn.jin10.com/data_center/reports/cme_3.json", params=params ) json_data = r.json() big_df = pd.DataFrame() for item in json_data["values"].keys(): temp_df = pd.DataFrame(json_data["values"][item]) temp_df["日期"] = item big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.columns = ["pz", "tc", "-", "-", "-", "成交量", "-", "-", "日期"] big_df["品种"] = big_df["pz"] + "-" + big_df["tc"] big_df = big_df[["日期", "品种", "成交量"]] big_df.sort_values(["日期"], ignore_index=True, inplace=True) return big_df if __name__ == "__main__": # 东方财富-经济指标-美国-未决房屋销售月率 macro_usa_phs_df = macro_usa_phs() print(macro_usa_phs_df) # 金十数据中心-经济指标-美国-经济状况-美国GDP macro_usa_gdp_monthly_df = macro_usa_gdp_monthly() print(macro_usa_gdp_monthly_df) # 金十数据中心-经济指标-美国-物价水平-美国CPI月率报告 macro_usa_cpi_monthly_df = macro_usa_cpi_monthly() print(macro_usa_cpi_monthly_df) # 金十数据中心-经济指标-美国-物价水平-美国核心CPI月率报告 macro_usa_core_cpi_monthly_df = macro_usa_core_cpi_monthly() print(macro_usa_core_cpi_monthly_df) # 金十数据中心-经济指标-美国-物价水平-美国个人支出月率报告 macro_usa_personal_spending_df = macro_usa_personal_spending() print(macro_usa_personal_spending_df) # 金十数据中心-经济指标-美国-物价水平-美国零售销售月率报告 macro_usa_retail_sales_df = macro_usa_retail_sales() print(macro_usa_retail_sales_df) # 金十数据中心-经济指标-美国-物价水平-美国进口物价指数报告 macro_usa_import_price_df = macro_usa_import_price() print(macro_usa_import_price_df) # 金十数据中心-经济指标-美国-物价水平-美国出口价格指数报告 macro_usa_export_price_df = macro_usa_export_price() print(macro_usa_export_price_df) # 金十数据中心-经济指标-美国-劳动力市场-LMCI macro_usa_lmci_df = macro_usa_lmci() print(macro_usa_lmci_df) # 金十数据中心-经济指标-美国-劳动力市场-失业率-美国失业率报告 macro_usa_unemployment_rate_df = macro_usa_unemployment_rate() print(macro_usa_unemployment_rate_df) # 金十数据中心-经济指标-美国-劳动力市场-失业率-美国挑战者企业裁员人数报告 macro_usa_job_cuts_df = macro_usa_job_cuts() print(macro_usa_job_cuts_df) # 金十数据中心-经济指标-美国-劳动力市场-就业人口-美国非农就业人数报告 macro_usa_non_farm_df = macro_usa_non_farm() print(macro_usa_non_farm_df) # 金十数据中心-经济指标-美国-劳动力市场-就业人口-美国ADP就业人数报告 macro_usa_adp_employment_df = macro_usa_adp_employment() print(macro_usa_adp_employment_df) # 金十数据中心-经济指标-美国-劳动力市场-消费者收入与支出-美国核心PCE物价指数年率报告 macro_usa_core_pce_price_df = macro_usa_core_pce_price() print(macro_usa_core_pce_price_df) # 金十数据中心-经济指标-美国-劳动力市场-消费者收入与支出-美国实际个人消费支出季率初值报告 macro_usa_real_consumer_spending_df = macro_usa_real_consumer_spending() print(macro_usa_real_consumer_spending_df) # 金十数据中心-经济指标-美国-贸易状况-美国贸易帐报告 macro_usa_trade_balance_df = macro_usa_trade_balance() print(macro_usa_trade_balance_df) # 金十数据中心-经济指标-美国-贸易状况-美国经常帐报告 macro_usa_current_account_df = macro_usa_current_account() print(macro_usa_current_account_df) # 金十数据中心-经济指标-美国-产业指标-制造业-贝克休斯钻井报告 macro_usa_rig_count_df = macro_usa_rig_count() print(macro_usa_rig_count_df) # 金十数据中心-经济指标-美国-产业指标-制造业-美国生产者物价指数(PPI)报告 macro_usa_ppi_df = macro_usa_ppi() print(macro_usa_ppi_df) # 金十数据中心-经济指标-美国-产业指标-制造业-美国核心生产者物价指数(PPI)报告 macro_usa_core_ppi_df = macro_usa_core_ppi() print(macro_usa_core_ppi_df) # 金十数据中心-经济指标-美国-产业指标-制造业-美国API原油库存报告 macro_usa_api_crude_stock_df = macro_usa_api_crude_stock() print(macro_usa_api_crude_stock_df) # 金十数据中心-经济指标-美国-产业指标-制造业-美国Markit制造业PMI初值报告 macro_usa_pmi_df = macro_usa_pmi() print(macro_usa_pmi_df) # 金十数据中心-经济指标-美国-产业指标-制造业-美国ISM制造业PMI报告 macro_usa_ism_pmi_df = macro_usa_ism_pmi() print(macro_usa_ism_pmi_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国NAHB房产市场指数报告 macro_usa_nahb_house_market_index_df = macro_usa_nahb_house_market_index() print(macro_usa_nahb_house_market_index_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国新屋开工总数年化报告 macro_usa_house_starts_df = macro_usa_house_starts() print(macro_usa_house_starts_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国新屋销售总数年化报告 macro_usa_new_home_sales_df = macro_usa_new_home_sales() print(macro_usa_new_home_sales_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国营建许可总数报告 macro_usa_building_permits_df = macro_usa_building_permits() print(macro_usa_building_permits_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国成屋销售总数年化报告 macro_usa_exist_home_sales_df = macro_usa_exist_home_sales() print(macro_usa_exist_home_sales_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国FHFA房价指数月率报告 macro_usa_house_price_index_df = macro_usa_house_price_index() print(macro_usa_house_price_index_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国S&P/CS20座大城市房价指数年率报告 macro_usa_spcs20_df = macro_usa_spcs20() print(macro_usa_spcs20_df) # 金十数据中心-经济指标-美国-产业指标-房地产-美国成屋签约销售指数月率报告 macro_usa_pending_home_sales_df = macro_usa_pending_home_sales() print(macro_usa_pending_home_sales_df) # 金十数据中心-经济指标-美国-领先指标-美国谘商会消费者信心指数报告 macro_usa_cb_consumer_confidence_df = macro_usa_cb_consumer_confidence() print(macro_usa_cb_consumer_confidence_df) # 金十数据中心-经济指标-美国-领先指标-美国NFIB小型企业信心指数报告 macro_usa_nfib_small_business_df = macro_usa_nfib_small_business() print(macro_usa_nfib_small_business_df) # 金十数据中心-经济指标-美国-领先指标-美国密歇根大学消费者信心指数初值报告 macro_usa_michigan_consumer_sentiment_df = macro_usa_michigan_consumer_sentiment() print(macro_usa_michigan_consumer_sentiment_df) # 金十数据中心-经济指标-美国-其他-美国EIA原油库存报告 macro_usa_eia_crude_rate_df = macro_usa_eia_crude_rate() print(macro_usa_eia_crude_rate_df) # 金十数据中心-经济指标-美国-其他-美国初请失业金人数报告 macro_usa_initial_jobless_df = macro_usa_initial_jobless() print(macro_usa_initial_jobless_df) # 金十数据中心-经济指标-美国-其他-美国原油产量报告 macro_usa_crude_inner_df = macro_usa_crude_inner() print(macro_usa_crude_inner_df) # 金十数据中心-美国商品期货交易委员会CFTC外汇类非商业持仓报告 macro_usa_cftc_nc_holding_df = macro_usa_cftc_nc_holding() print(macro_usa_cftc_nc_holding_df) # 金十数据中心-美国商品期货交易委员会CFTC商品类非商业持仓报告 macro_usa_cftc_c_holding_df = macro_usa_cftc_c_holding() print(macro_usa_cftc_c_holding_df) # 金十数据中心-美国商品期货交易委员会CFTC外汇类商业持仓报告 macro_usa_cftc_merchant_currency_holding_df = ( macro_usa_cftc_merchant_currency_holding() ) print(macro_usa_cftc_merchant_currency_holding_df) # 金十数据中心-美国商品期货交易委员会CFTC商品类商业持仓报告 macro_usa_cftc_merchant_goods_holding_df = macro_usa_cftc_merchant_goods_holding() print(macro_usa_cftc_merchant_goods_holding_df) # 金十数据中心-CME-贵金属 macro_usa_cme_merchant_goods_holding_df = macro_usa_cme_merchant_goods_holding() print(macro_usa_cme_merchant_goods_holding_df) ================================================ FILE: akshare/economic/marco_cnbs.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/8/14 11:10 Desc: 国家金融与发展实验室-中国宏观杠杆率数据 http://114.115.232.154:8080/ """ import pandas as pd def macro_cnbs() -> pd.DataFrame: """ 国家金融与发展实验室-中国宏观杠杆率数据 http://114.115.232.154:8080/ :return: 中国宏观杠杆率数据 :rtype: pandas.DataFrame """ url = "http://114.115.232.154:8080/handler/download.ashx" temp_df = pd.read_excel( url, sheet_name="Data", header=0, skiprows=1, engine="openpyxl" ) temp_df["Period"] = pd.to_datetime(temp_df["Period"]).dt.strftime("%Y-%m") temp_df.dropna(axis=1, inplace=True) temp_df.rename( columns={ "Period": "年份", "Household": "居民部门", "Non-financial corporations": "非金融企业部门", "Central government ": "中央政府", "Local government": "地方政府", "General government": "政府部门", "Non financial sector": "实体经济部门", "Financial sector(asset side)": "金融部门资产方", "Financial sector(liability side)": "金融部门负债方", }, inplace=True, ) column_order = [ "年份", "居民部门", "非金融企业部门", "政府部门", "中央政府", "地方政府", "实体经济部门", "金融部门资产方", "金融部门负债方", ] temp_df = temp_df.reindex(columns=column_order) 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") 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") temp_df["金融部门资产方"] = pd.to_numeric( temp_df["金融部门资产方"], errors="coerce" ) temp_df["金融部门负债方"] = pd.to_numeric( temp_df["金融部门负债方"], errors="coerce" ) return temp_df if __name__ == "__main__": macro_cnbs_df = macro_cnbs() print(macro_cnbs_df) ================================================ FILE: akshare/energy/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/12/17 16:54 Desc: """ ================================================ FILE: akshare/energy/energy_carbon.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/6/25 15:00 Desc: 碳排放交易 北京市碳排放权电子交易平台-北京市碳排放权公开交易行情 https://www.bjets.com.cn/article/jyxx/ 深圳碳排放交易所-国内碳情 http://www.cerx.cn/dailynewsCN/index.htm 深圳碳排放交易所-国际碳情 http://www.cerx.cn/dailynewsOuter/index.htm 湖北碳排放权交易中心-现货交易数据-配额-每日概况 http://www.cerx.cn/dailynewsOuter/index.htm 广州碳排放权交易中心-行情信息 http://www.cnemission.com/article/hqxx/ """ from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup from tqdm import tqdm from akshare.utils import demjson from akshare.utils.cons import headers def energy_carbon_domestic(symbol: str = "湖北") -> pd.DataFrame: """ 碳交易网-行情信息 http://www.tanjiaoyi.com/ :param symbol: choice of {'湖北', '上海', '北京', '重庆', '广东', '天津', '深圳', '福建'} :type symbol: str :return: 行情信息 :rtype: pandas.DataFrame """ url = "http://k.tanjiaoyi.com:8080/KDataController/getHouseDatasInAverage.do" params = { "lcnK": "53f75bfcefff58e4046ccfa42171636c", "brand": "TAN", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("(") + 1 : -1]) temp_df = pd.DataFrame(data_json[symbol]) temp_df.columns = [ "成交价", "_", "成交量", "地点", "成交额", "日期", "_", ] temp_df = temp_df[ [ "日期", "成交价", "成交量", "成交额", "地点", ] ] 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") return temp_df def energy_carbon_bj() -> pd.DataFrame: """ 北京市碳排放权电子交易平台-北京市碳排放权公开交易行情 https://www.bjets.com.cn/article/jyxx/ :return: 北京市碳排放权公开交易行情 :rtype: pandas.DataFrame """ url = "https://www.bjets.com.cn/article/jyxx/" r = requests.get(url, verify=False, headers=headers) soup = BeautifulSoup(r.text, features="lxml") total_page = ( soup.find("table") .find("script") .string.split("=")[-1] .strip() .strip(";") .strip('"') ) temp_df = pd.DataFrame() for i in tqdm( range(1, int(total_page) + 1), desc="Please wait for a moment", leave=False, ): if i == 1: i = "" url = f"https://www.bjets.com.cn/article/jyxx/?{i}" r = requests.get(url, verify=False, headers=headers) r.encoding = "utf-8" df = pd.read_html(StringIO(r.text))[0] temp_df = pd.concat(objs=[temp_df, df], ignore_index=True) temp_df.columns = ["日期", "成交量", "成交均价", "成交额"] temp_df["成交单位"] = ( temp_df["成交额"] .str.split("(", expand=True) .iloc[:, 1] .str.split(")", expand=True) .iloc[:, 0] .str.split(")", expand=True) .iloc[:, 0] ) temp_df["成交额"] = ( temp_df["成交额"] .str.split("(", expand=True) .iloc[:, 0] .str.split("(", expand=True) .iloc[:, 0] ) temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce") temp_df["成交均价"] = pd.to_numeric(temp_df["成交均价"], errors="coerce") temp_df["成交额"] = 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.sort_values(by="日期", inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df def energy_carbon_sz() -> pd.DataFrame: """ 深圳碳排放交易所-国内碳情 http://www.cerx.cn/dailynewsCN/index.htm :return: 国内碳情每日行情数据 :rtype: pandas.DataFrame """ url = "http://www.cerx.cn/dailynewsCN/index.htm" r = requests.get(url, headers=headers) soup = BeautifulSoup(r.text, features="lxml") page_num = int(soup.find(attrs={"class": "pagebar"}).find_all("option")[-1].text) big_df = pd.read_html(StringIO(r.text), header=0)[0] for page in tqdm( range(2, page_num + 1), desc="Please wait for a moment", leave=False ): url = f"http://www.cerx.cn/dailynewsCN/index_{page}.htm" r = requests.get(url, headers=headers) temp_df = pd.read_html(StringIO(r.text), header=0)[0] big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df["交易日期"] = pd.to_datetime(big_df["交易日期"], errors="coerce").dt.date big_df["开盘价"] = pd.to_numeric(big_df["开盘价"], errors="coerce") big_df["最高价"] = pd.to_numeric(big_df["最高价"], errors="coerce") big_df["最低价"] = pd.to_numeric(big_df["最低价"], errors="coerce") big_df["成交均价"] = pd.to_numeric(big_df["成交均价"], errors="coerce") big_df["收盘价"] = pd.to_numeric(big_df["收盘价"], errors="coerce") big_df["成交量"] = pd.to_numeric(big_df["成交量"], errors="coerce") big_df["成交额"] = pd.to_numeric(big_df["成交额"], errors="coerce") big_df.sort_values(by="交易日期", inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def energy_carbon_eu() -> pd.DataFrame: """ 深圳碳排放交易所-国际碳情 http://www.cerx.cn/dailynewsOuter/index.htm :return: 国际碳情每日行情数据 :rtype: pandas.DataFrame """ url = "http://www.cerx.cn/dailynewsOuter/index.htm" r = requests.get(url, headers=headers) soup = BeautifulSoup(r.text, features="lxml") page_num = int(soup.find(attrs={"class": "pagebar"}).find_all("option")[-1].text) big_df = pd.read_html(StringIO(r.text), header=0)[0] for page in tqdm( range(2, page_num + 1), desc="Please wait for a moment", leave=False ): url = f"http://www.cerx.cn/dailynewsOuter/index_{page}.htm" r = requests.get(url) temp_df = pd.read_html(StringIO(r.text), header=0)[0] big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df["交易日期"] = pd.to_datetime(big_df["交易日期"], errors="coerce").dt.date big_df["开盘价"] = pd.to_numeric(big_df["开盘价"], errors="coerce") big_df["最高价"] = pd.to_numeric(big_df["最高价"], errors="coerce") big_df["最低价"] = pd.to_numeric(big_df["最低价"], errors="coerce") big_df["成交均价"] = pd.to_numeric(big_df["成交均价"], errors="coerce") big_df["收盘价"] = pd.to_numeric(big_df["收盘价"], errors="coerce") big_df["成交量"] = pd.to_numeric(big_df["成交量"], errors="coerce") big_df["成交额"] = pd.to_numeric(big_df["成交额"], errors="coerce") big_df.sort_values(by="交易日期", inplace=True) big_df.reset_index(inplace=True, drop=True) return big_df def energy_carbon_hb() -> pd.DataFrame: """ 湖北碳排放权交易中心-现货交易数据-配额-每日概况 http://www.hbets.cn/list/13.html?page=42 :return: 现货交易数据-配额-每日概况行情数据 :rtype: pandas.DataFrame """ url = "https://www.hbets.cn/" r = requests.get(url, headers=headers) soup = BeautifulSoup(r.text, features="lxml") data_text = ( soup.find(name="div", attrs={"class": "threeLeft"}).find_all("script")[1].text ) start_pos = data_text.find("cjj = '[") + 7 # 找到 JSON 数组开始的位置 end_pos = data_text.rfind("cjj =") - 31 # 找到 JSON 数组结束的位置 data_json = demjson.decode(data_text[start_pos:end_pos]) temp_df = pd.DataFrame.from_dict(data_json) temp_df.rename( columns={ "riqi": "日期", "cjj": "成交价", "cjl": "成交量", "zx": "最新", "zd": "涨跌", }, inplace=True, ) temp_df = temp_df[ [ "日期", "成交价", "成交量", "最新", "涨跌", ] ] 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") temp_df["涨跌"] = pd.to_numeric(temp_df["涨跌"], errors="coerce") return temp_df def energy_carbon_gz() -> pd.DataFrame: """ 广州碳排放权交易中心-行情信息 http://www.cnemission.com/article/hqxx/ :return: 行情信息数据 :rtype: pandas.DataFrame """ url = "http://ets.cnemission.com/carbon/portalIndex/markethistory" params = { "Top": "1", "beginTime": "2010-01-01", "endTime": "2030-09-12", } r = requests.get(url, params=params) temp_df = pd.read_html(StringIO(r.text), header=0)[1] temp_df.columns = [ "日期", "品种", "开盘价", "收盘价", "最高价", "最低价", "涨跌", "涨跌幅", "成交数量", "成交金额", ] temp_df["日期"] = pd.to_datetime( temp_df["日期"], format="%Y%m%d", 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") temp_df["最低价"] = pd.to_numeric(temp_df["最低价"], errors="coerce") temp_df["涨跌"] = pd.to_numeric(temp_df["涨跌"], errors="coerce") temp_df["涨跌幅"] = temp_df["涨跌幅"].str.strip("%") 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") temp_df.sort_values(by="日期", inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df if __name__ == "__main__": energy_carbon_domestic_df = energy_carbon_domestic(symbol="湖北") print(energy_carbon_domestic_df) energy_carbon_domestic_df = energy_carbon_domestic(symbol="深圳") print(energy_carbon_domestic_df) energy_carbon_bj_df = energy_carbon_bj() print(energy_carbon_bj_df) energy_carbon_sz_df = energy_carbon_sz() print(energy_carbon_sz_df) energy_carbon_eu_df = energy_carbon_eu() print(energy_carbon_eu_df) energy_carbon_hb_df = energy_carbon_hb() print(energy_carbon_hb_df) energy_carbon_gz_df = energy_carbon_gz() print(energy_carbon_gz_df) ================================================ FILE: akshare/energy/energy_oil_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/1/20 23:00 Desc: 东方财富-数据中心-中国油价 https://data.eastmoney.com/cjsj/oil_default.html """ import pandas as pd import requests def energy_oil_hist() -> pd.DataFrame: """ 汽柴油历史调价信息 https://data.eastmoney.com/cjsj/oil_default.html :return: 汽柴油历史调价信息 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPTA_WEB_YJ_BD", "columns": "ALL", "sortColumns": "dim_date", "sortTypes": "-1", "token": "894050c76af8597a853f5b408b759f5d", "pageNumber": "1", "pageSize": "1000", "source": "WEB", "p": "1", "pageNo": "1", "pageNum": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = ["调整日期", "汽油价格", "柴油价格", "汽油涨跌", "柴油涨跌"] 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") temp_df["柴油涨跌"] = pd.to_numeric(temp_df["柴油涨跌"], errors="coerce") temp_df.sort_values(by=["调整日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df def energy_oil_detail(date: str = "20220517") -> pd.DataFrame: """ 全国各地区的汽油和柴油油价 https://data.eastmoney.com/cjsj/oil_default.html :param date: 可以调用 ak.energy_oil_hist() 得到可以获取油价的调整时间 :type date: str :return: oil price at specific date :rtype: pandas.DataFrame """ date = "-".join([date[:4], date[4:6], date[6:]]) url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPTA_WEB_YJ_JH", "columns": "ALL", "filter": f"(dim_date='{date}')", "sortColumns": "cityname", "sortTypes": "1", "token": "894050c76af8597a853f5b408b759f5d", "pageNumber": "1", "pageSize": "1000", "source": "WEB", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]).iloc[:, 1:] temp_df.columns = [ "日期", "地区", "V_0", "V_92", "V_95", "V_89", "ZDE_0", "ZDE_92", "ZDE_95", "ZDE_89", "QE_0", "QE_92", "QE_95", "QE_89", "首字母", ] del temp_df["首字母"] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["V_0"] = pd.to_numeric(temp_df["V_0"], errors="coerce") temp_df["V_92"] = pd.to_numeric(temp_df["V_92"], errors="coerce") temp_df["V_95"] = pd.to_numeric(temp_df["V_95"], errors="coerce") temp_df["V_89"] = pd.to_numeric(temp_df["V_89"], errors="coerce") temp_df["ZDE_0"] = pd.to_numeric(temp_df["ZDE_0"], errors="coerce") temp_df["ZDE_92"] = pd.to_numeric(temp_df["ZDE_92"], errors="coerce") temp_df["ZDE_95"] = pd.to_numeric(temp_df["ZDE_95"], errors="coerce") temp_df["ZDE_89"] = pd.to_numeric(temp_df["ZDE_89"], errors="coerce") temp_df["QE_0"] = pd.to_numeric(temp_df["QE_0"], errors="coerce") temp_df["QE_92"] = pd.to_numeric(temp_df["QE_92"], errors="coerce") temp_df["QE_95"] = pd.to_numeric(temp_df["QE_95"], errors="coerce") temp_df["QE_89"] = pd.to_numeric(temp_df["QE_89"], errors="coerce") return temp_df if __name__ == "__main__": energy_oil_hist_df = energy_oil_hist() print(energy_oil_hist_df) energy_oil_detail_df = energy_oil_detail(date="20240118") print(energy_oil_detail_df) ================================================ FILE: akshare/event/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2020/1/23 9:07 Desc: """ ================================================ FILE: akshare/event/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/9/24 15:22 Desc: 百度地图慧眼-迁徙城市代码映射 """ province_dict = { "820000": "澳门", "810000": "香港", "710000": "台湾省", "650000": "新疆维吾尔自治区", "640000": "宁夏回族自治区", "630000": "青海省", "620000": "甘肃省", "610000": "陕西省", "540000": "西藏自治区", "530000": "云南省", "520000": "贵州省", "510000": "四川省", "500000": "重庆市", "460000": "海南省", "450000": "广西壮族自治区", "440000": "广东省", "430000": "湖南省", "420000": "湖北省", "410000": "河南省", "370000": "山东省", "360000": "江西省", "350000": "福建省", "340000": "安徽省", "330000": "浙江省", "320000": "江苏省", "310000": "上海市", "230000": "黑龙江省", "220000": "吉林省", "210000": "辽宁省", "150000": "内蒙古自治区", "140000": "山西省", "130000": "河北省", "120000": "天津市", "110000": "北京市", } city_dict = { "520300": "遵义市", "510300": "自贡市", "370300": "淄博市", "512000": "资阳市", "411700": "驻马店市", "430200": "株洲市", "440400": "珠海市", "411600": "周口市", "330900": "舟山市", "500100": "重庆市", "500200": "重庆市", "640500": "中卫市", "442000": "中山市", "410100": "郑州市", "321100": "镇江市", "441200": "肇庆市", "530600": "昭通市", "140400": "长治市", "430100": "长沙市", "220100": "长春市", "350600": "漳州市", "719007": "彰化县", "620700": "张掖市", "130700": "张家口市", "430800": "张家界市", "440800": "湛江市", "370400": "枣庄市", "140800": "运城市", "719008": "云林县", "445300": "云浮市", "430600": "岳阳市", "530400": "玉溪市", "632700": "玉树藏族自治州", "450900": "玉林市", "610800": "榆林市", "431100": "永州市", "210800": "营口市", "360600": "鹰潭市", "640100": "银川市", "430900": "益阳市", "719005": "宜兰县", "360900": "宜春市", "420500": "宜昌市", "511500": "宜宾市", "654000": "伊犁哈萨克自治州", "230700": "伊春市", "140300": "阳泉市", "441700": "阳江市", "321000": "扬州市", "320900": "盐城市", "222400": "延边朝鲜族自治州", "610600": "延安市", "370600": "烟台市", "511800": "雅安市", "341800": "宣城市", "411000": "许昌市", "320300": "徐州市", "341300": "宿州市", "321300": "宿迁市", "152200": "兴安盟", "130500": "邢台市", "411500": "信阳市", "719004": "新竹县", "719002": "新竹市", "360500": "新余市", "410700": "新乡市", "710300": "新北市", "140900": "忻州市", "420900": "孝感市", "420600": "襄阳市", "433100": "湘西土家族苗族自治州", "430300": "湘潭市", "810000": "香港", "610400": "咸阳市", "421200": "咸宁市", "429004": "仙桃市", "152500": "锡林郭勒盟", "532800": "西双版纳傣族自治州", "630100": "西宁市", "610100": "西安市", "620600": "武威市", "420100": "武汉市", "469001": "五指山市", "659004": "五家渠市", "450400": "梧州市", "640300": "吴忠市", "340200": "芜湖市", "320200": "无锡市", "650100": "乌鲁木齐市", "150900": "乌兰察布市", "150300": "乌海市", "532600": "文山壮族苗族自治州", "469005": "文昌市", "330300": "温州市", "610500": "渭南市", "370700": "潍坊市", "371000": "威海市", "469006": "万宁市", "469022": "屯昌县", "650400": "吐鲁番市", "659003": "图木舒克市", "520600": "铜仁市", "340700": "铜陵市", "610200": "铜川市", "150500": "通辽市", "220500": "通化市", "659006": "铁门关市", "211200": "铁岭市", "620500": "天水市", "429006": "天门市", "120100": "天津市", "710600": "桃园市", "130200": "唐山市", "321200": "泰州市", "370900": "泰安市", "140100": "太原市", "331000": "台州市", "710400": "台中市", "710500": "台南市", "719012": "台东县", "710100": "台北市", "654200": "塔城地区", "510900": "遂宁市", "421300": "随州市", "231200": "绥化市", "320500": "苏州市", "220700": "松原市", "220300": "四平市", "140600": "朔州市", "230500": "双鸭山市", "659007": "双河市", "640200": "石嘴山市", "130100": "石家庄市", "659001": "石河子市", "420300": "十堰市", "210100": "沈阳市", "429021": "神农架林区", "440300": "深圳市", "330600": "绍兴市", "430500": "邵阳市", "440200": "韶关市", "361100": "上饶市", "310100": "上海市", "411400": "商丘市", "611000": "商洛市", "441500": "汕尾市", "440500": "汕头市", "540500": "山南市", "350200": "厦门市", "460200": "三亚市", "460300": "三沙市", "350400": "三明市", "411200": "三门峡市", "371100": "日照市", "540200": "日喀则市", "350500": "泉州市", "530300": "曲靖市", "330800": "衢州市", "469030": "琼中黎族苗族自治县", "469002": "琼海市", "621000": "庆阳市", "441800": "清远市", "370200": "青岛市", "130300": "秦皇岛市", "450700": "钦州市", "522300": "黔西南布依族苗族自治州", "522700": "黔南布依族苗族自治州", "522600": "黔东南苗族侗族自治州", "429005": "潜江市", "230200": "齐齐哈尔市", "230900": "七台河市", "530800": "普洱市", "410900": "濮阳市", "350300": "莆田市", "360300": "萍乡市", "719011": "屏东县", "620800": "平凉市", "410400": "平顶山市", "719014": "澎湖县", "211100": "盘锦市", "510400": "攀枝花市", "533300": "怒江傈僳族自治州", "350900": "宁德市", "330200": "宁波市", "511000": "内江市", "411300": "南阳市", "719009": "南投县", "320600": "南通市", "350700": "南平市", "450100": "南宁市", "320100": "南京市", "511300": "南充市", "360100": "南昌市", "540600": "那曲市", "231000": "牡丹江市", "719006": "苗栗县", "510700": "绵阳市", "441400": "梅州市", "511400": "眉山市", "440900": "茂名市", "340500": "马鞍山市", "141100": "吕梁市", "411100": "漯河市", "410300": "洛阳市", "510500": "泸州市", "431300": "娄底市", "621200": "陇南市", "350800": "龙岩市", "520200": "六盘水市", "341500": "六安市", "450200": "柳州市", "469028": "陵水黎族自治县", "371300": "临沂市", "622900": "临夏回族自治州", "469024": "临高县", "141000": "临汾市", "530900": "临沧市", "540400": "林芝市", "371500": "聊城市", "220400": "辽源市", "211000": "辽阳市", "513400": "凉山彝族自治州", "320700": "连云港市", "331100": "丽水市", "530700": "丽江市", "511100": "乐山市", "469027": "乐东黎族自治县", "131000": "廊坊市", "620100": "兰州市", "451300": "来宾市", "540100": "拉萨市", "659009": "昆玉市", "530100": "昆明市", "653000": "克孜勒苏柯尔克孜自治州", "650200": "克拉玛依市", "659008": "可克达拉市", "410200": "开封市", "653100": "喀什地区", "620900": "酒泉市", "360400": "九江市", "360200": "景德镇市", "421000": "荆州市", "420800": "荆门市", "140700": "晋中市", "140500": "晋城市", "210700": "锦州市", "330700": "金华市", "620300": "金昌市", "445200": "揭阳市", "410800": "焦作市", "440700": "江门市", "620200": "嘉峪关市", "719010": "嘉义县", "719003": "嘉义市", "330400": "嘉兴市", "230800": "佳木斯市", "419001": "济源市", "370800": "济宁市", "370100": "济南市", "220200": "吉林市", "360800": "吉安市", "719001": "基隆市", "230300": "鸡西市", "441300": "惠州市", "420200": "黄石市", "341000": "黄山市", "632300": "黄南藏族自治州", "421100": "黄冈市", "340400": "淮南市", "340600": "淮北市", "320800": "淮安市", "431200": "怀化市", "719013": "花莲县", "330500": "湖州市", "211400": "葫芦岛市", "150700": "呼伦贝尔市", "150100": "呼和浩特市", "532500": "红河哈尼族彝族自治州", "430400": "衡阳市", "131100": "衡水市", "231100": "黑河市", "230400": "鹤岗市", "410600": "鹤壁市", "451100": "贺州市", "371700": "菏泽市", "441600": "河源市", "451200": "河池市", "653200": "和田地区", "340100": "合肥市", "330100": "杭州市", "610700": "汉中市", "130400": "邯郸市", "632800": "海西蒙古族藏族自治州", "632500": "海南藏族自治州", "460100": "海口市", "630200": "海东市", "632200": "海北藏族自治州", "650500": "哈密市", "230100": "哈尔滨市", "632600": "果洛藏族自治州", "450300": "桂林市", "520100": "贵阳市", "450800": "贵港市", "440100": "广州市", "510800": "广元市", "511600": "广安市", "640400": "固原市", "710200": "高雄市", "360700": "赣州市", "513300": "甘孜藏族自治州", "623000": "甘南藏族自治州", "341200": "阜阳市", "210900": "阜新市", "361000": "抚州市", "210400": "抚顺市", "350100": "福州市", "440600": "佛山市", "450600": "防城港市", "422800": "恩施土家族苗族自治州", "420700": "鄂州市", "150600": "鄂尔多斯市", "370500": "东营市", "441900": "东莞市", "469007": "东方市", "621100": "定西市", "469021": "定安县", "533400": "迪庆藏族自治州", "371400": "德州市", "510600": "德阳市", "533100": "德宏傣族景颇族自治州", "460400": "儋州市", "210600": "丹东市", "232700": "大兴安岭地区", "140200": "大同市", "230600": "大庆市", "210200": "大连市", "532900": "大理白族自治州", "511700": "达州市", "532300": "楚雄彝族自治州", "341100": "滁州市", "451400": "崇左市", "150400": "赤峰市", "341700": "池州市", "469023": "澄迈县", "130800": "承德市", "510100": "成都市", "431000": "郴州市", "445100": "潮州市", "211300": "朝阳市", "320400": "常州市", "430700": "常德市", "469026": "昌江黎族自治县", "652300": "昌吉回族自治州", "540300": "昌都市", "130900": "沧州市", "652700": "博尔塔拉蒙古自治州", "341600": "亳州市", "371600": "滨州市", "520500": "毕节市", "210500": "本溪市", "659005": "北屯市", "110100": "北京市", "450500": "北海市", "469029": "保亭黎族苗族自治县", "530500": "保山市", "130600": "保定市", "610300": "宝鸡市", "150200": "包头市", "340300": "蚌埠市", "451000": "百色市", "620400": "白银市", "220600": "白山市", "469025": "白沙黎族自治县", "220800": "白城市", "511900": "巴中市", "652800": "巴音郭楞蒙古自治州", "150800": "巴彦淖尔市", "820000": "澳门", "210300": "鞍山市", "410500": "安阳市", "520400": "安顺市", "340800": "安庆市", "610900": "安康市", "542500": "阿里地区", "654300": "阿勒泰地区", "152900": "阿拉善盟", "659002": "阿拉尔市", "652900": "阿克苏地区", "513200": "阿坝藏族羌族自治州", } ================================================ FILE: akshare/event/migration.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/5/12 22:30 Desc: 百度地图慧眼-百度迁徙数据 """ import json import pandas as pd import requests from akshare.event.cons import province_dict, city_dict def migration_area_baidu( area: str = "重庆市", indicator: str = "move_in", date: str = "20230922" ) -> pd.DataFrame: """ 百度地图慧眼-百度迁徙-XXX迁入地详情 百度地图慧眼-百度迁徙-XXX迁出地详情 以上展示 top100 结果,如不够 100 则展示全部 迁入来源地比例: 从 xx 地迁入到当前区域的人数与当前区域迁入总人口的比值 迁出目的地比例: 从当前区域迁出到 xx 的人口与从当前区域迁出总人口的比值 https://qianxi.baidu.com/?from=shoubai#city=0 :param area: 可以输入 省份 或者 具体城市 但是需要用全称 :type area: str :param indicator: move_in 迁入 move_out 迁出 :type indicator: str :param date: 查询的日期 20200101 以后的时间 :type date: str :return: 迁入地详情/迁出地详情的前 50 个 :rtype: pandas.DataFrame """ city_dict.update(province_dict) inner_dict = dict(zip(city_dict.values(), city_dict.keys())) if inner_dict[area] in province_dict.keys(): dt_flag = "province" else: dt_flag = "city" url = "https://huiyan.baidu.com/migration/cityrank.jsonp" params = { "dt": dt_flag, "id": inner_dict[area], "type": indicator, "date": date, } r = requests.get(url, params=params) data_text = r.text[r.text.find("({") + 1 : r.text.rfind(");")] data_json = json.loads(data_text) temp_df = pd.DataFrame(data_json["data"]["list"]) temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce") return temp_df def migration_scale_baidu( area: str = "广州市", indicator: str = "move_in", ) -> pd.DataFrame: """ 百度地图慧眼-百度迁徙-迁徙规模 迁徙规模指数:反映迁入或迁出人口规模,城市间可横向对比城市迁徙边界采用该城市行政区划,包含该城市管辖的区、县、乡、村 https://qianxi.baidu.com/?from=shoubai#city=0 :param area: 可以输入 省份 或者 具体城市 但是需要用全称 :type area: str :param indicator: move_in 迁入 move_out 迁出 :type indicator: str :return: 时间序列的迁徙规模指数 :rtype: pandas.DataFrame """ city_dict.update(province_dict) inner_dict = dict(zip(city_dict.values(), city_dict.keys())) if inner_dict[area] in province_dict.keys(): dt_flag = "province" else: dt_flag = "city" url = "https://huiyan.baidu.com/migration/historycurve.jsonp" params = { "dt": dt_flag, "id": inner_dict[area], "type": indicator, } r = requests.get(url, params=params) json_data = json.loads(r.text[r.text.find("({") + 1 : r.text.rfind(");")]) temp_df = pd.DataFrame.from_dict(json_data["data"]["list"], orient="index") temp_df.index = pd.to_datetime(temp_df.index) temp_df.reset_index(inplace=True) temp_df.columns = ["日期", "迁徙规模指数"] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["迁徙规模指数"] = pd.to_numeric(temp_df["迁徙规模指数"], errors="coerce") return temp_df if __name__ == "__main__": migration_area_baidu_df = migration_area_baidu( area="杭州市", indicator="move_out", date="20240401" ) print(migration_area_baidu_df) migration_scale_baidu_df = migration_scale_baidu( area="广州市", indicator="move_in", ) print(migration_scale_baidu_df) ================================================ FILE: akshare/exceptions.py ================================================ """ AKShare 异常处理模块 """ class AkshareException(Exception): """Base exception for akshare library""" def __init__(self, message): self.message = message super().__init__(self.message) class APIError(AkshareException): """Raised when API request fails""" def __init__(self, message, status_code=None): self.status_code = status_code super().__init__(f"API Error: {message} (Status code: {status_code})") class DataParsingError(AkshareException): """Raised when data parsing fails""" pass class InvalidParameterError(AkshareException): """Raised when an invalid parameter is provided""" pass class NetworkError(AkshareException): """Raised when network-related issues occur""" pass class RateLimitError(AkshareException): """Raised when API rate limit is exceeded""" pass ================================================ FILE: akshare/file_fold/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/9/30 13:58 Desc: """ ================================================ FILE: akshare/file_fold/calendar.json ================================================ [ "19901219", "19901220", "19901221", "19901224", "19901225", "19901226", "19901227", "19901228", "19901231", "19910102", "19910103", "19910104", "19910107", "19910108", "19910109", "19910110", "19910111", "19910114", "19910115", "19910116", "19910117", "19910118", "19910121", "19910122", "19910123", "19910124", "19910125", "19910128", "19910129", "19910130", "19910131", "19910201", "19910204", "19910205", "19910206", "19910207", "19910208", "19910211", "19910212", "19910213", "19910214", "19910219", "19910220", "19910221", "19910222", "19910225", "19910226", "19910227", "19910228", "19910301", "19910304", "19910305", "19910306", "19910307", "19910308", "19910311", "19910312", "19910313", "19910314", "19910315", "19910318", "19910319", "19910320", "19910321", "19910322", "19910325", "19910326", "19910327", "19910328", "19910329", "19910401", "19910402", "19910403", "19910404", "19910405", "19910408", "19910409", "19910410", "19910411", "19910412", "19910415", "19910416", "19910417", "19910418", "19910419", "19910422", "19910423", "19910424", "19910425", "19910426", "19910429", "19910430", "19910502", "19910503", "19910506", "19910507", "19910508", "19910509", "19910510", "19910513", "19910514", "19910515", "19910516", "19910517", "19910520", "19910521", "19910522", "19910523", "19910524", "19910527", "19910528", "19910529", "19910530", "19910531", "19910603", "19910604", "19910605", "19910606", "19910607", "19910610", "19910611", "19910612", "19910613", "19910614", "19910617", "19910618", "19910619", "19910620", "19910621", "19910624", "19910625", "19910626", "19910627", "19910628", "19910701", "19910702", "19910703", "19910704", "19910705", "19910708", "19910709", "19910710", "19910711", "19910712", "19910715", "19910716", "19910717", "19910718", "19910719", "19910722", "19910723", "19910724", "19910725", "19910726", "19910729", "19910730", "19910731", "19910801", "19910802", "19910805", "19910806", "19910807", "19910808", "19910809", "19910812", "19910813", "19910814", "19910815", "19910816", "19910819", "19910820", "19910821", "19910822", "19910823", "19910826", "19910827", "19910828", "19910829", "19910830", "19910902", "19910903", "19910904", "19910905", "19910906", "19910909", "19910910", "19910911", "19910912", "19910913", "19910916", "19910917", "19910918", "19910919", "19910920", "19910923", "19910924", "19910925", "19910926", "19910927", "19910930", "19911003", "19911004", "19911007", "19911008", "19911009", "19911010", "19911011", "19911014", "19911015", "19911016", "19911017", "19911018", "19911021", "19911022", "19911023", "19911024", "19911025", "19911028", "19911029", "19911030", "19911031", "19911101", "19911104", "19911105", "19911106", "19911107", "19911108", "19911111", "19911112", "19911113", "19911114", "19911115", "19911118", "19911119", "19911120", "19911121", "19911122", "19911125", "19911126", "19911127", "19911128", "19911129", "19911202", "19911203", "19911204", "19911205", "19911206", "19911209", "19911210", "19911211", "19911212", "19911213", "19911216", "19911217", "19911218", "19911219", "19911220", "19911223", "19911224", "19911225", "19911226", "19911227", "19911230", "19911231", "19920102", "19920103", "19920106", "19920107", "19920108", "19920109", "19920110", "19920113", "19920114", "19920115", "19920116", "19920117", "19920120", "19920121", "19920122", "19920123", "19920124", "19920127", "19920128", "19920129", "19920130", "19920131", "19920203", "19920207", "19920210", "19920211", "19920212", "19920213", "19920214", "19920217", "19920218", "19920219", "19920220", "19920221", "19920224", "19920225", "19920226", "19920227", "19920228", "19920302", "19920303", "19920304", "19920305", "19920306", "19920309", "19920310", "19920311", "19920312", "19920313", "19920316", "19920317", "19920318", "19920319", "19920320", "19920323", "19920324", "19920325", "19920326", "19920327", "19920330", "19920331", "19920401", "19920402", "19920403", "19920406", "19920407", "19920408", "19920409", "19920410", "19920413", "19920414", "19920415", "19920416", "19920417", "19920420", "19920421", "19920422", "19920423", "19920424", "19920427", "19920428", "19920429", "19920430", "19920504", "19920505", "19920506", "19920507", "19920508", "19920511", "19920512", "19920513", "19920514", "19920515", "19920518", "19920519", "19920520", "19920521", "19920522", "19920525", "19920526", "19920527", "19920528", "19920529", "19920601", "19920602", "19920603", "19920604", "19920605", "19920608", "19920609", "19920610", "19920611", "19920612", "19920615", "19920616", "19920617", "19920618", "19920619", "19920622", "19920623", "19920624", "19920625", "19920626", "19920629", "19920630", "19920701", "19920702", "19920703", "19920706", "19920707", "19920708", "19920709", "19920710", "19920713", "19920714", "19920715", "19920716", "19920717", "19920720", "19920721", "19920722", "19920723", "19920724", "19920727", "19920728", "19920729", "19920730", "19920731", "19920803", "19920804", "19920805", "19920806", "19920807", "19920810", "19920811", "19920812", "19920813", "19920814", "19920817", "19920818", "19920819", "19920820", "19920821", "19920824", "19920825", "19920826", "19920827", "19920828", "19920831", "19920901", "19920902", "19920903", "19920904", "19920907", "19920908", "19920909", "19920910", "19920911", "19920914", "19920915", "19920916", "19920917", "19920918", "19920921", "19920922", "19920923", "19920924", "19920925", "19920928", "19920929", "19920930", "19921005", "19921006", "19921007", "19921008", "19921009", "19921012", "19921013", "19921014", "19921015", "19921016", "19921019", "19921020", "19921021", "19921022", "19921023", "19921026", "19921027", "19921028", "19921029", "19921030", "19921102", "19921103", "19921104", "19921105", "19921106", "19921109", "19921110", "19921111", "19921112", "19921113", "19921116", "19921117", "19921118", "19921119", "19921120", "19921123", "19921124", "19921125", "19921126", "19921127", "19921130", "19921201", "19921202", "19921203", "19921204", "19921207", "19921208", "19921209", "19921210", "19921211", "19921214", "19921215", "19921216", "19921217", "19921218", "19921221", "19921222", "19921223", "19921224", "19921225", "19921228", "19921229", "19921230", "19921231", "19930104", "19930105", "19930106", "19930107", "19930108", "19930111", "19930112", "19930113", "19930114", "19930115", "19930118", "19930119", "19930120", "19930121", "19930122", "19930127", "19930128", "19930129", "19930201", "19930202", "19930203", "19930204", "19930205", "19930208", "19930209", "19930210", "19930211", "19930212", "19930215", "19930216", "19930217", "19930218", "19930219", "19930222", "19930223", "19930224", "19930225", "19930226", "19930301", "19930302", "19930303", "19930304", "19930305", "19930308", "19930309", "19930310", "19930311", "19930312", "19930315", "19930316", "19930317", "19930318", "19930319", "19930322", "19930323", "19930324", "19930325", "19930326", "19930329", "19930330", "19930331", "19930401", "19930402", "19930405", "19930406", "19930407", "19930408", "19930409", "19930412", "19930413", "19930414", "19930415", "19930416", "19930419", "19930420", "19930421", "19930422", "19930423", "19930426", "19930427", "19930428", "19930429", "19930430", "19930503", "19930504", "19930505", "19930506", "19930507", "19930510", "19930511", "19930512", "19930513", "19930514", "19930517", "19930518", "19930519", "19930520", "19930521", "19930524", "19930525", "19930526", "19930527", "19930528", "19930531", "19930601", "19930602", "19930603", "19930604", "19930607", "19930608", "19930609", "19930610", "19930611", "19930614", "19930615", "19930616", "19930617", "19930618", "19930621", "19930622", "19930623", "19930624", "19930625", "19930628", "19930629", "19930630", "19930701", "19930702", "19930705", "19930706", "19930707", "19930708", "19930709", "19930712", "19930713", "19930714", "19930715", "19930716", "19930719", "19930720", "19930721", "19930722", "19930723", "19930726", "19930727", "19930728", "19930729", "19930730", "19930802", "19930803", "19930804", "19930805", "19930806", "19930809", "19930810", "19930811", "19930812", "19930813", "19930816", "19930817", "19930818", "19930819", "19930820", "19930823", "19930824", "19930825", "19930826", "19930827", "19930830", "19930831", "19930901", "19930902", "19930903", "19930906", "19930907", "19930908", "19930909", "19930910", "19930913", "19930914", "19930915", "19930916", "19930917", "19930920", "19930921", "19930922", "19930923", "19930924", "19930927", "19930928", "19930929", "19930930", "19931004", "19931005", "19931006", "19931007", "19931008", "19931011", "19931012", "19931013", "19931014", "19931015", "19931018", "19931019", "19931020", "19931021", "19931022", "19931025", "19931026", "19931027", "19931028", "19931029", "19931101", "19931102", "19931103", "19931104", "19931105", "19931108", "19931109", "19931110", "19931111", "19931112", "19931115", "19931116", "19931117", "19931118", "19931119", "19931122", "19931123", "19931124", "19931125", "19931126", "19931129", "19931130", "19931201", "19931202", "19931203", "19931206", "19931207", "19931208", "19931209", "19931210", "19931213", "19931214", "19931215", "19931216", "19931217", "19931220", "19931221", "19931222", "19931223", "19931224", "19931227", "19931228", "19931229", "19931230", "19931231", "19940103", "19940104", "19940105", "19940106", "19940107", "19940110", "19940111", "19940112", "19940113", "19940114", "19940117", "19940118", "19940119", "19940120", "19940121", "19940124", "19940125", "19940126", "19940127", "19940128", "19940131", "19940201", "19940202", "19940203", "19940204", "19940214", "19940215", "19940216", "19940217", "19940218", "19940221", "19940222", "19940223", "19940224", "19940225", "19940228", "19940301", "19940302", "19940303", "19940304", "19940307", "19940308", "19940309", "19940310", "19940311", "19940314", "19940315", "19940316", "19940317", "19940318", "19940321", "19940322", "19940323", "19940324", "19940325", "19940328", "19940329", "19940330", "19940331", "19940401", "19940404", "19940405", "19940406", "19940407", "19940408", "19940411", "19940412", "19940413", "19940414", "19940415", "19940418", "19940419", "19940420", "19940421", "19940422", "19940425", "19940426", "19940427", "19940428", "19940429", "19940503", "19940504", "19940505", "19940506", "19940509", "19940510", "19940511", "19940512", "19940513", "19940516", "19940517", "19940518", "19940519", "19940520", "19940523", "19940524", "19940525", "19940526", "19940527", "19940530", "19940531", "19940601", "19940602", "19940603", "19940606", "19940607", "19940608", "19940609", "19940610", "19940613", "19940614", "19940615", "19940616", "19940617", "19940620", "19940621", "19940622", "19940623", "19940624", "19940627", "19940628", "19940629", "19940630", "19940701", "19940704", "19940705", "19940706", "19940707", "19940708", "19940711", "19940712", "19940713", "19940714", "19940715", "19940718", "19940719", "19940720", "19940721", "19940722", "19940725", "19940726", "19940727", "19940728", "19940729", "19940801", "19940802", "19940803", "19940804", "19940805", "19940808", "19940809", "19940810", "19940811", "19940812", "19940815", "19940816", "19940817", "19940818", "19940819", "19940822", "19940823", "19940824", "19940825", "19940826", "19940829", "19940830", "19940831", "19940901", "19940902", "19940905", "19940906", "19940907", "19940908", "19940909", "19940912", "19940913", "19940914", "19940915", "19940916", "19940919", "19940920", "19940921", "19940922", "19940923", "19940926", "19940927", "19940928", "19940929", "19940930", "19941005", "19941006", "19941007", "19941010", "19941011", "19941012", "19941013", "19941014", "19941017", "19941018", "19941019", "19941020", "19941021", "19941024", "19941025", "19941026", "19941027", "19941028", "19941031", "19941101", "19941102", "19941103", "19941104", "19941107", "19941108", "19941109", "19941110", "19941111", "19941114", "19941115", "19941116", "19941117", "19941118", "19941121", "19941122", "19941123", "19941124", "19941125", "19941128", "19941129", "19941130", "19941201", "19941202", "19941205", "19941206", "19941207", "19941208", "19941209", "19941212", "19941213", "19941214", "19941215", "19941216", "19941219", "19941220", "19941221", "19941222", "19941223", "19941226", "19941227", "19941228", "19941229", "19941230", "19950103", "19950104", "19950105", "19950106", "19950109", "19950110", "19950111", "19950112", "19950113", "19950116", "19950117", "19950118", "19950119", "19950120", "19950123", "19950124", "19950125", "19950126", "19950127", "19950206", "19950207", "19950208", "19950209", "19950210", "19950213", "19950214", "19950215", "19950216", "19950217", "19950220", "19950221", "19950222", "19950223", "19950224", "19950227", "19950228", "19950301", "19950302", "19950303", "19950306", "19950307", "19950308", "19950309", "19950310", "19950313", "19950314", "19950315", "19950316", "19950317", "19950320", "19950321", "19950322", "19950323", "19950324", "19950327", "19950328", "19950329", "19950330", "19950331", "19950403", "19950404", "19950405", "19950406", "19950407", "19950410", "19950411", "19950412", "19950413", "19950414", "19950417", "19950418", "19950419", "19950420", "19950421", "19950424", "19950425", "19950426", "19950427", "19950428", "19950502", "19950503", "19950504", "19950505", "19950508", "19950509", "19950510", "19950511", "19950512", "19950515", "19950516", "19950517", "19950518", "19950519", "19950522", "19950523", "19950524", "19950525", "19950526", "19950529", "19950530", "19950531", "19950601", "19950602", "19950605", "19950606", "19950607", "19950608", "19950609", "19950612", "19950613", "19950614", "19950615", "19950616", "19950619", "19950620", "19950621", "19950622", "19950623", "19950626", "19950627", "19950628", "19950629", "19950630", "19950703", "19950704", "19950705", "19950706", "19950707", "19950710", "19950711", "19950712", "19950713", "19950714", "19950717", "19950718", "19950719", "19950720", "19950721", "19950724", "19950725", "19950726", "19950727", "19950728", "19950731", "19950801", "19950802", "19950803", "19950804", "19950807", "19950808", "19950809", "19950810", "19950811", "19950814", "19950815", "19950816", "19950817", "19950818", "19950821", "19950822", "19950823", "19950824", "19950825", "19950828", "19950829", "19950830", "19950831", "19950901", "19950904", "19950905", "19950906", "19950907", "19950908", "19950911", "19950912", "19950913", "19950914", "19950915", "19950918", "19950919", "19950920", "19950921", "19950922", "19950925", "19950926", "19950927", "19950928", "19950929", "19951004", "19951005", "19951006", "19951009", "19951010", "19951011", "19951012", "19951013", "19951016", "19951017", "19951018", "19951019", "19951020", "19951023", "19951024", "19951025", "19951026", "19951027", "19951030", "19951031", "19951101", "19951102", "19951103", "19951106", "19951107", "19951108", "19951109", "19951110", "19951113", "19951114", "19951115", "19951116", "19951117", "19951120", "19951121", "19951122", "19951123", "19951124", "19951127", "19951128", "19951129", "19951130", "19951201", "19951204", "19951205", "19951206", "19951207", "19951208", "19951211", "19951212", "19951213", "19951214", "19951215", "19951218", "19951219", "19951220", "19951221", "19951222", "19951225", "19951226", "19951227", "19951228", "19951229", "19960102", "19960103", "19960104", "19960105", "19960108", "19960109", "19960110", "19960111", "19960112", "19960115", "19960116", "19960117", "19960118", "19960119", "19960122", "19960123", "19960124", "19960125", "19960126", "19960129", "19960130", "19960131", "19960201", "19960202", "19960205", "19960206", "19960207", "19960208", "19960209", "19960212", "19960213", "19960214", "19960215", "19960216", "19960304", "19960305", "19960306", "19960307", "19960308", "19960311", "19960312", "19960313", "19960314", "19960315", "19960318", "19960319", "19960320", "19960321", "19960322", "19960325", "19960326", "19960327", "19960328", "19960329", "19960401", "19960402", "19960403", "19960404", "19960405", "19960408", "19960409", "19960410", "19960411", "19960412", "19960415", "19960416", "19960417", "19960418", "19960419", "19960422", "19960423", "19960424", "19960425", "19960426", "19960429", "19960430", "19960502", "19960503", "19960506", "19960507", "19960508", "19960509", "19960510", "19960513", "19960514", "19960515", "19960516", "19960517", "19960520", "19960521", "19960522", "19960523", "19960524", "19960527", "19960528", "19960529", "19960530", "19960531", "19960603", "19960604", "19960605", "19960606", "19960607", "19960610", "19960611", "19960612", "19960613", "19960614", "19960617", "19960618", "19960619", "19960620", "19960621", "19960624", "19960625", "19960626", "19960627", "19960628", "19960701", "19960702", "19960703", "19960704", "19960705", "19960708", "19960709", "19960710", "19960711", "19960712", "19960715", "19960716", "19960717", "19960718", "19960719", "19960722", "19960723", "19960724", "19960725", "19960726", "19960729", "19960730", "19960731", "19960801", "19960802", "19960805", "19960806", "19960807", "19960808", "19960809", "19960812", "19960813", "19960814", "19960815", "19960816", "19960819", "19960820", "19960821", "19960822", "19960823", "19960826", "19960827", "19960828", "19960829", "19960830", "19960902", "19960903", "19960904", "19960905", "19960906", "19960909", "19960910", "19960911", "19960912", "19960913", "19960916", "19960917", "19960918", "19960919", "19960920", "19960923", "19960924", "19960925", "19960926", "19960927", "19961003", "19961004", "19961007", "19961008", "19961009", "19961010", "19961011", "19961014", "19961015", "19961016", "19961017", "19961018", "19961021", "19961022", "19961023", "19961024", "19961025", "19961028", "19961029", "19961030", "19961031", "19961101", "19961104", "19961105", "19961106", "19961107", "19961108", "19961111", "19961112", "19961113", "19961114", "19961115", "19961118", "19961119", "19961120", "19961121", "19961122", "19961125", "19961126", "19961127", "19961128", "19961129", "19961202", "19961203", "19961204", "19961205", "19961206", "19961209", "19961210", "19961211", "19961212", "19961213", "19961216", "19961217", "19961218", "19961219", "19961220", "19961223", "19961224", "19961225", "19961226", "19961227", "19961230", "19961231", "19970102", "19970103", "19970106", "19970107", "19970108", "19970109", "19970110", "19970113", "19970114", "19970115", "19970116", "19970117", "19970120", "19970121", "19970122", "19970123", "19970124", "19970127", "19970128", "19970129", "19970130", "19970131", "19970217", "19970218", "19970219", "19970220", "19970221", "19970224", "19970225", "19970226", "19970227", "19970228", "19970303", "19970304", "19970305", "19970306", "19970307", "19970310", "19970311", "19970312", "19970313", "19970314", "19970317", "19970318", "19970319", "19970320", "19970321", "19970324", "19970325", "19970326", "19970327", "19970328", "19970331", "19970401", "19970402", "19970403", "19970404", "19970407", "19970408", "19970409", "19970410", "19970411", "19970414", "19970415", "19970416", "19970417", "19970418", "19970421", "19970422", "19970423", "19970424", "19970425", "19970428", "19970429", "19970430", "19970505", "19970506", "19970507", "19970508", "19970509", "19970512", "19970513", "19970514", "19970515", "19970516", "19970519", "19970520", "19970521", "19970522", "19970523", "19970526", "19970527", "19970528", "19970529", "19970530", "19970602", "19970603", "19970604", "19970605", "19970606", "19970609", "19970610", "19970611", "19970612", "19970613", "19970616", "19970617", "19970618", "19970619", "19970620", "19970623", "19970624", "19970625", "19970626", "19970627", "19970702", "19970703", "19970704", "19970707", "19970708", "19970709", "19970710", "19970711", "19970714", "19970715", "19970716", "19970717", "19970718", "19970721", "19970722", "19970723", "19970724", "19970725", "19970728", "19970729", "19970730", "19970731", "19970801", "19970804", "19970805", "19970806", "19970807", "19970808", "19970811", "19970812", "19970813", "19970814", "19970815", "19970818", "19970819", "19970820", "19970821", "19970822", "19970825", "19970826", "19970827", "19970828", "19970829", "19970901", "19970902", "19970903", "19970904", "19970905", "19970908", "19970909", "19970910", "19970911", "19970912", "19970915", "19970916", "19970917", "19970918", "19970919", "19970922", "19970923", "19970924", "19970925", "19970926", "19970929", "19970930", "19971006", "19971007", "19971008", "19971009", "19971010", "19971013", "19971014", "19971015", "19971016", "19971017", "19971020", "19971021", "19971022", "19971023", "19971024", "19971027", "19971028", "19971029", "19971030", "19971031", "19971103", "19971104", "19971105", "19971106", "19971107", "19971110", "19971111", "19971112", "19971113", "19971114", "19971117", "19971118", "19971119", "19971120", "19971121", "19971124", "19971125", "19971126", "19971127", "19971128", "19971201", "19971202", "19971203", "19971204", "19971205", "19971208", "19971209", "19971210", "19971211", "19971212", "19971215", "19971216", "19971217", "19971218", "19971219", "19971222", "19971223", "19971224", "19971225", "19971226", "19971229", "19971230", "19971231", "19980105", "19980106", "19980107", "19980108", "19980109", "19980112", "19980113", "19980114", "19980115", "19980116", "19980119", "19980120", "19980121", "19980122", "19980123", "19980209", "19980210", "19980211", "19980212", "19980213", "19980216", "19980217", "19980218", "19980219", "19980220", "19980223", "19980224", "19980225", "19980226", "19980227", "19980302", "19980303", "19980304", "19980305", "19980306", "19980309", "19980310", "19980311", "19980312", "19980313", "19980316", "19980317", "19980318", "19980319", "19980320", "19980323", "19980324", "19980325", "19980326", "19980327", "19980330", "19980331", "19980401", "19980402", "19980403", "19980406", "19980407", "19980408", "19980409", "19980410", "19980413", "19980414", "19980415", "19980416", "19980417", "19980420", "19980421", "19980422", "19980423", "19980424", "19980427", "19980428", "19980429", "19980430", "19980504", "19980505", "19980506", "19980507", "19980508", "19980511", "19980512", "19980513", "19980514", "19980515", "19980518", "19980519", "19980520", "19980521", "19980522", "19980525", "19980526", "19980527", "19980528", "19980529", "19980601", "19980602", "19980603", "19980604", "19980605", "19980608", "19980609", "19980610", "19980611", "19980612", "19980615", "19980616", "19980617", "19980618", "19980619", "19980622", "19980623", "19980624", "19980625", "19980626", "19980629", "19980630", "19980701", "19980702", "19980703", "19980706", "19980707", "19980708", "19980709", "19980710", "19980713", "19980714", "19980715", "19980716", "19980717", "19980720", "19980721", "19980722", "19980723", "19980724", "19980727", "19980728", "19980729", "19980730", "19980731", "19980803", "19980804", "19980805", "19980806", "19980807", "19980810", "19980811", "19980812", "19980813", "19980814", "19980817", "19980818", "19980819", "19980820", "19980821", "19980824", "19980825", "19980826", "19980827", "19980828", "19980831", "19980901", "19980902", "19980903", "19980904", "19980907", "19980908", "19980909", "19980910", "19980911", "19980914", "19980915", "19980916", "19980917", "19980918", "19980921", "19980922", "19980923", "19980924", "19980925", "19980928", "19980929", "19980930", "19981005", "19981006", "19981007", "19981008", "19981009", "19981012", "19981013", "19981014", "19981015", "19981016", "19981019", "19981020", "19981021", "19981022", "19981023", "19981026", "19981027", "19981028", "19981029", "19981030", "19981102", "19981103", "19981104", "19981105", "19981106", "19981109", "19981110", "19981111", "19981112", "19981113", "19981116", "19981117", "19981118", "19981119", "19981120", "19981123", "19981124", "19981125", "19981126", "19981127", "19981130", "19981201", "19981202", "19981203", "19981204", "19981207", "19981208", "19981209", "19981210", "19981211", "19981214", "19981215", "19981216", "19981217", "19981218", "19981221", "19981222", "19981223", "19981224", "19981225", "19981228", "19981229", "19981230", "19981231", "19990104", "19990105", "19990106", "19990107", "19990108", "19990111", "19990112", "19990113", "19990114", "19990115", "19990118", "19990119", "19990120", "19990121", "19990122", "19990125", "19990126", "19990127", "19990128", "19990129", "19990201", "19990202", "19990203", "19990204", "19990205", "19990208", "19990209", "19990301", "19990302", "19990303", "19990304", "19990305", "19990308", "19990309", "19990310", "19990311", "19990312", "19990315", "19990316", "19990317", "19990318", "19990319", "19990322", "19990323", "19990324", "19990325", "19990326", "19990329", "19990330", "19990331", "19990401", "19990402", "19990405", "19990406", "19990407", "19990408", "19990409", "19990412", "19990413", "19990414", "19990415", "19990416", "19990419", "19990420", "19990421", "19990422", "19990423", "19990426", "19990427", "19990428", "19990429", "19990430", "19990504", "19990505", "19990506", "19990507", "19990510", "19990511", "19990512", "19990513", "19990514", "19990517", "19990518", "19990519", "19990520", "19990521", "19990524", "19990525", "19990526", "19990527", "19990528", "19990531", "19990601", "19990602", "19990603", "19990604", "19990607", "19990608", "19990609", "19990610", "19990611", "19990614", "19990615", "19990616", "19990617", "19990618", "19990621", "19990622", "19990623", "19990624", "19990625", "19990628", "19990629", "19990630", "19990701", "19990702", "19990705", "19990706", "19990707", "19990708", "19990709", "19990712", "19990713", "19990714", "19990715", "19990716", "19990719", "19990720", "19990721", "19990722", "19990723", "19990726", "19990727", "19990728", "19990729", "19990730", "19990802", "19990803", "19990804", "19990805", "19990806", "19990809", "19990810", "19990811", "19990812", "19990813", "19990816", "19990817", "19990818", "19990819", "19990820", "19990823", "19990824", "19990825", "19990826", "19990827", "19990830", "19990831", "19990901", "19990902", "19990903", "19990906", "19990907", "19990908", "19990909", "19990910", "19990913", "19990914", "19990915", "19990916", "19990917", "19990920", "19990921", "19990922", "19990923", "19990924", "19990927", "19990928", "19990929", "19990930", "19991008", "19991011", "19991012", "19991013", "19991014", "19991015", "19991018", "19991019", "19991020", "19991021", "19991022", "19991025", "19991026", "19991027", "19991028", "19991029", "19991101", "19991102", "19991103", "19991104", "19991105", "19991108", "19991109", "19991110", "19991111", "19991112", "19991115", "19991116", "19991117", "19991118", "19991119", "19991122", "19991123", "19991124", "19991125", "19991126", "19991129", "19991130", "19991201", "19991202", "19991203", "19991206", "19991207", "19991208", "19991209", "19991210", "19991213", "19991214", "19991215", "19991216", "19991217", "19991221", "19991222", "19991223", "19991224", "19991227", "19991228", "19991229", "19991230", "20000104", "20000105", "20000106", "20000107", "20000110", "20000111", "20000112", "20000113", "20000114", "20000117", "20000118", "20000119", "20000120", "20000121", "20000124", "20000125", "20000126", "20000127", "20000128", "20000214", "20000215", "20000216", "20000217", "20000218", "20000221", "20000222", "20000223", "20000224", "20000225", "20000228", "20000229", "20000301", "20000302", "20000303", "20000306", "20000307", "20000308", "20000309", "20000310", "20000313", "20000314", "20000315", "20000316", "20000317", "20000320", "20000321", "20000322", "20000323", "20000324", "20000327", "20000328", "20000329", "20000330", "20000331", "20000403", "20000404", "20000405", "20000406", "20000407", "20000410", "20000411", "20000412", "20000413", "20000414", "20000417", "20000418", "20000419", "20000420", "20000421", "20000424", "20000425", "20000426", "20000427", "20000428", "20000508", "20000509", "20000510", "20000511", "20000512", "20000515", "20000516", "20000517", "20000518", "20000519", "20000522", "20000523", "20000524", "20000525", "20000526", "20000529", "20000530", "20000531", "20000601", "20000602", "20000605", "20000606", "20000607", "20000608", "20000609", "20000612", "20000613", "20000614", "20000615", "20000616", "20000619", "20000620", "20000621", "20000622", "20000623", "20000626", "20000627", "20000628", "20000629", "20000630", "20000703", "20000704", "20000705", "20000706", "20000707", "20000710", "20000711", "20000712", "20000713", "20000714", "20000717", "20000718", "20000719", "20000720", "20000721", "20000724", "20000725", "20000726", "20000727", "20000728", "20000731", "20000801", "20000802", "20000803", "20000804", "20000807", "20000808", "20000809", "20000810", "20000811", "20000814", "20000815", "20000816", "20000817", "20000818", "20000821", "20000822", "20000823", "20000824", "20000825", "20000828", "20000829", "20000830", "20000831", "20000901", "20000904", "20000905", "20000906", "20000907", "20000908", "20000911", "20000912", "20000913", "20000914", "20000915", "20000918", "20000919", "20000920", "20000921", "20000922", "20000925", "20000926", "20000927", "20000928", "20000929", "20001009", "20001010", "20001011", "20001012", "20001013", "20001016", "20001017", "20001018", "20001019", "20001020", "20001023", "20001024", "20001025", "20001026", "20001027", "20001030", "20001031", "20001101", "20001102", "20001103", "20001106", "20001107", "20001108", "20001109", "20001110", "20001113", "20001114", "20001115", "20001116", "20001117", "20001120", "20001121", "20001122", "20001123", "20001124", "20001127", "20001128", "20001129", "20001130", "20001201", "20001204", "20001205", "20001206", "20001207", "20001208", "20001211", "20001212", "20001213", "20001214", "20001215", "20001218", "20001219", "20001220", "20001221", "20001222", "20001225", "20001226", "20001227", "20001228", "20001229", "20010102", "20010103", "20010104", "20010105", "20010108", "20010109", "20010110", "20010111", "20010112", "20010115", "20010116", "20010117", "20010118", "20010119", "20010205", "20010206", "20010207", "20010208", "20010209", "20010212", "20010213", "20010214", "20010215", "20010216", "20010219", "20010220", "20010221", "20010222", "20010223", "20010226", "20010227", "20010228", "20010301", "20010302", "20010305", "20010306", "20010307", "20010308", "20010309", "20010312", "20010313", "20010314", "20010315", "20010316", "20010319", "20010320", "20010321", "20010322", "20010323", "20010326", "20010327", "20010328", "20010329", "20010330", "20010402", "20010403", "20010404", "20010405", "20010406", "20010409", "20010410", "20010411", "20010412", "20010413", "20010416", "20010417", "20010418", "20010419", "20010420", "20010423", "20010424", "20010425", "20010426", "20010427", "20010430", "20010508", "20010509", "20010510", "20010511", "20010514", "20010515", "20010516", "20010517", "20010518", "20010521", "20010522", "20010523", "20010524", "20010525", "20010528", "20010529", "20010530", "20010531", "20010601", "20010604", "20010605", "20010606", "20010607", "20010608", "20010611", "20010612", "20010613", "20010614", "20010615", "20010618", "20010619", "20010620", "20010621", "20010622", "20010625", "20010626", "20010627", "20010628", "20010629", "20010702", "20010703", "20010704", "20010705", "20010706", "20010709", "20010710", "20010711", "20010712", "20010713", "20010716", "20010717", "20010718", "20010719", "20010720", "20010723", "20010724", "20010725", "20010726", "20010727", "20010730", "20010731", "20010801", "20010802", "20010803", "20010806", "20010807", "20010808", "20010809", "20010810", "20010813", "20010814", "20010815", "20010816", "20010817", "20010820", "20010821", "20010822", "20010823", "20010824", "20010827", "20010828", "20010829", "20010830", "20010831", "20010903", "20010904", "20010905", "20010906", "20010907", "20010910", "20010911", "20010912", "20010913", "20010914", "20010917", "20010918", "20010919", "20010920", "20010921", "20010924", "20010925", "20010926", "20010927", "20010928", "20011008", "20011009", "20011010", "20011011", "20011012", "20011015", "20011016", "20011017", "20011018", "20011019", "20011022", "20011023", "20011024", "20011025", "20011026", "20011029", "20011030", "20011031", "20011101", "20011102", "20011105", "20011106", "20011107", "20011108", "20011109", "20011112", "20011113", "20011114", "20011115", "20011116", "20011119", "20011120", "20011121", "20011122", "20011123", "20011126", "20011127", "20011128", "20011129", "20011130", "20011203", "20011204", "20011205", "20011206", "20011207", "20011210", "20011211", "20011212", "20011213", "20011214", "20011217", "20011218", "20011219", "20011220", "20011221", "20011224", "20011225", "20011226", "20011227", "20011228", "20011231", "20020104", "20020107", "20020108", "20020109", "20020110", "20020111", "20020114", "20020115", "20020116", "20020117", "20020118", "20020121", "20020122", "20020123", "20020124", "20020125", "20020128", "20020129", "20020130", "20020131", "20020201", "20020204", "20020205", "20020206", "20020207", "20020208", "20020225", "20020226", "20020227", "20020228", "20020301", "20020304", "20020305", "20020306", "20020307", "20020308", "20020311", "20020312", "20020313", "20020314", "20020315", "20020318", "20020319", "20020320", "20020321", "20020322", "20020325", "20020326", "20020327", "20020328", "20020329", "20020401", "20020402", "20020403", "20020404", "20020405", "20020408", "20020409", "20020410", "20020411", "20020412", "20020415", "20020416", "20020417", "20020418", "20020419", "20020422", "20020423", "20020424", "20020425", "20020426", "20020429", "20020430", "20020508", "20020509", "20020510", "20020513", "20020514", "20020515", "20020516", "20020517", "20020520", "20020521", "20020522", "20020523", "20020524", "20020527", "20020528", "20020529", "20020530", "20020531", "20020603", "20020604", "20020605", "20020606", "20020607", "20020610", "20020611", "20020612", "20020613", "20020614", "20020617", "20020618", "20020619", "20020620", "20020621", "20020624", "20020625", "20020626", "20020627", "20020628", "20020701", "20020702", "20020703", "20020704", "20020705", "20020708", "20020709", "20020710", "20020711", "20020712", "20020715", "20020716", "20020717", "20020718", "20020719", "20020722", "20020723", "20020724", "20020725", "20020726", "20020729", "20020730", "20020731", "20020801", "20020802", "20020805", "20020806", "20020807", "20020808", "20020809", "20020812", "20020813", "20020814", "20020815", "20020816", "20020819", "20020820", "20020821", "20020822", "20020823", "20020826", "20020827", "20020828", "20020829", "20020830", "20020902", "20020903", "20020904", "20020905", "20020906", "20020909", "20020910", "20020911", "20020912", "20020913", "20020916", "20020917", "20020918", "20020919", "20020920", "20020923", "20020924", "20020925", "20020926", "20020927", "20021008", "20021009", "20021010", "20021011", "20021014", "20021015", "20021016", "20021017", "20021018", "20021021", "20021022", "20021023", "20021024", "20021025", "20021028", "20021029", "20021030", "20021031", "20021101", "20021104", "20021105", "20021106", "20021107", "20021108", "20021111", "20021112", "20021113", "20021114", "20021115", "20021118", "20021119", "20021120", "20021121", "20021122", "20021125", "20021126", "20021127", "20021128", "20021129", "20021202", "20021203", "20021204", "20021205", "20021206", "20021209", "20021210", "20021211", "20021212", "20021213", "20021216", "20021217", "20021218", "20021219", "20021220", "20021223", "20021224", "20021225", "20021226", "20021227", "20021230", "20021231", "20030102", "20030103", "20030106", "20030107", "20030108", "20030109", "20030110", "20030113", "20030114", "20030115", "20030116", "20030117", "20030120", "20030121", "20030122", "20030123", "20030124", "20030127", "20030128", "20030129", "20030210", "20030211", "20030212", "20030213", "20030214", "20030217", "20030218", "20030219", "20030220", "20030221", "20030224", "20030225", "20030226", "20030227", "20030228", "20030303", "20030304", "20030305", "20030306", "20030307", "20030310", "20030311", "20030312", "20030313", "20030314", "20030317", "20030318", "20030319", "20030320", "20030321", "20030324", "20030325", "20030326", "20030327", "20030328", "20030331", "20030401", "20030402", "20030403", "20030404", "20030407", "20030408", "20030409", "20030410", "20030411", "20030414", "20030415", "20030416", "20030417", "20030418", "20030421", "20030422", "20030423", "20030424", "20030425", "20030428", "20030429", "20030430", "20030512", "20030513", "20030514", "20030515", "20030516", "20030519", "20030520", "20030521", "20030522", "20030523", "20030526", "20030527", "20030528", "20030529", "20030530", "20030602", "20030603", "20030604", "20030605", "20030606", "20030609", "20030610", "20030611", "20030612", "20030613", "20030616", "20030617", "20030618", "20030619", "20030620", "20030623", "20030624", "20030625", "20030626", "20030627", "20030630", "20030701", "20030702", "20030703", "20030704", "20030707", "20030708", "20030709", "20030710", "20030711", "20030714", "20030715", "20030716", "20030717", "20030718", "20030721", "20030722", "20030723", "20030724", "20030725", "20030728", "20030729", "20030730", "20030731", "20030801", "20030804", "20030805", "20030806", "20030807", "20030808", "20030811", "20030812", "20030813", "20030814", "20030815", "20030818", "20030819", "20030820", "20030821", "20030822", "20030825", "20030826", "20030827", "20030828", "20030829", "20030901", "20030902", "20030903", "20030904", "20030905", "20030908", "20030909", "20030910", "20030911", "20030912", "20030915", "20030916", "20030917", "20030918", "20030919", "20030922", "20030923", "20030924", "20030925", "20030926", "20030929", "20030930", "20031008", "20031009", "20031010", "20031013", "20031014", "20031015", "20031016", "20031017", "20031020", "20031021", "20031022", "20031023", "20031024", "20031027", "20031028", "20031029", "20031030", "20031031", "20031103", "20031104", "20031105", "20031106", "20031107", "20031110", "20031111", "20031112", "20031113", "20031114", "20031117", "20031118", "20031119", "20031120", "20031121", "20031124", "20031125", "20031126", "20031127", "20031128", "20031201", "20031202", "20031203", "20031204", "20031205", "20031208", "20031209", "20031210", "20031211", "20031212", "20031215", "20031216", "20031217", "20031218", "20031219", "20031222", "20031223", "20031224", "20031225", "20031226", "20031229", "20031230", "20031231", "20040102", "20040105", "20040106", "20040107", "20040108", "20040109", "20040112", "20040113", "20040114", "20040115", "20040116", "20040129", "20040130", "20040202", "20040203", "20040204", "20040205", "20040206", "20040209", "20040210", "20040211", "20040212", "20040213", "20040216", "20040217", "20040218", "20040219", "20040220", "20040223", "20040224", "20040225", "20040226", "20040227", "20040301", "20040302", "20040303", "20040304", "20040305", "20040308", "20040309", "20040310", "20040311", "20040312", "20040315", "20040316", "20040317", "20040318", "20040319", "20040322", "20040323", "20040324", "20040325", "20040326", "20040329", "20040330", "20040331", "20040401", "20040402", "20040405", "20040406", "20040407", "20040408", "20040409", "20040412", "20040413", "20040414", "20040415", "20040416", "20040419", "20040420", "20040421", "20040422", "20040423", "20040426", "20040427", "20040428", "20040429", "20040430", "20040510", "20040511", "20040512", "20040513", "20040514", "20040517", "20040518", "20040519", "20040520", "20040521", "20040524", "20040525", "20040526", "20040527", "20040528", "20040531", "20040601", "20040602", "20040603", "20040604", "20040607", "20040608", "20040609", "20040610", "20040611", "20040614", "20040615", "20040616", "20040617", "20040618", "20040621", "20040622", "20040623", "20040624", "20040625", "20040628", "20040629", "20040630", "20040701", "20040702", "20040705", "20040706", "20040707", "20040708", "20040709", "20040712", "20040713", "20040714", "20040715", "20040716", "20040719", "20040720", "20040721", "20040722", "20040723", "20040726", "20040727", "20040728", "20040729", "20040730", "20040802", "20040803", "20040804", "20040805", "20040806", "20040809", "20040810", "20040811", "20040812", "20040813", "20040816", "20040817", "20040818", "20040819", "20040820", "20040823", "20040824", "20040825", "20040826", "20040827", "20040830", "20040831", "20040901", "20040902", "20040903", "20040906", "20040907", "20040908", "20040909", "20040910", "20040913", "20040914", "20040915", "20040916", "20040917", "20040920", "20040921", "20040922", "20040923", "20040924", "20040927", "20040928", "20040929", "20040930", "20041008", "20041011", "20041012", "20041013", "20041014", "20041015", "20041018", "20041019", "20041020", "20041021", "20041022", "20041025", "20041026", "20041027", "20041028", "20041029", "20041101", "20041102", "20041103", "20041104", "20041105", "20041108", "20041109", "20041110", "20041111", "20041112", "20041115", "20041116", "20041117", "20041118", "20041119", "20041122", "20041123", "20041124", "20041125", "20041126", "20041129", "20041130", "20041201", "20041202", "20041203", "20041206", "20041207", "20041208", "20041209", "20041210", "20041213", "20041214", "20041215", "20041216", "20041217", "20041220", "20041221", "20041222", "20041223", "20041224", "20041227", "20041228", "20041229", "20041230", "20041231", "20050104", "20050105", "20050106", "20050107", "20050110", "20050111", "20050112", "20050113", "20050114", "20050117", "20050118", "20050119", "20050120", "20050121", "20050124", "20050125", "20050126", "20050127", "20050128", "20050131", "20050201", "20050202", "20050203", "20050204", "20050216", "20050217", "20050218", "20050221", "20050222", "20050223", "20050224", "20050225", "20050228", "20050301", "20050302", "20050303", "20050304", "20050307", "20050308", "20050309", "20050310", "20050311", "20050314", "20050315", "20050316", "20050317", "20050318", "20050321", "20050322", "20050323", "20050324", "20050325", "20050328", "20050329", "20050330", "20050331", "20050401", "20050404", "20050405", "20050406", "20050407", "20050408", "20050411", "20050412", "20050413", "20050414", "20050415", "20050418", "20050419", "20050420", "20050421", "20050422", "20050425", "20050426", "20050427", "20050428", "20050429", "20050509", "20050510", "20050511", "20050512", "20050513", "20050516", "20050517", "20050518", "20050519", "20050520", "20050523", "20050524", "20050525", "20050526", "20050527", "20050530", "20050531", "20050601", "20050602", "20050603", "20050606", "20050607", "20050608", "20050609", "20050610", "20050613", "20050614", "20050615", "20050616", "20050617", "20050620", "20050621", "20050622", "20050623", "20050624", "20050627", "20050628", "20050629", "20050630", "20050701", "20050704", "20050705", "20050706", "20050707", "20050708", "20050711", "20050712", "20050713", "20050714", "20050715", "20050718", "20050719", "20050720", "20050721", "20050722", "20050725", "20050726", "20050727", "20050728", "20050729", "20050801", "20050802", "20050803", "20050804", "20050805", "20050808", "20050809", "20050810", "20050811", "20050812", "20050815", "20050816", "20050817", "20050818", "20050819", "20050822", "20050823", "20050824", "20050825", "20050826", "20050829", "20050830", "20050831", "20050901", "20050902", "20050905", "20050906", "20050907", "20050908", "20050909", "20050912", "20050913", "20050914", "20050915", "20050916", "20050919", "20050920", "20050921", "20050922", "20050923", "20050926", "20050927", "20050928", "20050929", "20050930", "20051010", "20051011", "20051012", "20051013", "20051014", "20051017", "20051018", "20051019", "20051020", "20051021", "20051024", "20051025", "20051026", "20051027", "20051028", "20051031", "20051101", "20051102", "20051103", "20051104", "20051107", "20051108", "20051109", "20051110", "20051111", "20051114", "20051115", "20051116", "20051117", "20051118", "20051121", "20051122", "20051123", "20051124", "20051125", "20051128", "20051129", "20051130", "20051201", "20051202", "20051205", "20051206", "20051207", "20051208", "20051209", "20051212", "20051213", "20051214", "20051215", "20051216", "20051219", "20051220", "20051221", "20051222", "20051223", "20051226", "20051227", "20051228", "20051229", "20051230", "20060104", "20060105", "20060106", "20060109", "20060110", "20060111", "20060112", "20060113", "20060116", "20060117", "20060118", "20060119", "20060120", "20060123", "20060124", "20060125", "20060206", "20060207", "20060208", "20060209", "20060210", "20060213", "20060214", "20060215", "20060216", "20060217", "20060220", "20060221", "20060222", "20060223", "20060224", "20060227", "20060228", "20060301", "20060302", "20060303", "20060306", "20060307", "20060308", "20060309", "20060310", "20060313", "20060314", "20060315", "20060316", "20060317", "20060320", "20060321", "20060322", "20060323", "20060324", "20060327", "20060328", "20060329", "20060330", "20060331", "20060403", "20060404", "20060405", "20060406", "20060407", "20060410", "20060411", "20060412", "20060413", "20060414", "20060417", "20060418", "20060419", "20060420", "20060421", "20060424", "20060425", "20060426", "20060427", "20060428", "20060508", "20060509", "20060510", "20060511", "20060512", "20060515", "20060516", "20060517", "20060518", "20060519", "20060522", "20060523", "20060524", "20060525", "20060526", "20060529", "20060530", "20060531", "20060601", "20060602", "20060605", "20060606", "20060607", "20060608", "20060609", "20060612", "20060613", "20060614", "20060615", "20060616", "20060619", "20060620", "20060621", "20060622", "20060623", "20060626", "20060627", "20060628", "20060629", "20060630", "20060703", "20060704", "20060705", "20060706", "20060707", "20060710", "20060711", "20060712", "20060713", "20060714", "20060717", "20060718", "20060719", "20060720", "20060721", "20060724", "20060725", "20060726", "20060727", "20060728", "20060731", "20060801", "20060802", "20060803", "20060804", "20060807", "20060808", "20060809", "20060810", "20060811", "20060814", "20060815", "20060816", "20060817", "20060818", "20060821", "20060822", "20060823", "20060824", "20060825", "20060828", "20060829", "20060830", "20060831", "20060901", "20060904", "20060905", "20060906", "20060907", "20060908", "20060911", "20060912", "20060913", "20060914", "20060915", "20060918", "20060919", "20060920", "20060921", "20060922", "20060925", "20060926", "20060927", "20060928", "20060929", "20061009", "20061010", "20061011", "20061012", "20061013", "20061016", "20061017", "20061018", "20061019", "20061020", "20061023", "20061024", "20061025", "20061026", "20061027", "20061030", "20061031", "20061101", "20061102", "20061103", "20061106", "20061107", "20061108", "20061109", "20061110", "20061113", "20061114", "20061115", "20061116", "20061117", "20061120", "20061121", "20061122", "20061123", "20061124", "20061127", "20061128", "20061129", "20061130", "20061201", "20061204", "20061205", "20061206", "20061207", "20061208", "20061211", "20061212", "20061213", "20061214", "20061215", "20061218", "20061219", "20061220", "20061221", "20061222", "20061225", "20061226", "20061227", "20061228", "20061229", "20070104", "20070105", "20070108", "20070109", "20070110", "20070111", "20070112", "20070115", "20070116", "20070117", "20070118", "20070119", "20070122", "20070123", "20070124", "20070125", "20070126", "20070129", "20070130", "20070131", "20070201", "20070202", "20070205", "20070206", "20070207", "20070208", "20070209", "20070212", "20070213", "20070214", "20070215", "20070216", "20070226", "20070227", "20070228", "20070301", "20070302", "20070305", "20070306", "20070307", "20070308", "20070309", "20070312", "20070313", "20070314", "20070315", "20070316", "20070319", "20070320", "20070321", "20070322", "20070323", "20070326", "20070327", "20070328", "20070329", "20070330", "20070402", "20070403", "20070404", "20070405", "20070406", "20070409", "20070410", "20070411", "20070412", "20070413", "20070416", "20070417", "20070418", "20070419", "20070420", "20070423", "20070424", "20070425", "20070426", "20070427", "20070430", "20070508", "20070509", "20070510", "20070511", "20070514", "20070515", "20070516", "20070517", "20070518", "20070521", "20070522", "20070523", "20070524", "20070525", "20070528", "20070529", "20070530", "20070531", "20070601", "20070604", "20070605", "20070606", "20070607", "20070608", "20070611", "20070612", "20070613", "20070614", "20070615", "20070618", "20070619", "20070620", "20070621", "20070622", "20070625", "20070626", "20070627", "20070628", "20070629", "20070702", "20070703", "20070704", "20070705", "20070706", "20070709", "20070710", "20070711", "20070712", "20070713", "20070716", "20070717", "20070718", "20070719", "20070720", "20070723", "20070724", "20070725", "20070726", "20070727", "20070730", "20070731", "20070801", "20070802", "20070803", "20070806", "20070807", "20070808", "20070809", "20070810", "20070813", "20070814", "20070815", "20070816", "20070817", "20070820", "20070821", "20070822", "20070823", "20070824", "20070827", "20070828", "20070829", "20070830", "20070831", "20070903", "20070904", "20070905", "20070906", "20070907", "20070910", "20070911", "20070912", "20070913", "20070914", "20070917", "20070918", "20070919", "20070920", "20070921", "20070924", "20070925", "20070926", "20070927", "20070928", "20071008", "20071009", "20071010", "20071011", "20071012", "20071015", "20071016", "20071017", "20071018", "20071019", "20071022", "20071023", "20071024", "20071025", "20071026", "20071029", "20071030", "20071031", "20071101", "20071102", "20071105", "20071106", "20071107", "20071108", "20071109", "20071112", "20071113", "20071114", "20071115", "20071116", "20071119", "20071120", "20071121", "20071122", "20071123", "20071126", "20071127", "20071128", "20071129", "20071130", "20071203", "20071204", "20071205", "20071206", "20071207", "20071210", "20071211", "20071212", "20071213", "20071214", "20071217", "20071218", "20071219", "20071220", "20071221", "20071224", "20071225", "20071226", "20071227", "20071228", "20080102", "20080103", "20080104", "20080107", "20080108", "20080109", "20080110", "20080111", "20080114", "20080115", "20080116", "20080117", "20080118", "20080121", "20080122", "20080123", "20080124", "20080125", "20080128", "20080129", "20080130", "20080131", "20080201", "20080204", "20080205", "20080213", "20080214", "20080215", "20080218", "20080219", "20080220", "20080221", "20080222", "20080225", "20080226", "20080227", "20080228", "20080229", "20080303", "20080304", "20080305", "20080306", "20080307", "20080310", "20080311", "20080312", "20080313", "20080314", "20080317", "20080318", "20080319", "20080320", "20080321", "20080324", "20080325", "20080326", "20080327", "20080328", "20080331", "20080401", "20080402", "20080403", "20080407", "20080408", "20080409", "20080410", "20080411", "20080414", "20080415", "20080416", "20080417", "20080418", "20080421", "20080422", "20080423", "20080424", "20080425", "20080428", "20080429", "20080430", "20080505", "20080506", "20080507", "20080508", "20080509", "20080512", "20080513", "20080514", "20080515", "20080516", "20080519", "20080520", "20080521", "20080522", "20080523", "20080526", "20080527", "20080528", "20080529", "20080530", "20080602", "20080603", "20080604", "20080605", "20080606", "20080610", "20080611", "20080612", "20080613", "20080616", "20080617", "20080618", "20080619", "20080620", "20080623", "20080624", "20080625", "20080626", "20080627", "20080630", "20080701", "20080702", "20080703", "20080704", "20080707", "20080708", "20080709", "20080710", "20080711", "20080714", "20080715", "20080716", "20080717", "20080718", "20080721", "20080722", "20080723", "20080724", "20080725", "20080728", "20080729", "20080730", "20080731", "20080801", "20080804", "20080805", "20080806", "20080807", "20080808", "20080811", "20080812", "20080813", "20080814", "20080815", "20080818", "20080819", "20080820", "20080821", "20080822", "20080825", "20080826", "20080827", "20080828", "20080829", "20080901", "20080902", "20080903", "20080904", "20080905", "20080908", "20080909", "20080910", "20080911", "20080912", "20080916", "20080917", "20080918", "20080919", "20080922", "20080923", "20080924", "20080925", "20080926", "20081006", "20081007", "20081008", "20081009", "20081010", "20081013", "20081014", "20081015", "20081016", "20081017", "20081020", "20081021", "20081022", "20081023", "20081024", "20081027", "20081028", "20081029", "20081030", "20081031", "20081103", "20081104", "20081105", "20081106", "20081107", "20081110", "20081111", "20081112", "20081113", "20081114", "20081117", "20081118", "20081119", "20081120", "20081121", "20081124", "20081125", "20081126", "20081127", "20081128", "20081201", "20081202", "20081203", "20081204", "20081205", "20081208", "20081209", "20081210", "20081211", "20081212", "20081215", "20081216", "20081217", "20081218", "20081219", "20081222", "20081223", "20081224", "20081225", "20081226", "20081229", "20081230", "20081231", "20090105", "20090106", "20090107", "20090108", "20090109", "20090112", "20090113", "20090114", "20090115", "20090116", "20090119", "20090120", "20090121", "20090122", "20090123", "20090202", "20090203", "20090204", "20090205", "20090206", "20090209", "20090210", "20090211", "20090212", "20090213", "20090216", "20090217", "20090218", "20090219", "20090220", "20090223", "20090224", "20090225", "20090226", "20090227", "20090302", "20090303", "20090304", "20090305", "20090306", "20090309", "20090310", "20090311", "20090312", "20090313", "20090316", "20090317", "20090318", "20090319", "20090320", "20090323", "20090324", "20090325", "20090326", "20090327", "20090330", "20090331", "20090401", "20090402", "20090403", "20090407", "20090408", "20090409", "20090410", "20090413", "20090414", "20090415", "20090416", "20090417", "20090420", "20090421", "20090422", "20090423", "20090424", "20090427", "20090428", "20090429", "20090430", "20090504", "20090505", "20090506", "20090507", "20090508", "20090511", "20090512", "20090513", "20090514", "20090515", "20090518", "20090519", "20090520", "20090521", "20090522", "20090525", "20090526", "20090527", "20090601", "20090602", "20090603", "20090604", "20090605", "20090608", "20090609", "20090610", "20090611", "20090612", "20090615", "20090616", "20090617", "20090618", "20090619", "20090622", "20090623", "20090624", "20090625", "20090626", "20090629", "20090630", "20090701", "20090702", "20090703", "20090706", "20090707", "20090708", "20090709", "20090710", "20090713", "20090714", "20090715", "20090716", "20090717", "20090720", "20090721", "20090722", "20090723", "20090724", "20090727", "20090728", "20090729", "20090730", "20090731", "20090803", "20090804", "20090805", "20090806", "20090807", "20090810", "20090811", "20090812", "20090813", "20090814", "20090817", "20090818", "20090819", "20090820", "20090821", "20090824", "20090825", "20090826", "20090827", "20090828", "20090831", "20090901", "20090902", "20090903", "20090904", "20090907", "20090908", "20090909", "20090910", "20090911", "20090914", "20090915", "20090916", "20090917", "20090918", "20090921", "20090922", "20090923", "20090924", "20090925", "20090928", "20090929", "20090930", "20091009", "20091012", "20091013", "20091014", "20091015", "20091016", "20091019", "20091020", "20091021", "20091022", "20091023", "20091026", "20091027", "20091028", "20091029", "20091030", "20091102", "20091103", "20091104", "20091105", "20091106", "20091109", "20091110", "20091111", "20091112", "20091113", "20091116", "20091117", "20091118", "20091119", "20091120", "20091123", "20091124", "20091125", "20091126", "20091127", "20091130", "20091201", "20091202", "20091203", "20091204", "20091207", "20091208", "20091209", "20091210", "20091211", "20091214", "20091215", "20091216", "20091217", "20091218", "20091221", "20091222", "20091223", "20091224", "20091225", "20091228", "20091229", "20091230", "20091231", "20100104", "20100105", "20100106", "20100107", "20100108", "20100111", "20100112", "20100113", "20100114", "20100115", "20100118", "20100119", "20100120", "20100121", "20100122", "20100125", "20100126", "20100127", "20100128", "20100129", "20100201", "20100202", "20100203", "20100204", "20100205", "20100208", "20100209", "20100210", "20100211", "20100212", "20100222", "20100223", "20100224", "20100225", "20100226", "20100301", "20100302", "20100303", "20100304", "20100305", "20100308", "20100309", "20100310", "20100311", "20100312", "20100315", "20100316", "20100317", "20100318", "20100319", "20100322", "20100323", "20100324", "20100325", "20100326", "20100329", "20100330", "20100331", "20100401", "20100402", "20100406", "20100407", "20100408", "20100409", "20100412", "20100413", "20100414", "20100415", "20100416", "20100419", "20100420", "20100421", "20100422", "20100423", "20100426", "20100427", "20100428", "20100429", "20100430", "20100504", "20100505", "20100506", "20100507", "20100510", "20100511", "20100512", "20100513", "20100514", "20100517", "20100518", "20100519", "20100520", "20100521", "20100524", "20100525", "20100526", "20100527", "20100528", "20100531", "20100601", "20100602", "20100603", "20100604", "20100607", "20100608", "20100609", "20100610", "20100611", "20100617", "20100618", "20100621", "20100622", "20100623", "20100624", "20100625", "20100628", "20100629", "20100630", "20100701", "20100702", "20100705", "20100706", "20100707", "20100708", "20100709", "20100712", "20100713", "20100714", "20100715", "20100716", "20100719", "20100720", "20100721", "20100722", "20100723", "20100726", "20100727", "20100728", "20100729", "20100730", "20100802", "20100803", "20100804", "20100805", "20100806", "20100809", "20100810", "20100811", "20100812", "20100813", "20100816", "20100817", "20100818", "20100819", "20100820", "20100823", "20100824", "20100825", "20100826", "20100827", "20100830", "20100831", "20100901", "20100902", "20100903", "20100906", "20100907", "20100908", "20100909", "20100910", "20100913", "20100914", "20100915", "20100916", "20100917", "20100920", "20100921", "20100927", "20100928", "20100929", "20100930", "20101008", "20101011", "20101012", "20101013", "20101014", "20101015", "20101018", "20101019", "20101020", "20101021", "20101022", "20101025", "20101026", "20101027", "20101028", "20101029", "20101101", "20101102", "20101103", "20101104", "20101105", "20101108", "20101109", "20101110", "20101111", "20101112", "20101115", "20101116", "20101117", "20101118", "20101119", "20101122", "20101123", "20101124", "20101125", "20101126", "20101129", "20101130", "20101201", "20101202", "20101203", "20101206", "20101207", "20101208", "20101209", "20101210", "20101213", "20101214", "20101215", "20101216", "20101217", "20101220", "20101221", "20101222", "20101223", "20101224", "20101227", "20101228", "20101229", "20101230", "20101231", "20110104", "20110105", "20110106", "20110107", "20110110", "20110111", "20110112", "20110113", "20110114", "20110117", "20110118", "20110119", "20110120", "20110121", "20110124", "20110125", "20110126", "20110127", "20110128", "20110131", "20110201", "20110209", "20110210", "20110211", "20110214", "20110215", "20110216", "20110217", "20110218", "20110221", "20110222", "20110223", "20110224", "20110225", "20110228", "20110301", "20110302", "20110303", "20110304", "20110307", "20110308", "20110309", "20110310", "20110311", "20110314", "20110315", "20110316", "20110317", "20110318", "20110321", "20110322", "20110323", "20110324", "20110325", "20110328", "20110329", "20110330", "20110331", "20110401", "20110406", "20110407", "20110408", "20110411", "20110412", "20110413", "20110414", "20110415", "20110418", "20110419", "20110420", "20110421", "20110422", "20110425", "20110426", "20110427", "20110428", "20110429", "20110503", "20110504", "20110505", "20110506", "20110509", "20110510", "20110511", "20110512", "20110513", "20110516", "20110517", "20110518", "20110519", "20110520", "20110523", "20110524", "20110525", "20110526", "20110527", "20110530", "20110531", "20110601", "20110602", "20110603", "20110607", "20110608", "20110609", "20110610", "20110613", "20110614", "20110615", "20110616", "20110617", "20110620", "20110621", "20110622", "20110623", "20110624", "20110627", "20110628", "20110629", "20110630", "20110701", "20110704", "20110705", "20110706", "20110707", "20110708", "20110711", "20110712", "20110713", "20110714", "20110715", "20110718", "20110719", "20110720", "20110721", "20110722", "20110725", "20110726", "20110727", "20110728", "20110729", "20110801", "20110802", "20110803", "20110804", "20110805", "20110808", "20110809", "20110810", "20110811", "20110812", "20110815", "20110816", "20110817", "20110818", "20110819", "20110822", "20110823", "20110824", "20110825", "20110826", "20110829", "20110830", "20110831", "20110901", "20110902", "20110905", "20110906", "20110907", "20110908", "20110909", "20110913", "20110914", "20110915", "20110916", "20110919", "20110920", "20110921", "20110922", "20110923", "20110926", "20110927", "20110928", "20110929", "20110930", "20111010", "20111011", "20111012", "20111013", "20111014", "20111017", "20111018", "20111019", "20111020", "20111021", "20111024", "20111025", "20111026", "20111027", "20111028", "20111031", "20111101", "20111102", "20111103", "20111104", "20111107", "20111108", "20111109", "20111110", "20111111", "20111114", "20111115", "20111116", "20111117", "20111118", "20111121", "20111122", "20111123", "20111124", "20111125", "20111128", "20111129", "20111130", "20111201", "20111202", "20111205", "20111206", "20111207", "20111208", "20111209", "20111212", "20111213", "20111214", "20111215", "20111216", "20111219", "20111220", "20111221", "20111222", "20111223", "20111226", "20111227", "20111228", "20111229", "20111230", "20120104", "20120105", "20120106", "20120109", "20120110", "20120111", "20120112", "20120113", "20120116", "20120117", "20120118", "20120119", "20120120", "20120130", "20120131", "20120201", "20120202", "20120203", "20120206", "20120207", "20120208", "20120209", "20120210", "20120213", "20120214", "20120215", "20120216", "20120217", "20120220", "20120221", "20120222", "20120223", "20120224", "20120227", "20120228", "20120229", "20120301", "20120302", "20120305", "20120306", "20120307", "20120308", "20120309", "20120312", "20120313", "20120314", "20120315", "20120316", "20120319", "20120320", "20120321", "20120322", "20120323", "20120326", "20120327", "20120328", "20120329", "20120330", "20120405", "20120406", "20120409", "20120410", "20120411", "20120412", "20120413", "20120416", "20120417", "20120418", "20120419", "20120420", "20120423", "20120424", "20120425", "20120426", "20120427", "20120502", "20120503", "20120504", "20120507", "20120508", "20120509", "20120510", "20120511", "20120514", "20120515", "20120516", "20120517", "20120518", "20120521", "20120522", "20120523", "20120524", "20120525", "20120528", "20120529", "20120530", "20120531", "20120601", "20120604", "20120605", "20120606", "20120607", "20120608", "20120611", "20120612", "20120613", "20120614", "20120615", "20120618", "20120619", "20120620", "20120621", "20120625", "20120626", "20120627", "20120628", "20120629", "20120702", "20120703", "20120704", "20120705", "20120706", "20120709", "20120710", "20120711", "20120712", "20120713", "20120716", "20120717", "20120718", "20120719", "20120720", "20120723", "20120724", "20120725", "20120726", "20120727", "20120730", "20120731", "20120801", "20120802", "20120803", "20120806", "20120807", "20120808", "20120809", "20120810", "20120813", "20120814", "20120815", "20120816", "20120817", "20120820", "20120821", "20120822", "20120823", "20120824", "20120827", "20120828", "20120829", "20120830", "20120831", "20120903", "20120904", "20120905", "20120906", "20120907", "20120910", "20120911", "20120912", "20120913", "20120914", "20120917", "20120918", "20120919", "20120920", "20120921", "20120924", "20120925", "20120926", "20120927", "20120928", "20121008", "20121009", "20121010", "20121011", "20121012", "20121015", "20121016", "20121017", "20121018", "20121019", "20121022", "20121023", "20121024", "20121025", "20121026", "20121029", "20121030", "20121031", "20121101", "20121102", "20121105", "20121106", "20121107", "20121108", "20121109", "20121112", "20121113", "20121114", "20121115", "20121116", "20121119", "20121120", "20121121", "20121122", "20121123", "20121126", "20121127", "20121128", "20121129", "20121130", "20121203", "20121204", "20121205", "20121206", "20121207", "20121210", "20121211", "20121212", "20121213", "20121214", "20121217", "20121218", "20121219", "20121220", "20121221", "20121224", "20121225", "20121226", "20121227", "20121228", "20121231", "20130104", "20130107", "20130108", "20130109", "20130110", "20130111", "20130114", "20130115", "20130116", "20130117", "20130118", "20130121", "20130122", "20130123", "20130124", "20130125", "20130128", "20130129", "20130130", "20130131", "20130201", "20130204", "20130205", "20130206", "20130207", "20130208", "20130218", "20130219", "20130220", "20130221", "20130222", "20130225", "20130226", "20130227", "20130228", "20130301", "20130304", "20130305", "20130306", "20130307", "20130308", "20130311", "20130312", "20130313", "20130314", "20130315", "20130318", "20130319", "20130320", "20130321", "20130322", "20130325", "20130326", "20130327", "20130328", "20130329", "20130401", "20130402", "20130403", "20130408", "20130409", "20130410", "20130411", "20130412", "20130415", "20130416", "20130417", "20130418", "20130419", "20130422", "20130423", "20130424", "20130425", "20130426", "20130502", "20130503", "20130506", "20130507", "20130508", "20130509", "20130510", "20130513", "20130514", "20130515", "20130516", "20130517", "20130520", "20130521", "20130522", "20130523", "20130524", "20130527", "20130528", "20130529", "20130530", "20130531", "20130603", "20130604", "20130605", "20130606", "20130607", "20130613", "20130614", "20130617", "20130618", "20130619", "20130620", "20130621", "20130624", "20130625", "20130626", "20130627", "20130628", "20130701", "20130702", "20130703", "20130704", "20130705", "20130708", "20130709", "20130710", "20130711", "20130712", "20130715", "20130716", "20130717", "20130718", "20130719", "20130722", "20130723", "20130724", "20130725", "20130726", "20130729", "20130730", "20130731", "20130801", "20130802", "20130805", "20130806", "20130807", "20130808", "20130809", "20130812", "20130813", "20130814", "20130815", "20130816", "20130819", "20130820", "20130821", "20130822", "20130823", "20130826", "20130827", "20130828", "20130829", "20130830", "20130902", "20130903", "20130904", "20130905", "20130906", "20130909", "20130910", "20130911", "20130912", "20130913", "20130916", "20130917", "20130918", "20130923", "20130924", "20130925", "20130926", "20130927", "20130930", "20131008", "20131009", "20131010", "20131011", "20131014", "20131015", "20131016", "20131017", "20131018", "20131021", "20131022", "20131023", "20131024", "20131025", "20131028", "20131029", "20131030", "20131031", "20131101", "20131104", "20131105", "20131106", "20131107", "20131108", "20131111", "20131112", "20131113", "20131114", "20131115", "20131118", "20131119", "20131120", "20131121", "20131122", "20131125", "20131126", "20131127", "20131128", "20131129", "20131202", "20131203", "20131204", "20131205", "20131206", "20131209", "20131210", "20131211", "20131212", "20131213", "20131216", "20131217", "20131218", "20131219", "20131220", "20131223", "20131224", "20131225", "20131226", "20131227", "20131230", "20131231", "20140102", "20140103", "20140106", "20140107", "20140108", "20140109", "20140110", "20140113", "20140114", "20140115", "20140116", "20140117", "20140120", "20140121", "20140122", "20140123", "20140124", "20140127", "20140128", "20140129", "20140130", "20140207", "20140210", "20140211", "20140212", "20140213", "20140214", "20140217", "20140218", "20140219", "20140220", "20140221", "20140224", "20140225", "20140226", "20140227", "20140228", "20140303", "20140304", "20140305", "20140306", "20140307", "20140310", "20140311", "20140312", "20140313", "20140314", "20140317", "20140318", "20140319", "20140320", "20140321", "20140324", "20140325", "20140326", "20140327", "20140328", "20140331", "20140401", "20140402", "20140403", "20140404", "20140408", "20140409", "20140410", "20140411", "20140414", "20140415", "20140416", "20140417", "20140418", "20140421", "20140422", "20140423", "20140424", "20140425", "20140428", "20140429", "20140430", "20140505", "20140506", "20140507", "20140508", "20140509", "20140512", "20140513", "20140514", "20140515", "20140516", "20140519", "20140520", "20140521", "20140522", "20140523", "20140526", "20140527", "20140528", "20140529", "20140530", "20140603", "20140604", "20140605", "20140606", "20140609", "20140610", "20140611", "20140612", "20140613", "20140616", "20140617", "20140618", "20140619", "20140620", "20140623", "20140624", "20140625", "20140626", "20140627", "20140630", "20140701", "20140702", "20140703", "20140704", "20140707", "20140708", "20140709", "20140710", "20140711", "20140714", "20140715", "20140716", "20140717", "20140718", "20140721", "20140722", "20140723", "20140724", "20140725", "20140728", "20140729", "20140730", "20140731", "20140801", "20140804", "20140805", "20140806", "20140807", "20140808", "20140811", "20140812", "20140813", "20140814", "20140815", "20140818", "20140819", "20140820", "20140821", "20140822", "20140825", "20140826", "20140827", "20140828", "20140829", "20140901", "20140902", "20140903", "20140904", "20140905", "20140909", "20140910", "20140911", "20140912", "20140915", "20140916", "20140917", "20140918", "20140919", "20140922", "20140923", "20140924", "20140925", "20140926", "20140929", "20140930", "20141008", "20141009", "20141010", "20141013", "20141014", "20141015", "20141016", "20141017", "20141020", "20141021", "20141022", "20141023", "20141024", "20141027", "20141028", "20141029", "20141030", "20141031", "20141103", "20141104", "20141105", "20141106", "20141107", "20141110", "20141111", "20141112", "20141113", "20141114", "20141117", "20141118", "20141119", "20141120", "20141121", "20141124", "20141125", "20141126", "20141127", "20141128", "20141201", "20141202", "20141203", "20141204", "20141205", "20141208", "20141209", "20141210", "20141211", "20141212", "20141215", "20141216", "20141217", "20141218", "20141219", "20141222", "20141223", "20141224", "20141225", "20141226", "20141229", "20141230", "20141231", "20150105", "20150106", "20150107", "20150108", "20150109", "20150112", "20150113", "20150114", "20150115", "20150116", "20150119", "20150120", "20150121", "20150122", "20150123", "20150126", "20150127", "20150128", "20150129", "20150130", "20150202", "20150203", "20150204", "20150205", "20150206", "20150209", "20150210", "20150211", "20150212", "20150213", "20150216", "20150217", "20150225", "20150226", "20150227", "20150302", "20150303", "20150304", "20150305", "20150306", "20150309", "20150310", "20150311", "20150312", "20150313", "20150316", "20150317", "20150318", "20150319", "20150320", "20150323", "20150324", "20150325", "20150326", "20150327", "20150330", "20150331", "20150401", "20150402", "20150403", "20150407", "20150408", "20150409", "20150410", "20150413", "20150414", "20150415", "20150416", "20150417", "20150420", "20150421", "20150422", "20150423", "20150424", "20150427", "20150428", "20150429", "20150430", "20150504", "20150505", "20150506", "20150507", "20150508", "20150511", "20150512", "20150513", "20150514", "20150515", "20150518", "20150519", "20150520", "20150521", "20150522", "20150525", "20150526", "20150527", "20150528", "20150529", "20150601", "20150602", "20150603", "20150604", "20150605", "20150608", "20150609", "20150610", "20150611", "20150612", "20150615", "20150616", "20150617", "20150618", "20150619", "20150623", "20150624", "20150625", "20150626", "20150629", "20150630", "20150701", "20150702", "20150703", "20150706", "20150707", "20150708", "20150709", "20150710", "20150713", "20150714", "20150715", "20150716", "20150717", "20150720", "20150721", "20150722", "20150723", "20150724", "20150727", "20150728", "20150729", "20150730", "20150731", "20150803", "20150804", "20150805", "20150806", "20150807", "20150810", "20150811", "20150812", "20150813", "20150814", "20150817", "20150818", "20150819", "20150820", "20150821", "20150824", "20150825", "20150826", "20150827", "20150828", "20150831", "20150901", "20150902", "20150907", "20150908", "20150909", "20150910", "20150911", "20150914", "20150915", "20150916", "20150917", "20150918", "20150921", "20150922", "20150923", "20150924", "20150925", "20150928", "20150929", "20150930", "20151008", "20151009", "20151012", "20151013", "20151014", "20151015", "20151016", "20151019", "20151020", "20151021", "20151022", "20151023", "20151026", "20151027", "20151028", "20151029", "20151030", "20151102", "20151103", "20151104", "20151105", "20151106", "20151109", "20151110", "20151111", "20151112", "20151113", "20151116", "20151117", "20151118", "20151119", "20151120", "20151123", "20151124", "20151125", "20151126", "20151127", "20151130", "20151201", "20151202", "20151203", "20151204", "20151207", "20151208", "20151209", "20151210", "20151211", "20151214", "20151215", "20151216", "20151217", "20151218", "20151221", "20151222", "20151223", "20151224", "20151225", "20151228", "20151229", "20151230", "20151231", "20160104", "20160105", "20160106", "20160107", "20160108", "20160111", "20160112", "20160113", "20160114", "20160115", "20160118", "20160119", "20160120", "20160121", "20160122", "20160125", "20160126", "20160127", "20160128", "20160129", "20160201", "20160202", "20160203", "20160204", "20160205", "20160215", "20160216", "20160217", "20160218", "20160219", "20160222", "20160223", "20160224", "20160225", "20160226", "20160229", "20160301", "20160302", "20160303", "20160304", "20160307", "20160308", "20160309", "20160310", "20160311", "20160314", "20160315", "20160316", "20160317", "20160318", "20160321", "20160322", "20160323", "20160324", "20160325", "20160328", "20160329", "20160330", "20160331", "20160401", "20160405", "20160406", "20160407", "20160408", "20160411", "20160412", "20160413", "20160414", "20160415", "20160418", "20160419", "20160420", "20160421", "20160422", "20160425", "20160426", "20160427", "20160428", "20160429", "20160503", "20160504", "20160505", "20160506", "20160509", "20160510", "20160511", "20160512", "20160513", "20160516", "20160517", "20160518", "20160519", "20160520", "20160523", "20160524", "20160525", "20160526", "20160527", "20160530", "20160531", "20160601", "20160602", "20160603", "20160606", "20160607", "20160608", "20160613", "20160614", "20160615", "20160616", "20160617", "20160620", "20160621", "20160622", "20160623", "20160624", "20160627", "20160628", "20160629", "20160630", "20160701", "20160704", "20160705", "20160706", "20160707", "20160708", "20160711", "20160712", "20160713", "20160714", "20160715", "20160718", "20160719", "20160720", "20160721", "20160722", "20160725", "20160726", "20160727", "20160728", "20160729", "20160801", "20160802", "20160803", "20160804", "20160805", "20160808", "20160809", "20160810", "20160811", "20160812", "20160815", "20160816", "20160817", "20160818", "20160819", "20160822", "20160823", "20160824", "20160825", "20160826", "20160829", "20160830", "20160831", "20160901", "20160902", "20160905", "20160906", "20160907", "20160908", "20160909", "20160912", "20160913", "20160914", "20160919", "20160920", "20160921", "20160922", "20160923", "20160926", "20160927", "20160928", "20160929", "20160930", "20161010", "20161011", "20161012", "20161013", "20161014", "20161017", "20161018", "20161019", "20161020", "20161021", "20161024", "20161025", "20161026", "20161027", "20161028", "20161031", "20161101", "20161102", "20161103", "20161104", "20161107", "20161108", "20161109", "20161110", "20161111", "20161114", "20161115", "20161116", "20161117", "20161118", "20161121", "20161122", "20161123", "20161124", "20161125", "20161128", "20161129", "20161130", "20161201", "20161202", "20161205", "20161206", "20161207", "20161208", "20161209", "20161212", "20161213", "20161214", "20161215", "20161216", "20161219", "20161220", "20161221", "20161222", "20161223", "20161226", "20161227", "20161228", "20161229", "20161230", "20170103", "20170104", "20170105", "20170106", "20170109", "20170110", "20170111", "20170112", "20170113", "20170116", "20170117", "20170118", "20170119", "20170120", "20170123", "20170124", "20170125", "20170126", "20170203", "20170206", "20170207", "20170208", "20170209", "20170210", "20170213", "20170214", "20170215", "20170216", "20170217", "20170220", "20170221", "20170222", "20170223", "20170224", "20170227", "20170228", "20170301", "20170302", "20170303", "20170306", "20170307", "20170308", "20170309", "20170310", "20170313", "20170314", "20170315", "20170316", "20170317", "20170320", "20170321", "20170322", "20170323", "20170324", "20170327", "20170328", "20170329", "20170330", "20170331", "20170405", "20170406", "20170407", "20170410", "20170411", "20170412", "20170413", "20170414", "20170417", "20170418", "20170419", "20170420", "20170421", "20170424", "20170425", "20170426", "20170427", "20170428", "20170502", "20170503", "20170504", "20170505", "20170508", "20170509", "20170510", "20170511", "20170512", "20170515", "20170516", "20170517", "20170518", "20170519", "20170522", "20170523", "20170524", "20170525", "20170526", "20170531", "20170601", "20170602", "20170605", "20170606", "20170607", "20170608", "20170609", "20170612", "20170613", "20170614", "20170615", "20170616", "20170619", "20170620", "20170621", "20170622", "20170623", "20170626", "20170627", "20170628", "20170629", "20170630", "20170703", "20170704", "20170705", "20170706", "20170707", "20170710", "20170711", "20170712", "20170713", "20170714", "20170717", "20170718", "20170719", "20170720", "20170721", "20170724", "20170725", "20170726", "20170727", "20170728", "20170731", "20170801", "20170802", "20170803", "20170804", "20170807", "20170808", "20170809", "20170810", "20170811", "20170814", "20170815", "20170816", "20170817", "20170818", "20170821", "20170822", "20170823", "20170824", "20170825", "20170828", "20170829", "20170830", "20170831", "20170901", "20170904", "20170905", "20170906", "20170907", "20170908", "20170911", "20170912", "20170913", "20170914", "20170915", "20170918", "20170919", "20170920", "20170921", "20170922", "20170925", "20170926", "20170927", "20170928", "20170929", "20171009", "20171010", "20171011", "20171012", "20171013", "20171016", "20171017", "20171018", "20171019", "20171020", "20171023", "20171024", "20171025", "20171026", "20171027", "20171030", "20171031", "20171101", "20171102", "20171103", "20171106", "20171107", "20171108", "20171109", "20171110", "20171113", "20171114", "20171115", "20171116", "20171117", "20171120", "20171121", "20171122", "20171123", "20171124", "20171127", "20171128", "20171129", "20171130", "20171201", "20171204", "20171205", "20171206", "20171207", "20171208", "20171211", "20171212", "20171213", "20171214", "20171215", "20171218", "20171219", "20171220", "20171221", "20171222", "20171225", "20171226", "20171227", "20171228", "20171229", "20180102", "20180103", "20180104", "20180105", "20180108", "20180109", "20180110", "20180111", "20180112", "20180115", "20180116", "20180117", "20180118", "20180119", "20180122", "20180123", "20180124", "20180125", "20180126", "20180129", "20180130", "20180131", "20180201", "20180202", "20180205", "20180206", "20180207", "20180208", "20180209", "20180212", "20180213", "20180214", "20180222", "20180223", "20180226", "20180227", "20180228", "20180301", "20180302", "20180305", "20180306", "20180307", "20180308", "20180309", "20180312", "20180313", "20180314", "20180315", "20180316", "20180319", "20180320", "20180321", "20180322", "20180323", "20180326", "20180327", "20180328", "20180329", "20180330", "20180402", "20180403", "20180404", "20180409", "20180410", "20180411", "20180412", "20180413", "20180416", "20180417", "20180418", "20180419", "20180420", "20180423", "20180424", "20180425", "20180426", "20180427", "20180502", "20180503", "20180504", "20180507", "20180508", "20180509", "20180510", "20180511", "20180514", "20180515", "20180516", "20180517", "20180518", "20180521", "20180522", "20180523", "20180524", "20180525", "20180528", "20180529", "20180530", "20180531", "20180601", "20180604", "20180605", "20180606", "20180607", "20180608", "20180611", "20180612", "20180613", "20180614", "20180615", "20180619", "20180620", "20180621", "20180622", "20180625", "20180626", "20180627", "20180628", "20180629", "20180702", "20180703", "20180704", "20180705", "20180706", "20180709", "20180710", "20180711", "20180712", "20180713", "20180716", "20180717", "20180718", "20180719", "20180720", "20180723", "20180724", "20180725", "20180726", "20180727", "20180730", "20180731", "20180801", "20180802", "20180803", "20180806", "20180807", "20180808", "20180809", "20180810", "20180813", "20180814", "20180815", "20180816", "20180817", "20180820", "20180821", "20180822", "20180823", "20180824", "20180827", "20180828", "20180829", "20180830", "20180831", "20180903", "20180904", "20180905", "20180906", "20180907", "20180910", "20180911", "20180912", "20180913", "20180914", "20180917", "20180918", "20180919", "20180920", "20180921", "20180925", "20180926", "20180927", "20180928", "20181008", "20181009", "20181010", "20181011", "20181012", "20181015", "20181016", "20181017", "20181018", "20181019", "20181022", "20181023", "20181024", "20181025", "20181026", "20181029", "20181030", "20181031", "20181101", "20181102", "20181105", "20181106", "20181107", "20181108", "20181109", "20181112", "20181113", "20181114", "20181115", "20181116", "20181119", "20181120", "20181121", "20181122", "20181123", "20181126", "20181127", "20181128", "20181129", "20181130", "20181203", "20181204", "20181205", "20181206", "20181207", "20181210", "20181211", "20181212", "20181213", "20181214", "20181217", "20181218", "20181219", "20181220", "20181221", "20181224", "20181225", "20181226", "20181227", "20181228", "20190102", "20190103", "20190104", "20190107", "20190108", "20190109", "20190110", "20190111", "20190114", "20190115", "20190116", "20190117", "20190118", "20190121", "20190122", "20190123", "20190124", "20190125", "20190128", "20190129", "20190130", "20190131", "20190201", "20190211", "20190212", "20190213", "20190214", "20190215", "20190218", "20190219", "20190220", "20190221", "20190222", "20190225", "20190226", "20190227", "20190228", "20190301", "20190304", "20190305", "20190306", "20190307", "20190308", "20190311", "20190312", "20190313", "20190314", "20190315", "20190318", "20190319", "20190320", "20190321", "20190322", "20190325", "20190326", "20190327", "20190328", "20190329", "20190401", "20190402", "20190403", "20190404", "20190408", "20190409", "20190410", "20190411", "20190412", "20190415", "20190416", "20190417", "20190418", "20190419", "20190422", "20190423", "20190424", "20190425", "20190426", "20190429", "20190430", "20190506", "20190507", "20190508", "20190509", "20190510", "20190513", "20190514", "20190515", "20190516", "20190517", "20190520", "20190521", "20190522", "20190523", "20190524", "20190527", "20190528", "20190529", "20190530", "20190531", "20190603", "20190604", "20190605", "20190606", "20190610", "20190611", "20190612", "20190613", "20190614", "20190617", "20190618", "20190619", "20190620", "20190621", "20190624", "20190625", "20190626", "20190627", "20190628", "20190701", "20190702", "20190703", "20190704", "20190705", "20190708", "20190709", "20190710", "20190711", "20190712", "20190715", "20190716", "20190717", "20190718", "20190719", "20190722", "20190723", "20190724", "20190725", "20190726", "20190729", "20190730", "20190731", "20190801", "20190802", "20190805", "20190806", "20190807", "20190808", "20190809", "20190812", "20190813", "20190814", "20190815", "20190816", "20190819", "20190820", "20190821", "20190822", "20190823", "20190826", "20190827", "20190828", "20190829", "20190830", "20190902", "20190903", "20190904", "20190905", "20190906", "20190909", "20190910", "20190911", "20190912", "20190916", "20190917", "20190918", "20190919", "20190920", "20190923", "20190924", "20190925", "20190926", "20190927", "20190930", "20191008", "20191009", "20191010", "20191011", "20191014", "20191015", "20191016", "20191017", "20191018", "20191021", "20191022", "20191023", "20191024", "20191025", "20191028", "20191029", "20191030", "20191031", "20191101", "20191104", "20191105", "20191106", "20191107", "20191108", "20191111", "20191112", "20191113", "20191114", "20191115", "20191118", "20191119", "20191120", "20191121", "20191122", "20191125", "20191126", "20191127", "20191128", "20191129", "20191202", "20191203", "20191204", "20191205", "20191206", "20191209", "20191210", "20191211", "20191212", "20191213", "20191216", "20191217", "20191218", "20191219", "20191220", "20191223", "20191224", "20191225", "20191226", "20191227", "20191230", "20191231", "20200102", "20200103", "20200106", "20200107", "20200108", "20200109", "20200110", "20200113", "20200114", "20200115", "20200116", "20200117", "20200120", "20200121", "20200122", "20200123", "20200203", "20200204", "20200205", "20200206", "20200207", "20200210", "20200211", "20200212", "20200213", "20200214", "20200217", "20200218", "20200219", "20200220", "20200221", "20200224", "20200225", "20200226", "20200227", "20200228", "20200302", "20200303", "20200304", "20200305", "20200306", "20200309", "20200310", "20200311", "20200312", "20200313", "20200316", "20200317", "20200318", "20200319", "20200320", "20200323", "20200324", "20200325", "20200326", "20200327", "20200330", "20200331", "20200401", "20200402", "20200403", "20200407", "20200408", "20200409", "20200410", "20200413", "20200414", "20200415", "20200416", "20200417", "20200420", "20200421", "20200422", "20200423", "20200424", "20200427", "20200428", "20200429", "20200430", "20200506", "20200507", "20200508", "20200511", "20200512", "20200513", "20200514", "20200515", "20200518", "20200519", "20200520", "20200521", "20200522", "20200525", "20200526", "20200527", "20200528", "20200529", "20200601", "20200602", "20200603", "20200604", "20200605", "20200608", "20200609", "20200610", "20200611", "20200612", "20200615", "20200616", "20200617", "20200618", "20200619", "20200622", "20200623", "20200624", "20200629", "20200630", "20200701", "20200702", "20200703", "20200706", "20200707", "20200708", "20200709", "20200710", "20200713", "20200714", "20200715", "20200716", "20200717", "20200720", "20200721", "20200722", "20200723", "20200724", "20200727", "20200728", "20200729", "20200730", "20200731", "20200803", "20200804", "20200805", "20200806", "20200807", "20200810", "20200811", "20200812", "20200813", "20200814", "20200817", "20200818", "20200819", "20200820", "20200821", "20200824", "20200825", "20200826", "20200827", "20200828", "20200831", "20200901", "20200902", "20200903", "20200904", "20200907", "20200908", "20200909", "20200910", "20200911", "20200914", "20200915", "20200916", "20200917", "20200918", "20200921", "20200922", "20200923", "20200924", "20200925", "20200928", "20200929", "20200930", "20201009", "20201012", "20201013", "20201014", "20201015", "20201016", "20201019", "20201020", "20201021", "20201022", "20201023", "20201026", "20201027", "20201028", "20201029", "20201030", "20201102", "20201103", "20201104", "20201105", "20201106", "20201109", "20201110", "20201111", "20201112", "20201113", "20201116", "20201117", "20201118", "20201119", "20201120", "20201123", "20201124", "20201125", "20201126", "20201127", "20201130", "20201201", "20201202", "20201203", "20201204", "20201207", "20201208", "20201209", "20201210", "20201211", "20201214", "20201215", "20201216", "20201217", "20201218", "20201221", "20201222", "20201223", "20201224", "20201225", "20201228", "20201229", "20201230", "20201231", "20210104", "20210105", "20210106", "20210107", "20210108", "20210111", "20210112", "20210113", "20210114", "20210115", "20210118", "20210119", "20210120", "20210121", "20210122", "20210125", "20210126", "20210127", "20210128", "20210129", "20210201", "20210202", "20210203", "20210204", "20210205", "20210208", "20210209", "20210210", "20210218", "20210219", "20210222", "20210223", "20210224", "20210225", "20210226", "20210301", "20210302", "20210303", "20210304", "20210305", "20210308", "20210309", "20210310", "20210311", "20210312", "20210315", "20210316", "20210317", "20210318", "20210319", "20210322", "20210323", "20210324", "20210325", "20210326", "20210329", "20210330", "20210331", "20210401", "20210402", "20210406", "20210407", "20210408", "20210409", "20210412", "20210413", "20210414", "20210415", "20210416", "20210419", "20210420", "20210421", "20210422", "20210423", "20210426", "20210427", "20210428", "20210429", "20210430", "20210506", "20210507", "20210510", "20210511", "20210512", "20210513", "20210514", "20210517", "20210518", "20210519", "20210520", "20210521", "20210524", "20210525", "20210526", "20210527", "20210528", "20210531", "20210601", "20210602", "20210603", "20210604", "20210607", "20210608", "20210609", "20210610", "20210611", "20210615", "20210616", "20210617", "20210618", "20210621", "20210622", "20210623", "20210624", "20210625", "20210628", "20210629", "20210630", "20210701", "20210702", "20210705", "20210706", "20210707", "20210708", "20210709", "20210712", "20210713", "20210714", "20210715", "20210716", "20210719", "20210720", "20210721", "20210722", "20210723", "20210726", "20210727", "20210728", "20210729", "20210730", "20210802", "20210803", "20210804", "20210805", "20210806", "20210809", "20210810", "20210811", "20210812", "20210813", "20210816", "20210817", "20210818", "20210819", "20210820", "20210823", "20210824", "20210825", "20210826", "20210827", "20210830", "20210831", "20210901", "20210902", "20210903", "20210906", "20210907", "20210908", "20210909", "20210910", "20210913", "20210914", "20210915", "20210916", "20210917", "20210922", "20210923", "20210924", "20210927", "20210928", "20210929", "20210930", "20211008", "20211011", "20211012", "20211013", "20211014", "20211015", "20211018", "20211019", "20211020", "20211021", "20211022", "20211025", "20211026", "20211027", "20211028", "20211029", "20211101", "20211102", "20211103", "20211104", "20211105", "20211108", "20211109", "20211110", "20211111", "20211112", "20211115", "20211116", "20211117", "20211118", "20211119", "20211122", "20211123", "20211124", "20211125", "20211126", "20211129", "20211130", "20211201", "20211202", "20211203", "20211206", "20211207", "20211208", "20211209", "20211210", "20211213", "20211214", "20211215", "20211216", "20211217", "20211220", "20211221", "20211222", "20211223", "20211224", "20211227", "20211228", "20211229", "20211230", "20211231", "20220104", "20220105", "20220106", "20220107", "20220110", "20220111", "20220112", "20220113", "20220114", "20220117", "20220118", "20220119", "20220120", "20220121", "20220124", "20220125", "20220126", "20220127", "20220128", "20220207", "20220208", "20220209", "20220210", "20220211", "20220214", "20220215", "20220216", "20220217", "20220218", "20220221", "20220222", "20220223", "20220224", "20220225", "20220228", "20220301", "20220302", "20220303", "20220304", "20220307", "20220308", "20220309", "20220310", "20220311", "20220314", "20220315", "20220316", "20220317", "20220318", "20220321", "20220322", "20220323", "20220324", "20220325", "20220328", "20220329", "20220330", "20220331", "20220401", "20220406", "20220407", "20220408", "20220411", "20220412", "20220413", "20220414", "20220415", "20220418", "20220419", "20220420", "20220421", "20220422", "20220425", "20220426", "20220427", "20220428", "20220429", "20220505", "20220506", "20220509", "20220510", "20220511", "20220512", "20220513", "20220516", "20220517", "20220518", "20220519", "20220520", "20220523", "20220524", "20220525", "20220526", "20220527", "20220530", "20220531", "20220601", "20220602", "20220606", "20220607", "20220608", "20220609", "20220610", "20220613", "20220614", "20220615", "20220616", "20220617", "20220620", "20220621", "20220622", "20220623", "20220624", "20220627", "20220628", "20220629", "20220630", "20220701", "20220704", "20220705", "20220706", "20220707", "20220708", "20220711", "20220712", "20220713", "20220714", "20220715", "20220718", "20220719", "20220720", "20220721", "20220722", "20220725", "20220726", "20220727", "20220728", "20220729", "20220801", "20220802", "20220803", "20220804", "20220805", "20220808", "20220809", "20220810", "20220811", "20220812", "20220815", "20220816", "20220817", "20220818", "20220819", "20220822", "20220823", "20220824", "20220825", "20220826", "20220829", "20220830", "20220831", "20220901", "20220902", "20220905", "20220906", "20220907", "20220908", "20220909", "20220913", "20220914", "20220915", "20220916", "20220919", "20220920", "20220921", "20220922", "20220923", "20220926", "20220927", "20220928", "20220929", "20220930", "20221010", "20221011", "20221012", "20221013", "20221014", "20221017", "20221018", "20221019", "20221020", "20221021", "20221024", "20221025", "20221026", "20221027", "20221028", "20221031", "20221101", "20221102", "20221103", "20221104", "20221107", "20221108", "20221109", "20221110", "20221111", "20221114", "20221115", "20221116", "20221117", "20221118", "20221121", "20221122", "20221123", "20221124", "20221125", "20221128", "20221129", "20221130", "20221201", "20221202", "20221205", "20221206", "20221207", "20221208", "20221209", "20221212", "20221213", "20221214", "20221215", "20221216", "20221219", "20221220", "20221221", "20221222", "20221223", "20221226", "20221227", "20221228", "20221229", "20221230", "20230103", "20230104", "20230105", "20230106", "20230109", "20230110", "20230111", "20230112", "20230113", "20230116", "20230117", "20230118", "20230119", "20230120", "20230130", "20230131", "20230201", "20230202", "20230203", "20230206", "20230207", "20230208", "20230209", "20230210", "20230213", "20230214", "20230215", "20230216", "20230217", "20230220", "20230221", "20230222", "20230223", "20230224", "20230227", "20230228", "20230301", "20230302", "20230303", "20230306", "20230307", "20230308", "20230309", "20230310", "20230313", "20230314", "20230315", "20230316", "20230317", "20230320", "20230321", "20230322", "20230323", "20230324", "20230327", "20230328", "20230329", "20230330", "20230331", "20230403", "20230404", "20230406", "20230407", "20230410", "20230411", "20230412", "20230413", "20230414", "20230417", "20230418", "20230419", "20230420", "20230421", "20230424", "20230425", "20230426", "20230427", "20230428", "20230504", "20230505", "20230508", "20230509", "20230510", "20230511", "20230512", "20230515", "20230516", "20230517", "20230518", "20230519", "20230522", "20230523", "20230524", "20230525", "20230526", "20230529", "20230530", "20230531", "20230601", "20230602", "20230605", "20230606", "20230607", "20230608", "20230609", "20230612", "20230613", "20230614", "20230615", "20230616", "20230619", "20230620", "20230621", "20230626", "20230627", "20230628", "20230629", "20230630", "20230703", "20230704", "20230705", "20230706", "20230707", "20230710", "20230711", "20230712", "20230713", "20230714", "20230717", "20230718", "20230719", "20230720", "20230721", "20230724", "20230725", "20230726", "20230727", "20230728", "20230731", "20230801", "20230802", "20230803", "20230804", "20230807", "20230808", "20230809", "20230810", "20230811", "20230814", "20230815", "20230816", "20230817", "20230818", "20230821", "20230822", "20230823", "20230824", "20230825", "20230828", "20230829", "20230830", "20230831", "20230901", "20230904", "20230905", "20230906", "20230907", "20230908", "20230911", "20230912", "20230913", "20230914", "20230915", "20230918", "20230919", "20230920", "20230921", "20230922", "20230925", "20230926", "20230927", "20230928", "20231009", "20231010", "20231011", "20231012", "20231013", "20231016", "20231017", "20231018", "20231019", "20231020", "20231023", "20231024", "20231025", "20231026", "20231027", "20231030", "20231031", "20231101", "20231102", "20231103", "20231106", "20231107", "20231108", "20231109", "20231110", "20231113", "20231114", "20231115", "20231116", "20231117", "20231120", "20231121", "20231122", "20231123", "20231124", "20231127", "20231128", "20231129", "20231130", "20231201", "20231204", "20231205", "20231206", "20231207", "20231208", "20231211", "20231212", "20231213", "20231214", "20231215", "20231218", "20231219", "20231220", "20231221", "20231222", "20231225", "20231226", "20231227", "20231228", "20231229", "20240102", "20240103", "20240104", "20240105", "20240108", "20240109", "20240110", "20240111", "20240112", "20240115", "20240116", "20240117", "20240118", "20240119", "20240122", "20240123", "20240124", "20240125", "20240126", "20240129", "20240130", "20240131", "20240201", "20240202", "20240205", "20240206", "20240207", "20240208", "20240219", "20240220", "20240221", "20240222", "20240223", "20240226", "20240227", "20240228", "20240229", "20240301", "20240304", "20240305", "20240306", "20240307", "20240308", "20240311", "20240312", "20240313", "20240314", "20240315", "20240318", "20240319", "20240320", "20240321", "20240322", "20240325", "20240326", "20240327", "20240328", "20240329", "20240401", "20240402", "20240403", "20240408", "20240409", "20240410", "20240411", "20240412", "20240415", "20240416", "20240417", "20240418", "20240419", "20240422", "20240423", "20240424", "20240425", "20240426", "20240429", "20240430", "20240506", "20240507", "20240508", "20240509", "20240510", "20240513", "20240514", "20240515", "20240516", "20240517", "20240520", "20240521", "20240522", "20240523", "20240524", "20240527", "20240528", "20240529", "20240530", "20240531", "20240603", "20240604", "20240605", "20240606", "20240607", "20240611", "20240612", "20240613", "20240614", "20240617", "20240618", "20240619", "20240620", "20240621", "20240624", "20240625", "20240626", "20240627", "20240628", "20240701", "20240702", "20240703", "20240704", "20240705", "20240708", "20240709", "20240710", "20240711", "20240712", "20240715", "20240716", "20240717", "20240718", "20240719", "20240722", "20240723", "20240724", "20240725", "20240726", "20240729", "20240730", "20240731", "20240801", "20240802", "20240805", "20240806", "20240807", "20240808", "20240809", "20240812", "20240813", "20240814", "20240815", "20240816", "20240819", "20240820", "20240821", "20240822", "20240823", "20240826", "20240827", "20240828", "20240829", "20240830", "20240902", "20240903", "20240904", "20240905", "20240906", "20240909", "20240910", "20240911", "20240912", "20240913", "20240918", "20240919", "20240920", "20240923", "20240924", "20240925", "20240926", "20240927", "20240930", "20241008", "20241009", "20241010", "20241011", "20241014", "20241015", "20241016", "20241017", "20241018", "20241021", "20241022", "20241023", "20241024", "20241025", "20241028", "20241029", "20241030", "20241031", "20241101", "20241104", "20241105", "20241106", "20241107", "20241108", "20241111", "20241112", "20241113", "20241114", "20241115", "20241118", "20241119", "20241120", "20241121", "20241122", "20241125", "20241126", "20241127", "20241128", "20241129", "20241202", "20241203", "20241204", "20241205", "20241206", "20241209", "20241210", "20241211", "20241212", "20241213", "20241216", "20241217", "20241218", "20241219", "20241220", "20241223", "20241224", "20241225", "20241226", "20241227", "20241230", "20241231", "20250102", "20250103", "20250106", "20250107", "20250108", "20250109", "20250110", "20250113", "20250114", "20250115", "20250116", "20250117", "20250120", "20250121", "20250122", "20250123", "20250124", "20250127", "20250205", "20250206", "20250207", "20250210", "20250211", "20250212", "20250213", "20250214", "20250217", "20250218", "20250219", "20250220", "20250221", "20250224", "20250225", "20250226", "20250227", "20250228", "20250303", "20250304", "20250305", "20250306", "20250307", "20250310", "20250311", "20250312", "20250313", "20250314", "20250317", "20250318", "20250319", "20250320", "20250321", "20250324", "20250325", "20250326", "20250327", "20250328", "20250331", "20250401", "20250402", "20250403", "20250407", "20250408", "20250409", "20250410", "20250411", "20250414", "20250415", "20250416", "20250417", "20250418", "20250421", "20250422", "20250423", "20250424", "20250425", "20250428", "20250429", "20250430", "20250506", "20250507", "20250508", "20250509", "20250512", "20250513", "20250514", "20250515", "20250516", "20250519", "20250520", "20250521", "20250522", "20250523", "20250526", "20250527", "20250528", "20250529", "20250530", "20250603", "20250604", "20250605", "20250606", "20250609", "20250610", "20250611", "20250612", "20250613", "20250616", "20250617", "20250618", "20250619", "20250620", "20250623", "20250624", "20250625", "20250626", "20250627", "20250630", "20250701", "20250702", "20250703", "20250704", "20250707", "20250708", "20250709", "20250710", "20250711", "20250714", "20250715", "20250716", "20250717", "20250718", "20250721", "20250722", "20250723", "20250724", "20250725", "20250728", "20250729", "20250730", "20250731", "20250801", "20250804", "20250805", "20250806", "20250807", "20250808", "20250811", "20250812", "20250813", "20250814", "20250815", "20250818", "20250819", "20250820", "20250821", "20250822", "20250825", "20250826", "20250827", "20250828", "20250829", "20250901", "20250902", "20250903", "20250904", "20250905", "20250908", "20250909", "20250910", "20250911", "20250912", "20250915", "20250916", "20250917", "20250918", "20250919", "20250922", "20250923", "20250924", "20250925", "20250926", "20250929", "20250930", "20251009", "20251010", "20251013", "20251014", "20251015", "20251016", "20251017", "20251020", "20251021", "20251022", "20251023", "20251024", "20251027", "20251028", "20251029", "20251030", "20251031", "20251103", "20251104", "20251105", "20251106", "20251107", "20251110", "20251111", "20251112", "20251113", "20251114", "20251117", "20251118", "20251119", "20251120", "20251121", "20251124", "20251125", "20251126", "20251127", "20251128", "20251201", "20251202", "20251203", "20251204", "20251205", "20251208", "20251209", "20251210", "20251211", "20251212", "20251215", "20251216", "20251217", "20251218", "20251219", "20251222", "20251223", "20251224", "20251225", "20251226", "20251229", "20251230", "20251231", "20260105", "20260106", "20260107", "20260108", "20260109", "20260112", "20260113", "20260114", "20260115", "20260116", "20260119", "20260120", "20260121", "20260122", "20260123", "20260126", "20260127", "20260128", "20260129", "20260130", "20260202", "20260203", "20260204", "20260205", "20260206", "20260209", "20260210", "20260211", "20260212", "20260213", "20260224", "20260225", "20260226", "20260227", "20260302", "20260303", "20260304", "20260305", "20260306", "20260309", "20260310", "20260311", "20260312", "20260313", "20260316", "20260317", "20260318", "20260319", "20260320", "20260323", "20260324", "20260325", "20260326", "20260327", "20260330", "20260331", "20260401", "20260402", "20260403", "20260407", "20260408", "20260409", "20260410", "20260413", "20260414", "20260415", "20260416", "20260417", "20260420", "20260421", "20260422", "20260423", "20260424", "20260427", "20260428", "20260429", "20260430", "20260506", "20260507", "20260508", "20260511", "20260512", "20260513", "20260514", "20260515", "20260518", "20260519", "20260520", "20260521", "20260522", "20260525", "20260526", "20260527", "20260528", "20260529", "20260601", "20260602", "20260603", "20260604", "20260605", "20260608", "20260609", "20260610", "20260611", "20260612", "20260615", "20260616", "20260617", "20260618", "20260622", "20260623", "20260624", "20260625", "20260626", "20260629", "20260630", "20260701", "20260702", "20260703", "20260706", "20260707", "20260708", "20260709", "20260710", "20260713", "20260714", "20260715", "20260716", "20260717", "20260720", "20260721", "20260722", "20260723", "20260724", "20260727", "20260728", "20260729", "20260730", "20260731", "20260803", "20260804", "20260805", "20260806", "20260807", "20260810", "20260811", "20260812", "20260813", "20260814", "20260817", "20260818", "20260819", "20260820", "20260821", "20260824", "20260825", "20260826", "20260827", "20260828", "20260831", "20260901", "20260902", "20260903", "20260904", "20260907", "20260908", "20260909", "20260910", "20260911", "20260914", "20260915", "20260916", "20260917", "20260918", "20260921", "20260922", "20260923", "20260924", "20260928", "20260929", "20260930", "20261008", "20261009", "20261012", "20261013", "20261014", "20261015", "20261016", "20261019", "20261020", "20261021", "20261022", "20261023", "20261026", "20261027", "20261028", "20261029", "20261030", "20261102", "20261103", "20261104", "20261105", "20261106", "20261109", "20261110", "20261111", "20261112", "20261113", "20261116", "20261117", "20261118", "20261119", "20261120", "20261123", "20261124", "20261125", "20261126", "20261127", "20261130", "20261201", "20261202", "20261203", "20261204", "20261207", "20261208", "20261209", "20261210", "20261211", "20261214", "20261215", "20261216", "20261217", "20261218", "20261221", "20261222", "20261223", "20261224", "20261225", "20261228", "20261229", "20261230", "20261231" ] ================================================ FILE: akshare/forex/__init__.py ================================================ ================================================ FILE: akshare/forex/cons.py ================================================ symbol_market_map = { "EURCNYC": 120, "JPYZAR": 119, "NZDCNYC": 120, "CNYRUBC": 120, "AUDCNYC": 120, "JPYGBP": 119, "JPYSGD": 119, "JPYCNH": 133, "JPYAUD": 119, "USDBRL": 119, "JPYEUR": 119, "JPYTRY": 119, "JPYCAD": 119, "CHFZAR": 119, "JPYHKD": 119, "SEKEUR": 119, "JPYUSD": 119, "GBPCNYC": 120, "JPYNZD": 119, "CHFGBP": 119, "USDIDR": 119, "CHFSGD": 119, "USDPLN": 119, "CHFCNH": 133, "SEKUSD": 119, "CHFAUD": 119, "USDKRW": 119, "EURPLN": 119, "USDHUF": 119, "CHFCAD": 119, "USDTHB": 119, "CHFEUR": 119, "JPYCNYC": 120, "EURHUF": 119, "CHFHKD": 119, "SGDCNYC": 120, "CHFUSD": 119, "USDINR": 119, "USDCZK": 119, "CHFNZD": 119, "USDMXN": 119, "GBPPLN": 119, "USDZAR": 119, "JPYCHF": 119, "EURCZK": 119, "EURZAR": 119, "CADCNYC": 120, "NOKEUR": 119, "NZDGBP": 119, "NOKUSD": 119, "NZDSGD": 119, "USDGBP": 119, "HKDGBP": 119, "NZDCNH": 133, "NZDAUD": 119, "HKDSGD": 119, "CNYSARC": 120, "USDSGD": 119, "CNYAEDC": 120, "EURGBP": 119, "CADGBP": 119, "USDCNH": 133, "CNYTRYC": 120, "CADSGD": 119, "USDAUD": 119, "GBPZAR": 119, "EURSGD": 119, "HKDCNH": 133, "NZDCAD": 119, "CADCNH": 133, "HKDAUD": 119, "NZDEUR": 119, "EURCNH": 133, "EURAUD": 119, "NZDHKD": 119, "CADAUD": 119, "AUDGBP": 119, "USDDKK": 119, "HKDCAD": 119, "USDCAD": 119, "AUDSGD": 119, "USDTRY": 119, "EURTRY": 119, "USDEUR": 119, "NZDUSD": 119, "SGDGBP": 119, "USDHKD": 119, "AUDCNH": 133, "EURDKK": 119, "USDARS": 119, "USDSAR": 119, "TRYUSD": 119, "TRYEUR": 119, "SARUSD": 119, "INRUSD": 119, "HUFUSD": 119, "HUFEUR": 119, "HKDUSD": 119, "HKDEUR": 119, "HKDCNYC": 120, "EURCAD": 119, "DKKUSD": 119, "DKKEUR": 119, "CNYMOPC": 120, "CNHSGD": 133, "CNHGBP": 133, "CNHAUD": 133, "CADEUR": 119, "SGDCNH": 133, "EURHKD": 119, "CADHKD": 119, "USDCNYC": 120, "GBPSGD": 119, "EURUSD": 119, "SGDAUD": 119, "HKDNZD": 119, "USDNZD": 119, "GBPCNH": 133, "CADUSD": 119, "AUDCAD": 119, "CNYTHBC": 120, "CNHEUR": 133, "GBPAUD": 119, "AUDEUR": 119, "CADNZD": 119, "EURNZD": 119, "CNHCAD": 133, "AUDHKD": 119, "SGDCAD": 119, "AUDUSD": 119, "SGDEUR": 119, "CNHHKD": 133, "GBPCAD": 119, "CNHUSD": 133, "SGDHKD": 119, "GBPEUR": 119, "SGDUSD": 119, "AUDNZD": 119, "GBPHKD": 119, "GBPUSD": 119, "CNHNZD": 133, "CHFCNYC": 120, "SGDNZD": 119, "ZARGBP": 119, "USDNOK": 119, "GBPNZD": 119, "CZKEUR": 119, "EURNOK": 119, "CHFJPY": 119, "NZDCHF": 119, "PLNGBP": 119, "HKDCHF": 119, "ZARUSD": 119, "USDCHF": 119, "ZAREUR": 119, "MXNUSD": 119, "EURCHF": 119, "CADCHF": 119, "CZKUSD": 119, "CNYKRWC": 120, "CNHCHF": 133, "AUDCHF": 119, "PLNEUR": 119, "CNYMXNC": 120, "SGDCHF": 119, "PLNUSD": 119, "USDSEK": 119, "GBPCHF": 119, "EURSEK": 119, "CNYMYRC": 120, "NZDJPY": 119, "ZARCHF": 119, "USDJPY": 119, "THBUSD": 119, "HKDJPY": 119, "EURJPY": 119, "CADJPY": 119, "AUDJPY": 119, "TRYJPY": 119, "CNHJPY": 133, "SGDJPY": 119, "GBPJPY": 119, "CNYZARC": 120, "ZARJPY": 119, "USDRUB": 119, "CNYDKKC": 120, "CNYNOKC": 120, "CNYHUFC": 120, "CNYPLNC": 120, "CNYSEKC": 120, } ================================================ FILE: akshare/forex/forex_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/6/23 15:00 Desc: 东方财富网-行情中心-外汇市场-所有汇率 https://quote.eastmoney.com/center/gridlist.html#forex_all """ import pandas as pd import requests from akshare.forex.cons import symbol_market_map from akshare.utils.func import fetch_paginated_data def forex_spot_em() -> pd.DataFrame: """ 东方财富网-行情中心-外汇市场-所有汇率-实时行情数据 https://quote.eastmoney.com/center/gridlist.html#forex_all :return: 实时行情数据 :rtype: pandas.DataFrame """ url = "https://push2.eastmoney.com/api/qt/clist/get" params = { "np": "1", "fltt": "2", "invt": "2", "fs": "m:119,m:120,m:133", "fields": "f12,f13,f14,f1,f2,f4,f3,f152,f17,f18,f15,f16", "fid": "f3", "pn": "1", "pz": "100", "po": "1", "dect": "1", "wbp2u": "|0|0|0|web", } temp_df = fetch_paginated_data(url, params) temp_df.rename( columns={ "index": "序号", "f12": "代码", "f14": "名称", "f17": "今开", "f4": "涨跌额", "f3": "涨跌幅", "f2": "最新价", "f15": "最高", "f16": "最低", "f18": "昨收", }, inplace=True, ) temp_df = temp_df[ [ "序号", "代码", "名称", "最新价", "涨跌额", "涨跌幅", "今开", "最高", "最低", "昨收", ] ] 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") 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") temp_df["昨收"] = pd.to_numeric(temp_df["昨收"], errors="coerce") return temp_df def forex_hist_em(symbol: str = "USDCNH") -> pd.DataFrame: """ 东方财富网-行情中心-外汇市场-所有汇率-历史行情数据 https://quote.eastmoney.com/cnyrate/EURCNYC.html :param symbol: 品种代码;可以通过 ak.forex_spot_em() 来获取所有可获取历史行情数据的品种代码 :type symbol: str :return: 历史行情数据 :rtype: pandas.DataFrame """ url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" market_code = symbol_market_map[symbol] params = { "secid": f"{market_code}.{symbol}", "klt": "101", "fqt": "1", "lmt": "50000", "end": "20500000", "iscca": "1", "fields1": "f1,f2,f3,f4,f5,f6,f7,f8", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64", "ut": "f057cbcbce2a86e2866ab8877db1d059", "forcect": 1, } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) temp_df["code"] = data_json["data"]["code"] temp_df["name"] = data_json["data"]["name"] temp_df.columns = [ "日期", "今开", "最新价", "最高", "最低", "-", "-", "振幅", "-", "-", "-", "-", "-", "-", "代码", "名称", ] temp_df = temp_df[ [ "日期", "代码", "名称", "今开", "最新价", "最高", "最低", "振幅", ] ] 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") temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce") temp_df["振幅"] = pd.to_numeric(temp_df["振幅"], errors="coerce") return temp_df if __name__ == "__main__": forex_spot_em_df = forex_spot_em() print(forex_spot_em_df) forex_hist_em_df = forex_hist_em(symbol="USDCNH") print(forex_hist_em_df) ================================================ FILE: akshare/fortune/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/12/10 21:55 Desc: """ ================================================ FILE: akshare/fortune/fortune_500.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/8/4 17:22 Desc: 历年世界 500 强榜单数据 https://www.fortunechina.com/fortune500/index.htm 特殊情况说明: 2010年由于网页端没有公布公司所属的国家, 故 2010 年数据没有国家这列 """ from functools import lru_cache from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup from tqdm import tqdm @lru_cache() def _fortune_rank_year_url_map() -> dict: """ 年份和网址映射 https://www.fortunechina.com/fortune500/index.htm :return: 年份和网址映射 :rtype: dict """ url = "https://www.fortunechina.com/fortune500/index.htm" r = requests.get(url) soup = BeautifulSoup(r.text, features="lxml") url_2023 = "https://www.fortunechina.com/fortune500/c/2023-08/02/content_436874.htm" node_list = soup.find_all(name="div", attrs={"class": "swiper-slide"}) url_list = [item.find("a")["href"] for item in node_list] year_list = [item.find("a").text for item in node_list] year_url_map = dict(zip(year_list, url_list)) year_url_map["2023"] = url_2023 return year_url_map def fortune_rank(year: str = "2015") -> pd.DataFrame: """ 财富 500 强公司从 1996 年开始的排行榜 https://www.fortunechina.com/fortune500/index.htm :param year: str 年份 :return: pandas.DataFrame """ year_url_map = _fortune_rank_year_url_map() url = year_url_map[year] r = requests.get(url) r.encoding = "utf-8" if int(year) < 2007: df = pd.read_html(StringIO(r.text))[0].iloc[1:-1,] df.columns = pd.read_html(StringIO(r.text))[0].iloc[0, :].tolist() return df elif 2006 < int(year) < 2010: df = pd.read_html(StringIO(r.text))[0].iloc[1:,] df.columns = pd.read_html(StringIO(r.text))[0].iloc[0, :].tolist() for page in tqdm(range(2, 11), leave=False): # page =2 r = requests.get(url.rsplit(".", maxsplit=1)[0] + "_" + str(page) + ".htm") r.encoding = "utf-8" temp_df = pd.read_html(StringIO(r.text))[0].iloc[1:,] temp_df.columns = pd.read_html(StringIO(r.text))[0].iloc[0, :].tolist() df = pd.concat(objs=[df, temp_df], ignore_index=True) return df else: df = pd.read_html(StringIO(r.text))[0] return df if __name__ == "__main__": fortune_rank_df = fortune_rank(year="2023") # 2010 不一样 print(fortune_rank_df) fortune_rank_df = fortune_rank(year="2022") # 2010 不一样 print(fortune_rank_df) fortune_rank_df = fortune_rank(year="2008") # 2010 不一样 print(fortune_rank_df) fortune_rank_df = fortune_rank(year="2008") # 2010 不一样 print(fortune_rank_df) fortune_rank_df = fortune_rank(year="2009") # 2010 不一样 print(fortune_rank_df) for item in range(1996, 2008): print(item) fortune_rank_df = fortune_rank(year=str(item)) # 2010 不一样 print(fortune_rank_df) for item in range(2010, 2023): print(item) fortune_rank_df = fortune_rank(year=str(item)) # 2010 不一样 print(fortune_rank_df) ================================================ FILE: akshare/fortune/fortune_bloomberg.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/4/10 18:24 Desc: 彭博亿万富豪指数 https://www.bloomberg.com/billionaires/ """ import pandas as pd import requests from bs4 import BeautifulSoup def index_bloomberg_billionaires_hist(year: str = "2021") -> pd.DataFrame: """ Bloomberg Billionaires Index https://stats.areppim.com/stats/links_billionairexlists.htm :param year: choice of {"2021", "2019", "2018", ...} :type year: str :return: 彭博亿万富豪指数历史数据 :rtype: pandas.DataFrame """ url = f"https://stats.areppim.com/listes/list_billionairesx{year[-2:]}xwor.htm" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") trs = soup.findAll("table")[0].findAll("tr") heads = trs[1] if "Rank" not in heads.text: heads = trs[0] dic_keys = [] dic = {} for head in heads: head = head.text dic_keys.append(head) for dic_key in dic_keys: dic[dic_key] = [] for ll in trs: item = ll.findAll("td") for i in range(len(item)): v = item[i].text if i == 0 and not v.isdigit(): break dic[dic_keys[i]].append(v) temp_df = pd.DataFrame(dic) temp_df = temp_df.rename( { "Rank": "rank", "Name": "name", "Age": "age", "Citizenship": "country", "Country": "country", "Net Worth(bil US$)": "total_net_worth", "Total net worth$Billion": "total_net_worth", "$ Last change": "last_change", "$ YTD change": "ytd_change", "Industry": "industry", }, axis=1, ) return temp_df def index_bloomberg_billionaires() -> pd.DataFrame: """ Bloomberg Billionaires Index https://www.bloomberg.com/billionaires/ :return: 彭博亿万富豪指数 :rtype: pandas.DataFrame """ url = "https://www.bloomberg.com/billionaires" headers = { "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "accept-encoding": "gzip, deflate, br", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8", "cache-control": "no-cache", "pragma": "no-cache", "sec-fetch-dest": "document", "sec-fetch-mode": "navigate", "sec-fetch-site": "same-origin", "sec-fetch-user": "?1", "upgrade-insecure-requests": "1", "referer": "https://www.bloomberg.com/", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36", } r = requests.get(url, headers=headers) soup = BeautifulSoup(r.text, "lxml") big_content_list = list() soup_node = soup.find(attrs={"class": "table-chart"}).find_all( attrs={"class": "table-row"} ) for row in soup_node: temp_content_list = row.text.strip().replace("\n", "").split(" ") content_list = [item for item in temp_content_list if item != ""] big_content_list.append(content_list) temp_df = pd.DataFrame(big_content_list) temp_df.columns = [ "rank", "name", "total_net_worth", "last_change", "YTD_change", "country", "industry", ] return temp_df if __name__ == "__main__": index_bloomberg_billionaires_df = index_bloomberg_billionaires() print(index_bloomberg_billionaires_df) index_bloomberg_billionaires_hist_df = index_bloomberg_billionaires_hist( year="2021" ) print(index_bloomberg_billionaires_hist_df) ================================================ FILE: akshare/fortune/fortune_forbes_500.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/1/26 15:10 Desc: 福布斯中国-榜单 https://www.forbeschina.com/lists """ import pandas as pd import requests from bs4 import BeautifulSoup def forbes_rank(symbol: str = "2021福布斯中国创投人100") -> pd.DataFrame: """ 福布斯中国-榜单 https://www.forbeschina.com/lists https://www.forbeschina.com/lists/1750 :param symbol: choice of {"2020福布斯美国富豪榜", "2020福布斯新加坡富豪榜", "2020福布斯中国名人榜", *} :type symbol: str :return: 具体指标的榜单 :rtype: pandas.DataFrame """ url = "https://www.forbeschina.com/lists" r = requests.get(url, verify=False) soup = BeautifulSoup(r.text, "lxml") need_list = [ item.find_all("a") for item in soup.find_all("div", attrs={"class": "col-sm-4"}) ] all_list = [] for item in need_list: all_list.extend(item) name_url_dict = dict( zip( [item.text.strip() for item in all_list], ["https://www.forbeschina.com" + item["href"] for item in all_list], ) ) r = requests.get(name_url_dict[symbol], verify=False) temp_df = pd.read_html(r.text)[0] return temp_df if __name__ == "__main__": forbes_rank_df = forbes_rank(symbol="2021福布斯中国香港富豪榜") print(forbes_rank_df) ================================================ FILE: akshare/fortune/fortune_hurun.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/12/22 20:00 Desc: 胡润排行榜 https://www.hurun.net/ """ import warnings import pandas as pd import requests from bs4 import BeautifulSoup def hurun_rank(indicator: str = "胡润百富榜", year: str = "2023") -> pd.DataFrame: """ 胡润排行榜 https://www.hurun.net/CN/HuList/Index?num=3YwKs889SRIm :param indicator: choice of {"胡润百富榜", "胡润全球富豪榜", "胡润印度榜", "胡润全球独角兽榜", "全球瞪羚企业榜", "胡润Under30s创业领袖榜", "胡润中国500强民营企业", "胡润世界500强", "胡润艺术榜"} :type indicator: str :param year: 指定年份; {"胡润百富榜": "2014-至今", "胡润全球富豪榜": "2019-至今", "胡润印度榜": "2018-至今", "胡润全球独角兽榜": "2019-至今", "中国瞪羚企业榜": "2021-至今", "全球瞪羚企业榜": "2021-至今", "胡润Under30s创业领袖榜": "2019-至今", "胡润中国500强民营企业": "2019-至今", "胡润世界500强": "2020-至今", "胡润艺术榜": "2019-至今"} :type year: str :return: 指定 indicator 和 year 的数据 :rtype: pandas.DataFrame """ url = "https://www.hurun.net/zh-CN/Rank/HsRankDetails?pagetype=rich" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") url_list = [] for item in soup.find_all("ul", attrs={"class": "dropdown-menu"}): for inner_item in item.find_all("a"): url_list.append("https://www.hurun.net" + inner_item["href"]) name_list = [] for item in soup.find_all("ul", attrs={"class": "dropdown-menu"}): for inner_item in item.find_all("a"): name_list.append(inner_item.text.strip()) name_url_map = dict(zip(name_list, url_list)) r = requests.get(name_url_map[indicator]) soup = BeautifulSoup(r.text, "lxml") code_list = [ item["value"].split("=")[2] for item in soup.find(attrs={"id": "exampleFormControlSelect1"}).find_all( "option" ) ] year_list = [ item.text.split(" ")[0] for item in soup.find(attrs={"id": "exampleFormControlSelect1"}).find_all( "option" ) ] year_code_map = dict(zip(year_list, code_list)) params = { "num": year_code_map[year], "search": "", "offset": "0", "limit": "20000", } if year == "2018": warnings.warn("正在下载中") offset = 0 limit = 20 big_df = pd.DataFrame() while offset < 2200: try: params.update( { "offset": offset, "limit": limit, } ) url = "https://www.hurun.net/zh-CN/Rank/HsRankDetailsList" r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["rows"]) offset = offset + 20 big_df = pd.concat([big_df, temp_df], ignore_index=True) except requests.exceptions.JSONDecodeError: offset = offset + 40 continue big_df.rename( columns={ "hs_Rank_Rich_Ranking": "排名", "hs_Rank_Rich_Wealth": "财富", "hs_Rank_Rich_Ranking_Change": "排名变化", "hs_Rank_Rich_ChaName_Cn": "姓名", "hs_Rank_Rich_ComName_Cn": "企业", "hs_Rank_Rich_Industry_Cn": "行业", }, inplace=True, ) big_df = big_df[ [ "排名", "财富", "姓名", "企业", "行业", ] ] return big_df url = "https://www.hurun.net/zh-CN/Rank/HsRankDetailsList" r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["rows"]) if indicator == "胡润百富榜": temp_df.rename( columns={ "hs_Rank_Rich_Ranking": "排名", "hs_Rank_Rich_Wealth": "财富", "hs_Rank_Rich_Ranking_Change": "排名变化", "hs_Rank_Rich_ChaName_Cn": "姓名", "hs_Rank_Rich_ComName_Cn": "企业", "hs_Rank_Rich_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "排名", "财富", "姓名", "企业", "行业", ] ] elif indicator == "胡润全球富豪榜": temp_df.rename( columns={ "hs_Rank_Global_Ranking": "排名", "hs_Rank_Global_Wealth": "财富", "hs_Rank_Global_Ranking_Change": "排名变化", "hs_Rank_Global_ChaName_Cn": "姓名", "hs_Rank_Global_ComName_Cn": "企业", "hs_Rank_Global_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "排名", "财富", "姓名", "企业", "行业", ] ] elif indicator == "胡润印度榜": temp_df.rename( columns={ "hs_Rank_India_Ranking": "排名", "hs_Rank_India_Wealth": "财富", "hs_Rank_India_Ranking_Change": "排名变化", "hs_Rank_India_ChaName_Cn": "姓名", "hs_Rank_India_ComName_Cn": "企业", "hs_Rank_India_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "排名", "财富", "姓名", "企业", "行业", ] ] elif indicator == "胡润全球独角兽榜": temp_df.rename( columns={ "hs_Rank_Unicorn_Ranking": "排名", "hs_Rank_Unicorn_Wealth": "财富", "hs_Rank_Unicorn_Ranking_Change": "排名变化", "hs_Rank_Unicorn_ChaName_Cn": "姓名", "hs_Rank_Unicorn_ComName_Cn": "企业", "hs_Rank_Unicorn_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "排名", "财富", "姓名", "企业", "行业", ] ] elif indicator == "中国瞪羚企业榜": temp_df.rename( columns={ "hs_Rank_CGazelles_ComHeadquarters_Cn": "企业总部", "hs_Rank_CGazelles_Name_Cn": "掌门人/联合创始人", "hs_Rank_CGazelles_ComName_Cn": "企业信息", "hs_Rank_CGazelles_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "企业信息", "掌门人/联合创始人", "企业总部", "行业", ] ] elif indicator == "全球瞪羚企业榜": temp_df.rename( columns={ "hs_Rank_GGazelles_ComHeadquarters_Cn": "企业总部", "hs_Rank_GGazelles_Name_Cn": "掌门人/联合创始人", "hs_Rank_GGazelles_ComName_Cn": "企业信息", "hs_Rank_GGazelles_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "企业信息", "掌门人/联合创始人", "企业总部", "行业", ] ] elif indicator == "胡润Under30s创业领袖榜": temp_df.rename( columns={ "hs_Rank_U30_ComHeadquarters_Cn": "企业总部", "hs_Rank_U30_ChaName_Cn": "姓名", "hs_Rank_U30_ComName_Cn": "企业信息", "hs_Rank_U30_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "姓名", "企业信息", "企业总部", "行业", ] ] elif indicator == "胡润中国500强民营企业": temp_df.rename( columns={ "hs_Rank_CTop500_Ranking": "排名", "hs_Rank_CTop500_Wealth": "企业估值", "hs_Rank_CTop500_Ranking_Change": "排名变化", "hs_Rank_CTop500_ChaName_Cn": "CEO", "hs_Rank_CTop500_ComName_Cn": "企业信息", "hs_Rank_CTop500_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "排名", "排名变化", "企业估值", "企业信息", "CEO", "行业", ] ] elif indicator == "胡润世界500强": temp_df.rename( columns={ "hs_Rank_GTop500_Ranking": "排名", "hs_Rank_GTop500_Wealth": "企业估值", "hs_Rank_GTop500_Ranking_Change": "排名变化", "hs_Rank_GTop500_ChaName_Cn": "CEO", "hs_Rank_GTop500_ComName_Cn": "企业信息", "hs_Rank_GTop500_Industry_Cn": "行业", }, inplace=True, ) temp_df = temp_df[ [ "排名", "排名变化", "企业估值", "企业信息", "CEO", "行业", ] ] elif indicator == "胡润艺术榜": temp_df.rename( columns={ "hs_Rank_Art_Ranking": "排名", "hs_Rank_Art_Turnover": "成交额", "hs_Rank_Art_Ranking_Change": "排名变化", "hs_Rank_Art_Name_Cn": "姓名", "hs_Rank_Art_Age": "年龄", "hs_Rank_Art_ArtCategory_Cn": "艺术类别", }, inplace=True, ) temp_df = temp_df[ [ "排名", "排名变化", "成交额", "姓名", "年龄", "艺术类别", ] ] return temp_df if __name__ == "__main__": hurun_rank_df = hurun_rank(indicator="胡润百富榜", year="2023") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="胡润全球富豪榜", year="2023") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="胡润全球独角兽榜", year="2023") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="胡润印度榜", year="2021") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="全球瞪羚企业榜", year="2021") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="胡润Under30s创业领袖榜", year="2021") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="胡润世界500强", year="2022") print(hurun_rank_df) hurun_rank_df = hurun_rank(indicator="胡润艺术榜", year="2023") print(hurun_rank_df) ================================================ FILE: akshare/fortune/fortune_xincaifu_500.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2022/10/30 21:12 Desc: 新财富 500 人富豪榜 http://www.xcf.cn/zhuanti/ztzz/hdzt1/500frb/index.html """ import json import pandas as pd import requests def xincaifu_rank(year: str = "2022") -> pd.DataFrame: """ 新财富 500 人富豪榜 http://www.xcf.cn/zhuanti/ztzz/hdzt1/500frb/index.html :param year: 具体排名年份, 数据从 2003-至今 :type year: str :return: 排行榜 :rtype: pandas.DataFrame """ url = "http://service.ikuyu.cn/XinCaiFu2/pcremoting/bdListAction.do" params = { "method": "getPage", "callback": "jsonpCallback", "sortBy": "", "order": "", "type": "4", "keyword": "", "pageSize": "1000", "year": year, "pageNo": "1", "from": "jsonp", } r = requests.get(url, params=params) data_text = r.text data_json = json.loads(data_text[data_text.find("{") : -1]) temp_df = pd.DataFrame(data_json["data"]["rows"]) temp_df.columns temp_df.rename( columns={ "assets": "财富", "year": "年份", "sex": "性别", "name": "姓名", "rank": "排名", "company": "主要公司", "industry": "相关行业", "id": "-", "addr": "公司总部", "rankLst": "-", "age": "年龄", }, inplace=True, ) temp_df = temp_df[ [ "排名", "财富", "姓名", "主要公司", "相关行业", "公司总部", "性别", "年龄", "年份", ] ] return temp_df if __name__ == "__main__": xincaifu_rank_df = xincaifu_rank(year="2022") print(xincaifu_rank_df) ================================================ FILE: akshare/fund/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/9/30 13:58 Desc: """ ================================================ FILE: akshare/fund/fund_amac.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/29 16:00 Desc: 中国证券投资基金业协会-信息公示数据 中国证券投资基金业协会-新版: https://gs.amac.org.cn """ import pandas as pd import requests from akshare.utils.tqdm import get_tqdm headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/123.0.0.0 Safari/537.36", "Content-Type": "application/json", } def _get_pages(url: str = "", payload: str = "") -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-私募基金管理人公示 页数 暂时不使用本函数, 直接可以获取所有数据 """ res = requests.post(url=url, json=payload, headers=headers) res.encoding = "utf-8" json_df = res.json() return json_df["totalPages"] def get_data(url: str = "", payload: str = "") -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-私募基金管理人公示 """ res = requests.post(url=url, json=payload, headers=headers) res.encoding = "utf-8" json_df = res.json() return json_df # 中国证券投资基金业协会-信息公示-会员信息 # 中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询 def amac_member_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询 https://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html :return: 会员机构综合查询 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/pofMember" params = { "rand": "0.7665138514630696", "page": "1", "size": "20", } r = requests.post(url, params=params, json={}, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "managerName", "memberBehalf", "memberType", "memberCode", "memberDate", "primaryInvestType", "markStar", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "机构(会员)名称", "会员代表", "会员类型", "会员编号", "入会时间", "机构类型", "是否星标", ] manager_data_out["入会时间"] = pd.to_datetime( manager_data_out["入会时间"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-从业人员信息 # 中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息 def amac_person_fund_org_list(symbol: str = "公募基金管理公司") -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息 https://gs.amac.org.cn/amac-infodisc/res/pof/person/personOrgList.html :param symbol: choice of {"公募基金管理公司", "公募基金管理公司资管子公司", "商业银行", "证券公司", "证券公司子公司", "私募基金管理人", "保险公司子公司", "保险公司", "外包服务机构", "期货公司", "期货公司资管子公司", "媒体机构", "证券投资咨询机构", "评价机构", "外资私募证券基金管理人", "支付结算", "独立服务机构", "地方自律组织", "境外机构", "律师事务所", "会计师事务所", "交易所", "独立第三方销售机构", "证券公司资管子公司", "证券公司私募基金子公司", "其他"} :type symbol: str :return: 基金从业人员资格注册信息 :rtype: pandas.DataFrame """ symbol_map = { "保险公司子公司": "bxgszgs", "期货公司资管子公司": "qhgszgzgs", "公募基金管理公司资管子公司": "gmjjglgszgzgs", "商业银行": "syyh", "交易所": "jys", "证券公司私募基金子公司": "zqgssmjjzgs", "地方自律组织": "dfzlzz", "证券公司": "zqgs", "评价机构": "pjjg", "独立第三方销售机构": "dldsfxsjg", "证券投资咨询机构": "zqtzzxjg", "外资私募证券基金管理人": "wzsmzqjjglr", "境外机构": "jwjg", "证券公司子公司": "zqgszgs", "公募基金管理公司": "gmjjglgs", "媒体机构": "mtjg", "支付结算": "zfjs", "证券公司资管子公司": "zqgszgzgs", "会计师事务所": "kjssws", "独立服务机构": "dlfwjg", "律师事务所": "lssws", "期货公司": "qhgs", "保险公司": "bxgs", "其他": "qt", "外包服务机构": "wbfwjg", "私募基金管理人": "smjjglr", } url = "https://gs.amac.org.cn/amac-infodisc/api/pof/personOrg" params = { "rand": "0.7665138514630696", "page": "1", "size": "20", } r = requests.post( url, params=params, json={"orgType": symbol_map[symbol], "page": "1"}, headers=headers, ) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post( url, params=params, json={"orgType": symbol_map[symbol], "page": "1"}, verify=False, headers=headers, ) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "orgName", "orgType", "workerTotalNum", "operNum", "salesmanNum", "investmentManagerNum", "fundManagerNum", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.reset_index(inplace=True) manager_data_out["index"] = manager_data_out.index + 1 manager_data_out.columns = [ "序号", "机构名称", "机构类型", "员工人数", "基金从业资格", "基金销售业务资格", "基金经理", "投资经理", ] manager_data_out["员工人数"] = pd.to_numeric(manager_data_out["员工人数"]) manager_data_out["基金从业资格"] = pd.to_numeric(manager_data_out["基金从业资格"]) manager_data_out["基金销售业务资格"] = pd.to_numeric( manager_data_out["基金销售业务资格"] ) manager_data_out["基金经理"] = pd.to_numeric(manager_data_out["基金经理"]) manager_data_out["投资经理"] = pd.to_numeric(manager_data_out["投资经理"]) return manager_data_out # 中国证券投资基金业协会-信息公示-从业人员信息-债券投资交易相关人员公示 def amac_person_bond_org_list() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-从业人员信息-债券投资交易相关人员公示 https://human.amac.org.cn/web/org/personPublicity.html :return: 债券投资交易相关人员公示 :rtype: pandas.DataFrame """ import urllib3 import ssl ctx = ssl.create_default_context() ctx.options |= ssl.OP_LEGACY_SERVER_CONNECT # 使用自定义的 SSL 上下文发起 HTTPS 请求 http = urllib3.PoolManager(ssl_context=ctx) url = "https://human.amac.org.cn/web/api/publicityAddress?rand=0.6288001872566391&pageNum=1&pageSize=5000" r = http.request(method="GET", url=url) data_json = r.json() temp_df = pd.DataFrame(data_json["list"]) temp_df.reset_index(inplace=True) temp_df["index"] = range(1, len(temp_df) + 1) temp_df.columns = [ "序号", "_", "_", "机构名称", "机构类型", "公示网址", ] temp_df = temp_df[ [ "序号", "机构类型", "机构名称", "公示网址", ] ] return temp_df # 中国证券投资基金业协会-信息公示-私募基金管理人公示 # 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询 def amac_manager_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询 https://gs.amac.org.cn/amac-infodisc/res/pof/manager/index.html :return: 私募基金管理人综合查询 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/manager" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "managerName", "artificialPersonName", "primaryInvestType", "registerProvince", "registerNo", "establishDate", "registerDate", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "私募基金管理人名称", "法定代表人/执行事务合伙人(委派代表)姓名", "机构类型", "注册地", "登记编号", "成立时间", "登记时间", ] manager_data_out["成立时间"] = pd.to_datetime( manager_data_out["成立时间"], unit="ms" ).dt.date manager_data_out["登记时间"] = pd.to_datetime( manager_data_out["登记时间"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示 def amac_manager_classify_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示 https://gs.amac.org.cn/amac-infodisc/res/pof/manager/managerList.html :return: 私募基金管理人分类公示 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/manager" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "managerName", "artificialPersonName", "primaryInvestType", "registerNo", "registerProvince", "officeAdrAgg", "establishDate", "registerDate", "fundCount", "memberType", "hasSpecialTips", "hasCreditTips", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "私募基金管理人名称", "法定代表人/执行事务合伙人(委派代表)姓名", "机构类型", "登记编号", "注册地", "办公地", "成立时间", "登记时间", "在管基金数量", "会员类型", "是否有提示信息", "是否有诚信信息", ] manager_data_out["成立时间"] = pd.to_datetime( manager_data_out["成立时间"], unit="ms" ).dt.date manager_data_out["登记时间"] = pd.to_datetime( manager_data_out["登记时间"], unit="ms" ).dt.date manager_data_out["在管基金数量"] = pd.to_numeric(manager_data_out["在管基金数量"]) manager_data_out["是否有提示信息"] = manager_data_out["是否有提示信息"].map( {True: "是", False: "否"} ) manager_data_out["是否有诚信信息"] = manager_data_out["是否有诚信信息"].map( {True: "是", False: "否"} ) return manager_data_out # 中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示 def amac_member_sub_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示 https://gs.amac.org.cn/amac-infodisc/res/pof/member/index.html?primaryInvestType=private :return: 证券公司私募基金子公司管理人信息公示 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/pofMember" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "managerName", "memberBehalf", "memberType", "memberCode", "memberDate", "primaryInvestType", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "机构(会员)名称", "会员代表", "会员类型", "会员编号", "入会时间", "公司类型", ] manager_data_out["入会时间"] = pd.to_datetime( manager_data_out["入会时间"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-基金产品 # 中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品 def amac_fund_info(start_page: str = "1", end_page: str = "2000") -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品 https://gs.amac.org.cn/amac-infodisc/res/pof/fund/index.html :param start_page: 开始页码, 获取指定页码直接的数据 :type start_page: str :param end_page: 结束页码, 获取指定页码直接的数据 :type end_page: str :return: 私募基金管理人基金产品 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/fund" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = int(data_json["totalPages"]) if total_page > int(end_page): real_end_page = int(end_page) else: real_end_page = total_page big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(int(start_page) - 1, real_end_page), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "fundName", "managerName", "managerType", "workingState", "putOnRecordDate", "establishDate", "mandatorName", ] # 定义要取的 value 的 keys manager_data_out = big_df[keys_list].copy() manager_data_out.columns = [ "基金名称", "私募基金管理人名称", "私募基金管理人类型", "运行状态", "备案时间", "建立时间", "托管人名称", ] manager_data_out["建立时间"] = pd.to_datetime( manager_data_out["建立时间"], unit="ms" ).dt.date manager_data_out["备案时间"] = pd.to_datetime( manager_data_out["备案时间"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-基金产品-证券公司集合资管产品公示 def amac_securities_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品公示-证券公司集合资管产品公示 https://gs.amac.org.cn/amac-infodisc/res/pof/securities/index.html :return: 证券公司集合资管产品公示 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/securities" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "cpmc", "cpbm", "gljg", "slrq", "dqr", "tzlx", "sffj", "tgjg", "barq", "yzzt", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "产品名称", "产品编码", "管理人名称", "成立日期", "到期时间", "投资类型", "是否分级", "托管人名称", "备案日期", "运作状态", ] return manager_data_out # 中国证券投资基金业协会-信息公示-基金产品-证券公司直投基金 def amac_aoin_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品公示-证券公司直投基金 https://gs.amac.org.cn/amac-infodisc/res/aoin/product/index.html :return: 证券公司直投基金 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/aoin/product" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "code", "name", "aoinName", "managerName", "createDate", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "产品编码", "产品名称", "直投子公司", "管理机构", "设立日期", ] manager_data_out["设立日期"] = pd.to_datetime( manager_data_out["设立日期"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金 def amac_fund_sub_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金 https://gs.amac.org.cn/amac-infodisc/res/pof/subfund/index.html :return: 证券公司私募投资基金 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/subfund" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "productCode", "productName", "mgrName", "trustee", "foundDate", "registeredDate", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "产品编码", "产品名称", "私募基金管理人名称", "托管人名称", "成立日期", "备案日期", ] manager_data_out["备案日期"] = pd.to_datetime( manager_data_out["备案日期"], unit="ms" ).dt.date manager_data_out["成立日期"] = pd.to_datetime( manager_data_out["成立日期"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示 def amac_fund_account_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示 https://gs.amac.org.cn/amac-infodisc/res/fund/account/index.html :return: 基金公司及子公司集合资管产品公示 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings(action="ignore", category=FutureWarning) url = "https://gs.amac.org.cn/amac-infodisc/api/fund/account" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "registerDate", "registerCode", "name", "manager", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "成立日期", "产品编码", "产品名称", "管理人名称", ] manager_data_out["成立日期"] = pd.to_datetime( manager_data_out["成立日期"], unit="ms" ).dt.date return manager_data_out # 中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划 def amac_fund_abs() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划公示信息 https://gs.amac.org.cn/amac-infodisc/res/fund/abs/index.html :return: 资产支持专项计划公示信息 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/fund/abs" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = range(1, len(big_df) + 1) big_df.columns = [ "编号", "_", "_", "专项计划全称", "备案编号", "管理人", "托管人", "备案通过时间", "成立日期", "预期到期时间", ] big_df["备案通过时间"] = pd.to_datetime(big_df["备案通过时间"], unit="ms").dt.date big_df["成立日期"] = pd.to_datetime(big_df["成立日期"], unit="ms").dt.date big_df["预期到期时间"] = pd.to_datetime( big_df["预期到期时间"], unit="ms", errors="coerce" ).dt.date big_df = big_df[ [ "编号", "备案编号", "专项计划全称", "管理人", "托管人", "成立日期", "预期到期时间", "备案通过时间", ] ] return big_df # 中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示 def amac_futures_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示 https://gs.amac.org.cn/amac-infodisc/res/pof/futures/index.html :return: 期货公司集合资管产品公示 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/pof/futures" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "mpiName", "mpiProductCode", "aoiName", "mpiTrustee", "mpiCreateDate", "tzlx", "sfjgh", "registeredDate", "dueDate", "fundStatus", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "产品名称", "产品编码", "管理人名称", "托管人名称", "成立日期", "投资类型", "是否分级", "备案日期", "到期日", "运作状态", ] return manager_data_out # 中国证券投资基金业协会-信息公示-诚信信息 # 中国证券投资基金业协会-信息公示-诚信信息-已注销私募基金管理人名单 def amac_manager_cancelled_info() -> pd.DataFrame: """ 中国证券投资基金业协会-信息公示-诚信信息公示-已注销私募基金管理人名单 https://gs.amac.org.cn/amac-infodisc/res/cancelled/manager/index.html 主动注销: 100 依公告注销: 200 协会注销: 300 :return: 已注销私募基金管理人名单 :rtype: pandas.DataFrame """ url = "https://gs.amac.org.cn/amac-infodisc/api/cancelled/manager" params = { "rand": "0.7665138514630696", "page": "1", "size": "100", } r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() total_page = data_json["totalPages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(0, int(total_page)), leave=False): params.update({"page": page}) r = requests.post(url, params=params, json={}, verify=False, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["content"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) keys_list = [ "orgName", "orgCode", "orgSignDate", "cancelDate", "status", ] # 定义要取的 value 的 keys manager_data_out = pd.DataFrame(big_df) manager_data_out = manager_data_out[keys_list] manager_data_out.columns = [ "管理人名称", "统一社会信用代码", "登记时间", "注销时间", "注销类型", ] manager_data_out["登记时间"] = pd.to_datetime( manager_data_out["登记时间"], unit="ms" ).dt.date manager_data_out["注销时间"] = pd.to_datetime( manager_data_out["注销时间"], unit="ms" ).dt.date manager_data_out.sort_values(["注销时间"], ignore_index=True, inplace=True) return manager_data_out if __name__ == "__main__": # 中国证券投资基金业协会-信息公示-会员信息 # 中国证券投资基金业协会-信息公示-会员信息-会员机构综合查询 amac_member_info_df = amac_member_info() print(amac_member_info_df) # 中国证券投资基金业协会-信息公示-从业人员信息 # 中国证券投资基金业协会-信息公示-从业人员信息-基金从业人员资格注册信息 amac_person_fund_org_list_df = amac_person_fund_org_list(symbol="公募基金管理公司") print(amac_person_fund_org_list_df) # 中国证券投资基金业协会-信息公示-从业人员信息 # 中国证券投资基金业协会-信息公示-从业人员信息-债券投资交易相关人员公示 amac_person_bond_org_list_df = amac_person_bond_org_list() print(amac_person_bond_org_list_df) # 中国证券投资基金业协会-信息公示-私募基金管理人公示 # 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人综合查询 amac_manager_info_df = amac_manager_info() print(amac_manager_info_df) # 中国证券投资基金业协会-信息公示-私募基金管理人公示-私募基金管理人分类公示 amac_manager_classify_info_df = amac_manager_classify_info() print(amac_manager_classify_info_df) # 中国证券投资基金业协会-信息公示-私募基金管理人公示-证券公司私募基金子公司管理人信息公示 amac_member_sub_info_df = amac_member_sub_info() print(amac_member_sub_info_df) # 中国证券投资基金业协会-信息公示-基金产品 # 中国证券投资基金业协会-信息公示-基金产品-私募基金管理人基金产品 amac_fund_info_df = amac_fund_info(start_page="1", end_page="100") print(amac_fund_info_df) example_df = amac_fund_info_df[ amac_fund_info_df["私募基金管理人名称"].str.contains("聚宽") ] print(example_df) # 中国证券投资基金业协会-信息公示-基金产品-证券公司集合资管产品公示 amac_securities_info_df = amac_securities_info() print(amac_securities_info_df) # 中国证券投资基金业协会-信息公示-基金产品-证券公司直投基金 amac_aoin_info_df = amac_aoin_info() print(amac_aoin_info_df) # 中国证券投资基金业协会-信息公示-基金产品公示-证券公司私募投资基金 amac_fund_sub_info_df = amac_fund_sub_info() print(amac_fund_sub_info_df) # 中国证券投资基金业协会-信息公示-基金产品公示-基金公司及子公司集合资管产品公示 amac_fund_account_info_df = amac_fund_account_info() print(amac_fund_account_info_df) # 中国证券投资基金业协会-信息公示-基金产品公示-资产支持专项计划 amac_fund_abs_df = amac_fund_abs() print(amac_fund_abs_df) # 中国证券投资基金业协会-信息公示-基金产品公示-期货公司集合资管产品公示 amac_futures_info_df = amac_futures_info() print(amac_futures_info_df) # 中国证券投资基金业协会-信息公示-诚信信息 # 中国证券投资基金业协会-信息公示-诚信信息-已注销私募基金管理人名单 amac_manager_cancelled_info_df = amac_manager_cancelled_info() print(amac_manager_cancelled_info_df) ================================================ FILE: akshare/fund/fund_announcement_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/9/20 17:40 Desc: 东方财富网站-天天基金网-基金档案-基金公告 https://fundf10.eastmoney.com/jjgg_000001.html """ import time import pandas as pd import requests def fund_announcement_dividend_em(symbol: str = "000001") -> pd.DataFrame: """ 东方财富网站-天天基金网-基金档案-基金公告-分红配送 https://fundf10.eastmoney.com/jjgg_000001_2.html :param symbol: 基金代码; 可以通过调用 ak.fund_name_em() 接口获取 :type symbol: str :return: 分红配送-公告列表 :rtype: pandas.DataFrame """ url = "http://api.fund.eastmoney.com/f10/JJGG" headers = { "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", "Referer": f"http://fundf10.eastmoney.com/jjgg_{symbol}_2.html", } params = { "fundcode": symbol, "pageIndex": "1", "pageSize": "1000", "type": "2", "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]) temp_df.columns = [ "基金代码", "公告标题", "基金名称", "_", "_", "公告日期", "_", "报告ID", ] temp_df = temp_df[["基金代码", "公告标题", "基金名称", "公告日期", "报告ID"]] temp_df.sort_values(by=["公告日期"], inplace=True, ignore_index=True) temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"], errors="coerce").dt.date return temp_df def fund_announcement_report_em(symbol: str = "000001") -> pd.DataFrame: """ 东方财富网站-天天基金网-基金档案-基金公告-定期报告 https://fundf10.eastmoney.com/jjgg_000001_3.html :param symbol: 基金代码; 可以通过调用 ak.fund_name_em() 接口获取 :type symbol: str :return: 定期报告-公告列表 :rtype: pandas.DataFrame """ url = "http://api.fund.eastmoney.com/f10/JJGG" headers = { "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", "Referer": f"http://fundf10.eastmoney.com/jjgg_{symbol}_3.html", } params = { "fundcode": symbol, "pageIndex": "1", "pageSize": "1000", "type": "3", "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]) temp_df.columns = [ "基金代码", "公告标题", "基金名称", "_", "_", "公告日期", "_", "报告ID", ] temp_df = temp_df[["基金代码", "公告标题", "基金名称", "公告日期", "报告ID"]] temp_df.sort_values(by=["公告日期"], inplace=True, ignore_index=True) temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"], errors="coerce").dt.date return temp_df def fund_announcement_personnel_em(symbol: str = "000001") -> pd.DataFrame: """ 东方财富网站-天天基金网-基金档案-基金公告-人事调整 https://fundf10.eastmoney.com/jjgg_000001_4.html :param symbol: 基金代码; 可以通过调用 ak.fund_name_em() 接口获取 :type symbol: str :return: 人事调整-公告列表 :rtype: pandas.DataFrame """ url = "http://api.fund.eastmoney.com/f10/JJGG" headers = { "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", "Referer": f"http://fundf10.eastmoney.com/jjgg_{symbol}_4.html", } params = { "fundcode": symbol, "pageIndex": "1", "pageSize": "1000", "type": "4", "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]) temp_df.columns = [ "基金代码", "公告标题", "基金名称", "_", "_", "公告日期", "_", "报告ID", ] temp_df = temp_df[["基金代码", "公告标题", "基金名称", "公告日期", "报告ID"]] temp_df.sort_values(by=["公告日期"], inplace=True, ignore_index=True) temp_df["公告日期"] = pd.to_datetime(temp_df["公告日期"], errors="coerce").dt.date return temp_df if __name__ == "__main__": fund_announcement_dividend_em_df = fund_announcement_dividend_em(symbol="000001") print(fund_announcement_dividend_em_df) fund_announcement_report_em_df = fund_announcement_report_em(symbol="000001") print(fund_announcement_report_em_df) fund_announcement_personnel_em_df = fund_announcement_personnel_em(symbol="000001") print(fund_announcement_personnel_em_df) ================================================ FILE: akshare/fund/fund_aum_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/11/11 16:30 Desc: 东方财富-基金 """ from io import StringIO import pandas as pd import requests def fund_aum_em() -> pd.DataFrame: """ 东方财富-基金-基金公司排名列表 https://fund.eastmoney.com/Company/lsgm.html :return: 基金公司排名列表 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Company/home/gspmlist" params = {"fundType": "0"} r = requests.get(url, params=params) temp_df = pd.read_html(StringIO(r.text))[0] del temp_df["相关链接"] del temp_df["天相评级"] temp_df.columns = [ "序号", "基金公司", "成立时间", "全部管理规模", "全部基金数", "全部经理数", ] expanded_df = temp_df["全部管理规模"].str.split(" ", expand=True) temp_df["全部管理规模"] = expanded_df.iloc[:, 0].str.replace(",", "") temp_df["更新日期"] = expanded_df.iloc[:, 1] 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") temp_df["成立时间"] = pd.to_datetime(temp_df["成立时间"], errors="coerce").dt.date return temp_df def fund_aum_trend_em() -> pd.DataFrame: """ 东方财富-基金-基金市场管理规模走势图 https://fund.eastmoney.com/Company/default.html :return: 基金市场管理规模走势图 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Company/home/GetFundTotalScaleForChart" payload = {"fundType": "0"} r = requests.get(url, data=payload) data_json = r.json() temp_df = pd.DataFrame() temp_df["date"] = data_json["x"] temp_df["value"] = data_json["y"] temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date temp_df["value"] = pd.to_numeric(temp_df["value"], errors="coerce") return temp_df def fund_aum_hist_em(year: str = "2023") -> pd.DataFrame: """ 东方财富-基金-基金公司历年管理规模排行列表 https://fund.eastmoney.com/Company/lsgm.html :param year: query year :type year: str :return: 基金公司历年管理规模排行列表 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Company/home/HistoryScaleTable" params = {"year": year} r = requests.get(url, params=params) temp_df = pd.read_html(StringIO(r.text))[0] temp_df.columns = [ "序号", "基金公司", "总规模", "股票型", "混合型", "债券型", "指数型", "QDII", "货币型", ] 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") temp_df["债券型"] = pd.to_numeric(temp_df["债券型"], errors="coerce") temp_df["指数型"] = pd.to_numeric(temp_df["指数型"], errors="coerce") temp_df["QDII"] = pd.to_numeric(temp_df["QDII"], errors="coerce") temp_df["货币型"] = pd.to_numeric(temp_df["货币型"], errors="coerce") return temp_df if __name__ == "__main__": fund_aum_em_df = fund_aum_em() print(fund_aum_em_df) fund_aum_trend_em_df = fund_aum_trend_em() print(fund_aum_trend_em_df) fund_em_aum_hist_df = fund_aum_hist_em(year="2023") print(fund_em_aum_hist_df) ================================================ FILE: akshare/fund/fund_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/1/20 17:00 Desc: 东方财富网站-天天基金网-基金数据-开放式基金净值 https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc 1.基金经理基本数据, 建议包含:基金经理代码,基金经理姓名,从业起始日期,现任基金公司,管理资产总规模,上述数据可在"基金经理列表: https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc 和 "基金经理理档案如:https://fund.eastmoney.com/manager/30040164.html 获取. 2.基金经理任职数据:可调取全部或特定经理,管理的基金数据,建议包含:基金经理代码,基金经理姓名,基金代码,基金简称, 经理位次(在当前基金的经理中排第几位),起始任职时间,截止任职时间,任职回报.在特定基金的经理信息中可以获取如: https://fundf10.eastmoney.com/jjjl_001810.html 3.在接口:fund_basic"公募基金列表"增加数据"基金经理代码"(或第一基金经理代码), "基金经理姓名"(或第一基金经理姓名),"当前基金经理人数","当前经理任职起始时间". 用户ID:269993 """ import json import math import time from io import StringIO import pandas as pd import py_mini_racer import requests from akshare.utils import demjson from akshare.utils.cons import headers from akshare.utils.tqdm import get_tqdm def fund_purchase_em() -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-基金申购状态 https://fund.eastmoney.com/Fund_sgzt_bzdm.html#fcode,asc_1 :return: 基金申购状态 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx" params = { "t": "8", "page": "1,50000", "js": "reData", "sort": "fcode,asc", } r = requests.get(url, params=params, headers=headers) data_text = r.text data_json = demjson.decode(data_text.strip("var reData=")) temp_df = pd.DataFrame(data_json["datas"]) temp_df.reset_index(inplace=True) temp_df["index"] = temp_df.index + 1 temp_df.columns = [ "序号", "基金代码", "基金简称", "基金类型", "最新净值/万份收益", "最新净值/万份收益-报告时间", "申购状态", "赎回状态", "下一开放日", "购买起点", "日累计限定金额", "-", "-", "手续费", ] temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "基金类型", "最新净值/万份收益", "最新净值/万份收益-报告时间", "申购状态", "赎回状态", "下一开放日", "购买起点", "日累计限定金额", "手续费", ] ] 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" ) temp_df["手续费"] = temp_df["手续费"].str.strip("%") temp_df["手续费"] = pd.to_numeric(temp_df["手续费"], errors="coerce") return temp_df def fund_name_em() -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-所有基金的名称和类型 https://fund.eastmoney.com/manager/default.html#dt14;mcreturnjson;ftall;pn20;pi1;scabbname;stasc :return: 所有基金的名称和类型 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/js/fundcode_search.js" r = requests.get(url, headers=headers) text_data = r.text data_json = demjson.decode(text_data.strip("var r = ")[:-1]) temp_df = pd.DataFrame(data_json) temp_df.columns = ["基金代码", "拼音缩写", "基金简称", "基金类型", "拼音全称"] return temp_df def fund_info_index_em( symbol: str = "沪深指数", indicator: str = "被动指数型" ) -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-基金信息-指数型 https://fund.eastmoney.com/trade/zs.html :param symbol: choice of {"全部", "沪深指数", "行业主题", "大盘指数", "中盘指数", "小盘指数", "股票指数", "债券指数"} :type symbol: str :param indicator: choice of {"全部", "被动指数型", "增强指数型"} :type indicator: str :return: 基金信息-指数型 :rtype: pandas.DataFrame """ symbol_map = { "全部": "", "沪深指数": "053", "行业主题": "054", "大盘指数": "01", "中盘指数": "02", "小盘指数": "03", "股票指数": "050|001", "债券指数": "050|003", } indicator_map = { "全部": "", "被动指数型": "051", "增强指数型": "052", } url = "https://api.fund.eastmoney.com/FundTradeRank/GetRankList" if symbol in {"股票指数", "债券指数"}: params = { "ft": "zs", "sc": "1n", "st": "desc", "pi": "1", "pn": "10000", "cp": "", "ct": "", "cd": "", "ms": "", "fr": symbol_map[symbol].split("|")[0], "plevel": "", "fst": "", "ftype": symbol_map[symbol].split("|")[1], "fr1": indicator_map[indicator], "fl": "0", "isab": "1", } else: params = { "ft": "zs", "sc": "1n", "st": "desc", "pi": "1", "pn": "10000", "cp": "", "ct": "", "cd": "", "ms": "", "fr": symbol_map[symbol].split("|")[0], "plevel": "", "fst": "", "ftype": "", "fr1": indicator_map[indicator], "fl": "0", "isab": "1", } headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Host": "api.fund.eastmoney.com", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "https://fund.eastmoney.com/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/103.0.0.0 Safari/537.36", } r = requests.get(url, params=params, headers=headers) data_json = r.json() data_json = json.loads(data_json["Data"]) temp_df = pd.DataFrame([item.split("|") for item in data_json["datas"]]) temp_df.columns = [ "基金代码", "基金名称", "-", "日期", "单位净值", "日增长率", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "-", "-", "-", "手续费", "-", "-", "-", "-", "-", "起购金额", "-", "-", "-", "-", ] temp_df = temp_df[ [ "基金代码", "基金名称", "单位净值", "日期", "日增长率", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "手续费", "起购金额", ] ] temp_df["跟踪标的"] = symbol temp_df["跟踪方式"] = indicator temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce") temp_df["近1周"] = pd.to_numeric(temp_df["近1周"], errors="coerce") temp_df["近1月"] = pd.to_numeric(temp_df["近1月"], errors="coerce") temp_df["近3月"] = pd.to_numeric(temp_df["近3月"], errors="coerce") temp_df["近6月"] = pd.to_numeric(temp_df["近6月"], errors="coerce") temp_df["近1年"] = pd.to_numeric(temp_df["近1年"], errors="coerce") temp_df["近2年"] = pd.to_numeric(temp_df["近2年"], errors="coerce") temp_df["近3年"] = pd.to_numeric(temp_df["近3年"], errors="coerce") 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") return temp_df def fund_open_fund_daily_em() -> pd.DataFrame: """ 东方财富网-天天基金网-基金数据-开放式基金净值 https://fund.eastmoney.com/fund.html#os_0;isall_0;ft_;pt_1 :return: 当前交易日的所有开放式基金净值数据 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx" params = { "t": "1", "lx": "1", "letter": "", "gsid": "", "text": "", "sort": "zdf,desc", "page": "1,50000", "dt": "1580914040623", "atfc": "", "onlySale": "0", } res = requests.get(url, params=params, headers=headers) text_data = res.text data_json = demjson.decode(text_data.strip("var db=")) temp_df = pd.DataFrame(data_json["datas"]) show_day = data_json["showday"] temp_df.columns = [ "基金代码", "基金简称", "-", f"{show_day[0]}-单位净值", f"{show_day[0]}-累计净值", f"{show_day[1]}-单位净值", f"{show_day[1]}-累计净值", "日增长值", "日增长率", "申购状态", "赎回状态", "-", "-", "-", "-", "-", "-", "手续费", "-", "-", "-", ] data_df = temp_df[ [ "基金代码", "基金简称", f"{show_day[0]}-单位净值", f"{show_day[0]}-累计净值", f"{show_day[1]}-单位净值", f"{show_day[1]}-累计净值", "日增长值", "日增长率", "申购状态", "赎回状态", "手续费", ] ] return data_df def fund_open_fund_info_em( symbol: str = "710001", indicator: str = "单位净值走势", period: str = "成立来" ) -> pd.DataFrame: """ 东方财富网-天天基金网-基金数据-开放式基金净值 https://fund.eastmoney.com/fund.html :param symbol: 基金代码; 可以通过调用 ak.fund_open_fund_daily_em() 获取所有开放式基金代码 :type symbol: str :param indicator: 需要获取的指标 :type indicator: str :param period: "成立来"; choice of {"1月", "3月", "6月", "1年", "3年", "5年", "今年来", "成立来"} :type period: str :return: 指定基金指定指标的数据 :rtype: pandas.DataFrame """ from akshare.utils.cons import headers url = f"https://fund.eastmoney.com/pingzhongdata/{symbol}.js" # 各类数据都在里面 r = requests.get(url, headers=headers) data_text = r.text js_code = py_mini_racer.MiniRacer() js_code.eval(data_text) # 单位净值走势 if indicator == "单位净值走势": data_json = js_code.execute("Data_netWorthTrend") temp_df = pd.DataFrame(data_json) if temp_df.empty: return pd.DataFrame() temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert( "Asia/Shanghai" ) temp_df["x"] = temp_df["x"].dt.date temp_df.columns = [ "净值日期", "单位净值", "日增长率", "_", ] temp_df = temp_df[ [ "净值日期", "单位净值", "日增长率", ] ] 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") return temp_df # 累计净值走势 if indicator == "累计净值走势": data_json = js_code.execute("Data_ACWorthTrend") temp_df = pd.DataFrame(data_json) if temp_df.empty: return pd.DataFrame() temp_df.columns = ["x", "y"] temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert( "Asia/Shanghai" ) temp_df["x"] = temp_df["x"].dt.date temp_df.columns = [ "净值日期", "累计净值", ] temp_df = temp_df[ [ "净值日期", "累计净值", ] ] temp_df["净值日期"] = pd.to_datetime( temp_df["净值日期"], errors="coerce" ).dt.date temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"], errors="coerce") return temp_df # 每万份收益 if indicator == "每万份收益": data_json = js_code.execute("Data_millionCopiesIncome") temp_df = pd.DataFrame(data_json) if temp_df.empty: return pd.DataFrame() temp_df.columns = ["x", "y"] temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert( "Asia/Shanghai" ) temp_df["x"] = temp_df["x"].dt.date temp_df.columns = [ "净值日期", "每万份收益", ] temp_df = temp_df[ [ "净值日期", "每万份收益", ] ] temp_df["净值日期"] = pd.to_datetime( temp_df["净值日期"], errors="coerce" ).dt.date temp_df["每万份收益"] = pd.to_numeric(temp_df["每万份收益"], errors="coerce") return temp_df # 7日年化收益率 if indicator == "7日年化收益率": data_json = js_code.execute("Data_sevenDaysYearIncome") temp_df = pd.DataFrame(data_json) if temp_df.empty: return pd.DataFrame() temp_df.columns = ["x", "y"] temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert( "Asia/Shanghai" ) temp_df["x"] = temp_df["x"].dt.date temp_df.columns = [ "净值日期", "7日年化收益率", ] temp_df = temp_df[ [ "净值日期", "7日年化收益率", ] ] temp_df["净值日期"] = pd.to_datetime( temp_df["净值日期"], errors="coerce" ).dt.date temp_df["7日年化收益率"] = pd.to_numeric( temp_df["7日年化收益率"], errors="coerce" ) return temp_df # 累计收益率走势 if indicator == "累计收益率走势": url = "https://api.fund.eastmoney.com/pinzhong/LJSYLZS" headers = {"Referer": "https://fund.eastmoney.com/"} period_map = { "1月": "m", "3月": "q", "6月": "hy", "1年": "y", "3年": "try", "5年": "fiy", "今年来": "sy", "成立来": "se", } params = { "fundCode": symbol, "indexcode": "000300", "type": period_map[period], } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"][0]["data"]) temp_df.columns = ["日期", "累计收益率"] temp_df["日期"] = pd.to_datetime( temp_df["日期"], unit="ms", utc=True ).dt.tz_convert("Asia/Shanghai") temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["累计收益率"] = pd.to_numeric(temp_df["累计收益率"], errors="coerce") return temp_df # 同类排名走势 if indicator == "同类排名走势": data_json = js_code.execute("Data_rateInSimilarType") temp_df = pd.DataFrame(data_json) temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert( "Asia/Shanghai" ) temp_df["x"] = temp_df["x"].dt.date temp_df.columns = [ "报告日期", "同类型排名-每日近三月排名", "总排名-每日近三月排名", ] temp_df = temp_df[ [ "报告日期", "同类型排名-每日近三月排名", "总排名-每日近三月排名", ] ] 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" ) return temp_df # 同类排名百分比 if indicator == "同类排名百分比": data_json = js_code.execute("Data_rateInSimilarPersent") temp_df = pd.DataFrame(data_json) temp_df.columns = ["x", "y"] temp_df["x"] = pd.to_datetime(temp_df["x"], unit="ms", utc=True).dt.tz_convert( "Asia/Shanghai" ) temp_df["x"] = temp_df["x"].dt.date temp_df.columns = [ "报告日期", "同类型排名-每日近3月收益排名百分比", ] temp_df = temp_df[ [ "报告日期", "同类型排名-每日近3月收益排名百分比", ] ] temp_df["报告日期"] = pd.to_datetime( temp_df["报告日期"], errors="coerce" ).dt.date temp_df["同类型排名-每日近3月收益排名百分比"] = pd.to_numeric( temp_df["同类型排名-每日近3月收益排名百分比"], errors="coerce" ) return temp_df # 分红送配详情 if indicator == "分红送配详情": url = f"https://fundf10.eastmoney.com/fhsp_{symbol}.html" r = requests.get(url, headers=headers) table_num = len(pd.read_html(StringIO(r.text))) if table_num == 3: temp_df = pd.read_html(StringIO(r.text))[1] else: temp_df = pd.read_html(StringIO(r.text))[0] if temp_df.iloc[0, 1] == "暂无分红信息!": return pd.DataFrame() else: return temp_df # 拆分详情 if indicator == "拆分详情": url = f"https://fundf10.eastmoney.com/fhsp_{symbol}.html" r = requests.get(url, headers=headers) table_num = len(pd.read_html(StringIO(r.text))) if table_num == 3: temp_df = pd.read_html(StringIO(r.text))[2] else: temp_df = pd.read_html(StringIO(r.text))[1] if temp_df.iloc[0, 1] == "暂无拆分信息!": return pd.DataFrame() else: return temp_df return pd.DataFrame() def fund_money_fund_daily_em() -> pd.DataFrame: """ 东方财富网-天天基金网-基金数据-货币型基金收益 https://fund.eastmoney.com/HBJJ_pjsyl.html :return: 当前交易日的所有货币型基金收益数据 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/HBJJ_pjsyl.html" r = requests.get(url, headers=headers) r.encoding = "gb2312" show_day = pd.read_html(StringIO(r.text))[1].iloc[0, 5:11].tolist() temp_df = pd.read_html(StringIO(r.text))[1].iloc[1:, 2:] temp_df_columns = temp_df.iloc[0, :].tolist()[1:] temp_df = temp_df.iloc[1:, 1:] temp_df.columns = temp_df_columns temp_df["基金简称"] = temp_df["基金简称"].str.strip("基金吧档案") temp_df.columns = [ "基金代码", "基金简称", f"{show_day[0]}-万份收益", f"{show_day[1]}-7日年化%", f"{show_day[2]}-单位净值", f"{show_day[3]}-万份收益", f"{show_day[4]}-7日年化%", f"{show_day[5]}-单位净值", "日涨幅", "成立日期", "基金经理", "手续费", "可购全部", ] return temp_df def fund_money_fund_info_em(symbol: str = "000009") -> pd.DataFrame: """ 东方财富网-天天基金网-基金数据-货币型基金收益-历史净值数据 https://fundf10.eastmoney.com/jjjz_004186.html :param symbol: 货币型基金代码, 可以通过 fund_money_fund_daily_em 来获取 :type symbol: str :return: 东方财富网站-天天基金网-基金数据-货币型基金收益-历史净值数据 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/f10/lsjz" headers = { "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", "Referer": f"https://fundf10.eastmoney.com/jjjz_{symbol}.html", "Host": "api.fund.eastmoney.com", } params = { "fundCode": symbol, "pageIndex": "1", "pageSize": "20", "startDate": "", "endDate": "", "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) data_json = r.json() total_page = math.ceil(int(data_json["TotalCount"]) / 20) tqdm = get_tqdm() big_list = [] for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageIndex": page}) r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]["LSJZList"]) big_list.append(temp_df) big_df = pd.concat(big_list, ignore_index=True) big_df.columns = [ "净值日期", "每万份收益", "7日年化收益率", "_", "_", "_", "_", "申购状态", "赎回状态", "_", "_", "_", "_", ] big_df.sort_values(by=["净值日期"], inplace=True, ignore_index=True) big_df = big_df[["净值日期", "每万份收益", "7日年化收益率", "申购状态", "赎回状态"]] big_df["净值日期"] = pd.to_datetime(big_df["净值日期"], errors="coerce").dt.date big_df["每万份收益"] = pd.to_numeric(big_df["每万份收益"], errors="coerce") big_df["7日年化收益率"] = pd.to_numeric(big_df["7日年化收益率"], errors="coerce") return big_df def fund_financial_fund_daily_em() -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-理财型基金收益 # 该接口暂无数据 https://fund.eastmoney.com/lcjj.html#1_1__0__ljjz,desc_1_os1 :return: 当前交易日的所有理财型基金收益 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/FundNetValue/GetLCJJJZ" headers = { "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", "Referer": "https://fund.eastmoney.com/lcjj.html", } params = { "letter": "", "jjgsid": "0", "searchtext": "", "sort": "ljjz,desc", "page": "1,100", "AttentionCodes": "", "cycle": "", "OnlySale": "1", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]["List"]) if temp_df.empty: return pd.DataFrame() show_day = data_json["Data"]["showday"] data_df = temp_df[ [ "Id", "actualsyi", "cycle", "fcode", "kfr", "mui", "shortname", "syi", "zrmui", "zrsyi", ] ] data_df.columns = [ "序号", "上一期年化收益率", "封闭期", "基金代码", "申购状态", f"{show_day[0]}-万份收益", "基金简称", f"{show_day[0]}-7日年华", f"{show_day[1]}-万份收益", f"{show_day[1]}-7日年华", ] data_df = data_df[ [ "序号", "基金代码", "基金简称", "上一期年化收益率", f"{show_day[0]}-万份收益", f"{show_day[0]}-7日年华", f"{show_day[1]}-万份收益", f"{show_day[1]}-7日年华", "封闭期", "申购状态", ] ] return data_df def fund_financial_fund_info_em(symbol: str = "000134") -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值明细 https://fundf10.eastmoney.com/jjjz_000791.html :param symbol: 理财型基金代码, 可以通过 ak.fund_financial_fund_daily_em() 来获取 :type symbol: str :return: 东方财富网站-天天基金网-基金数据-理财型基金收益-历史净值明细 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/f10/lsjz" headers = { "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", "Referer": f"https://fundf10.eastmoney.com/jjjz_{symbol}.html", } params = { "callback": "jQuery18307915911837995662_1588249228826", "fundCode": symbol, "pageIndex": "1", "pageSize": "10000", "startDate": "", "endDate": "", "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) text_data = r.text data_json = demjson.decode(text_data[text_data.find("{") : -1]) temp_df = pd.DataFrame(data_json["Data"]["LSJZList"]) temp_df.columns = [ "净值日期", "单位净值", "累计净值", "_", "_", "_", "日增长率", "申购状态", "赎回状态", "_", "_", "_", "分红送配", ] temp_df = temp_df[ [ "净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态", "分红送配", ] ] temp_df.sort_values(["净值日期"], inplace=True, ignore_index=True) temp_df["净值日期"] = pd.to_datetime(temp_df["净值日期"]).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") return temp_df def fund_graded_fund_daily_em() -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-分级基金净值 https://fund.eastmoney.com/fjjj.html#1_1__0__zdf,desc_1 :return: 当前交易日的所有分级基金净值 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Data/Fund_JJJZ_Data.aspx" headers = { "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", "Referer": "https://fund.eastmoney.com/fjjj.html", } params = { "t": "1", "lx": "9", "letter": "", "gsid": "0", "text": "", "sort": "zdf,desc", "page": "1,10000", "dt": "1580914040623", "atfc": "", } res = requests.get(url, params=params, headers=headers) text_data = res.text data_json = demjson.decode(text_data.strip("var db=")) temp_df = pd.DataFrame(data_json["datas"]) show_day = data_json["showday"] temp_df.columns = [ "基金代码", "基金简称", "-", f"{show_day[0]}-单位净值", f"{show_day[0]}-累计净值", f"{show_day[1]}--单位净值", f"{show_day[1]}--累计净值", "日增长值", "日增长率", "市价", "折价率", "-", "-", "-", "-", "-", "-", "-", "-", "手续费", ] data_df = temp_df[ [ "基金代码", "基金简称", f"{show_day[0]}-单位净值", f"{show_day[0]}-累计净值", f"{show_day[1]}--单位净值", f"{show_day[1]}--累计净值", "日增长值", "日增长率", "市价", "折价率", "手续费", ] ] return data_df def fund_graded_fund_info_em(symbol: str = "150232") -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细 https://fundf10.eastmoney.com/jjjz_150232.html :param symbol: 分级基金代码, 可以通过 ak.fund_money_fund_daily_em() 来获取 :type symbol: str :return: 东方财富网站-天天基金网-基金数据-分级基金净值-历史净值明细 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/f10/lsjz" headers = { "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", "Referer": f"https://fundf10.eastmoney.com/jjjz_{symbol}.html", } params = { "fundCode": symbol, "pageIndex": "1", "pageSize": "20", "startDate": "", "endDate": "", "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) data_json = r.json() total_page = math.ceil(int(data_json["TotalCount"]) / 20) tqdm = get_tqdm() big_list = [] for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageIndex": page}) r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]["LSJZList"]) big_list.append(temp_df) big_df = pd.concat(big_list, ignore_index=True) big_df.columns = [ "净值日期", "单位净值", "累计净值", "_", "_", "_", "日增长率", "申购状态", "赎回状态", "_", "_", "_", "_", ] big_df.sort_values(by=["净值日期"], inplace=True, ignore_index=True) big_df = big_df[ ["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"] ] big_df["净值日期"] = pd.to_datetime(big_df["净值日期"], errors="coerce").dt.date big_df["单位净值"] = pd.to_numeric(big_df["单位净值"], errors="coerce") big_df["累计净值"] = pd.to_numeric(big_df["累计净值"], errors="coerce") big_df["日增长率"] = pd.to_numeric(big_df["日增长率"], errors="coerce") return big_df def fund_etf_fund_daily_em() -> pd.DataFrame: """ 东方财富网-天天基金网-基金数据-场内交易基金 https://fund.eastmoney.com/cnjy_dwjz.html :return: 当前交易日的所有场内交易基金数据 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/cnjy_dwjz.html" r = requests.get(url, headers=headers) r.encoding = "gb2312" show_day = pd.read_html(StringIO(r.text))[1].iloc[0, 6:10].tolist() temp_df = pd.read_html(StringIO(r.text))[1].iloc[1:, 2:] temp_df_columns = temp_df.iloc[0, :].tolist()[1:] temp_df = temp_df.iloc[1:, 1:] temp_df.columns = temp_df_columns temp_df["基金简称"] = temp_df["基金简称"].str.replace("行情吧档案", "") temp_df.reset_index(inplace=True, drop=True) temp_df.columns = [ "基金代码", "基金简称", "类型", f"{show_day[0]}-单位净值", f"{show_day[0]}-累计净值", f"{show_day[2]}-单位净值", f"{show_day[2]}-累计净值", "增长值", "增长率", "市价", "折价率", ] return temp_df def fund_etf_fund_info_em( fund: str = "511280", start_date: str = "20000101", end_date: str = "20500101", ) -> pd.DataFrame: """ 东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细 https://fundf10.eastmoney.com/jjjz_511280.html :param fund: 场内交易基金代码, 可以通过 fund_etf_fund_daily_em 来获取 :type fund: str :param start_date: 开始统计时间 :type start_date: str :param end_date: 结束统计时间 :type end_date: str :return: 东方财富网站-天天基金网-基金数据-场内交易基金-历史净值明细 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/f10/lsjz" headers = { "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", "Referer": f"https://fundf10.eastmoney.com/jjjz_{fund}.html", } params = { "fundCode": fund, "pageIndex": "1", "pageSize": "20", "startDate": "-".join([start_date[:4], start_date[4:6], start_date[6:]]), "endDate": "-".join([end_date[:4], end_date[4:6], end_date[6:]]), "_": round(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) data_json = r.json() total_page = math.ceil(data_json["TotalCount"] / 20) df_list = [] tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"pageIndex": page}) r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]["LSJZList"]) df_list.append(temp_df) big_df = pd.concat(df_list) big_df.columns = [ "净值日期", "单位净值", "累计净值", "_", "_", "_", "日增长率", "申购状态", "赎回状态", "_", "_", "_", "_", ] big_df = big_df[ ["净值日期", "单位净值", "累计净值", "日增长率", "申购状态", "赎回状态"] ] big_df["净值日期"] = pd.to_datetime(big_df["净值日期"], errors="coerce").dt.date big_df["单位净值"] = pd.to_numeric(big_df["单位净值"], errors="coerce") big_df["累计净值"] = pd.to_numeric(big_df["累计净值"], errors="coerce") big_df["日增长率"] = pd.to_numeric(big_df["日增长率"], errors="coerce") big_df.sort_values(["净值日期"], inplace=True, ignore_index=True) return big_df def fund_value_estimation_em(symbol: str = "全部") -> pd.DataFrame: """ 东方财富网-数据中心-净值估算 https://fund.eastmoney.com/fundguzhi.html :param symbol: choice of {'全部', '股票型', '混合型', '债券型', '指数型', 'QDII', 'ETF联接', 'LOF', '场内交易基金'} :type symbol: str :return: 近期净值估算数据 :rtype: pandas.DataFrame """ symbol_map = { "全部": 1, "股票型": 2, "混合型": 3, "债券型": 4, "指数型": 5, "QDII": 6, "ETF联接": 7, "LOF": 8, "场内交易基金": 9, } url = "https://api.fund.eastmoney.com/FundGuZhi/GetFundGZList" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", "Referer": "https://fund.eastmoney.com/", } params = { "type": symbol_map[symbol], "sort": "3", "orderType": "desc", "canbuy": "0", "pageIndex": "1", "pageSize": "20000", "_": int(time.time() * 1000), } r = requests.get(url, params=params, headers=headers) json_data = r.json() temp_df = pd.DataFrame(json_data["Data"]["list"]) value_day = json_data["Data"]["gzrq"] cal_day = json_data["Data"]["gxrq"] temp_df.columns = [ "基金代码", "-", "-", "-", "-", "-", "基金类型", "-", "-", "-", "-", "估算日期", "-", "-", "-", "-", "_", "-", "-", "估算偏差", f"{cal_day}-估算数据-估算值", f"{cal_day}-估算数据-估算增长率", f"{cal_day}-公布数据-日增长率", f"{value_day}-单位净值", f"{cal_day}-公布数据-单位净值", "-", "基金名称", "-", "-", "-", ] temp_df = temp_df[ [ "基金代码", "基金名称", f"{cal_day}-估算数据-估算值", f"{cal_day}-估算数据-估算增长率", f"{cal_day}-公布数据-单位净值", f"{cal_day}-公布数据-日增长率", "估算偏差", f"{value_day}-单位净值", ] ] temp_df.reset_index(inplace=True) temp_df["index"] = range(1, len(temp_df) + 1) temp_df.rename(columns={"index": "序号"}, inplace=True) return temp_df def fund_hk_fund_hist_em( code: str = "1002200683", symbol: str = "历史净值明细" ) -> pd.DataFrame: """ 东方财富网-天天基金网-基金数据-香港基金-历史净值明细(分红送配详情) https://overseas.1234567.com.cn/f10/FundJz/968092#FHPS :param code: 通过 ak.fund_em_hk_rank() 获取 :type code: str :param symbol: choice of {"历史净值明细", "分红送配详情"} :type symbol: str :return: 香港基金-历史净值明细(分红送配详情) :rtype: pandas.DataFrame """ url = "https://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx" if symbol == "历史净值明细": params = { "api": "HKFDApi", "m": "MethodJZ", "hkfcode": f"{code}", "action": "2", "pageindex": "0", "pagesize": "1000", "date1": "", "date2": "", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_one_df = pd.DataFrame(data_json["Data"]) temp_one_df.columns = [ "_", "_", "_", "净值日期", "单位净值", "_", "日增长值", "日增长率", "_", "单位", "_", ] temp_one_df = temp_one_df[ [ "净值日期", "单位净值", "日增长值", "日增长率", "单位", ] ] else: params = { "api": "HKFDApi", "m": "MethodJZ", "hkfcode": f"{code}", "action": "3", "pageindex": "0", "pagesize": "1000", "date1": "", "date2": "", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_one_df = pd.DataFrame(data_json["Data"]) temp_one_df.columns = [ "_", "_", "_", "_", "_", "年份", "分红金额", "除息日", "权益登记日", "分红发放日", "_", "单位", "_", "_", ] temp_one_df = temp_one_df[ [ "年份", "权益登记日", "除息日", "分红发放日", "分红金额", "单位", ] ] return temp_one_df if __name__ == "__main__": fund_purchase_em_df = fund_purchase_em() print(fund_purchase_em_df) fund_name_em_df = fund_name_em() print(fund_name_em_df) fund_info_index_em_df = fund_info_index_em(symbol="债券指数", indicator="全部") print(fund_info_index_em_df) fund_open_fund_daily_em_df = fund_open_fund_daily_em() print(fund_open_fund_daily_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="710001", indicator="单位净值走势" ) print(fund_open_fund_info_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="502010", indicator="累计净值走势", period="成立来" ) print(fund_open_fund_info_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="710001", indicator="累计收益率走势", period="成立来" ) print(fund_open_fund_info_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="710001", indicator="同类排名走势" ) print(fund_open_fund_info_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="710001", indicator="同类排名百分比" ) print(fund_open_fund_info_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="014164", indicator="分红送配详情" ) print(fund_open_fund_info_em_df) time.sleep(3) fund_open_fund_info_em_df = fund_open_fund_info_em( symbol="005561", indicator="拆分详情" ) print(fund_open_fund_info_em_df) fund_money_fund_daily_em_df = fund_money_fund_daily_em() print(fund_money_fund_daily_em_df) fund_money_fund_info_em_df = fund_money_fund_info_em(symbol="000009") print(fund_money_fund_info_em_df) fund_financial_fund_daily_em_df = fund_financial_fund_daily_em() print(fund_financial_fund_daily_em_df) fund_financial_fund_info_em_df = fund_financial_fund_info_em(symbol="000134") print(fund_financial_fund_info_em_df) fund_graded_fund_daily_em_df = fund_graded_fund_daily_em() print(fund_graded_fund_daily_em_df) fund_graded_fund_info_em_df = fund_graded_fund_info_em(symbol="150232") print(fund_graded_fund_info_em_df) fund_etf_fund_daily_em_df = fund_etf_fund_daily_em() print(fund_etf_fund_daily_em_df) fund_etf_fund_info_em_df = fund_etf_fund_info_em( fund="511280", start_date="20000101", end_date="20500101" ) print(fund_etf_fund_info_em_df) fund_value_estimation_em_df = fund_value_estimation_em(symbol="混合型") print(fund_value_estimation_em_df) fund_hk_fund_hist_em_df = fund_hk_fund_hist_em( code="1002200683", symbol="历史净值明细" ) print(fund_hk_fund_hist_em_df) fund_hk_fund_hist_em_df = fund_hk_fund_hist_em( code="1002200683", symbol="分红送配详情" ) print(fund_hk_fund_hist_em_df) ================================================ FILE: akshare/fund/fund_etf_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/2/15 22:00 Desc: 东方财富-ETF行情 https://quote.eastmoney.com/sh513500.html """ from functools import lru_cache import pandas as pd import requests from akshare.utils.func import fetch_paginated_data @lru_cache() def _fund_etf_code_id_map_em() -> dict: """ 东方财富-ETF代码和市场标识映射 https://quote.eastmoney.com/center/gridlist.html#fund_etf :return: ETF 代码和市场标识映射 :rtype: dict """ url = "https://88.push2.eastmoney.com/api/qt/clist/get" params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "wbp2u": "|0|0|0|web", "fid": "f3", "fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024", "fields": "f3,f12,f13", } temp_df = fetch_paginated_data(url, params) temp_dict = dict(zip(temp_df["f12"], temp_df["f13"])) return temp_dict def fund_etf_spot_em() -> pd.DataFrame: """ 东方财富-ETF 实时行情 https://quote.eastmoney.com/center/gridlist.html#fund_etf :return: ETF 实时行情 :rtype: pandas.DataFrame """ url = "https://88.push2.eastmoney.com/api/qt/clist/get" params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "wbp2u": "|0|0|0|web", "fid": "f12", "fs": "b:MK0021,b:MK0022,b:MK0023,b:MK0024,b:MK0827", "fields": ( "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10," "f12,f13,f14,f15,f16,f17,f18,f20,f21," "f23,f24,f25,f22,f11,f30,f31,f32,f33," "f34,f35,f38,f62,f63,f64,f65,f66,f69," "f72,f75,f78,f81,f84,f87,f115,f124,f128," "f136,f152,f184,f297,f402,f441" ), } temp_df = fetch_paginated_data(url, params) temp_df.rename( columns={ "f12": "代码", "f14": "名称", "f2": "最新价", "f4": "涨跌额", "f3": "涨跌幅", "f5": "成交量", "f6": "成交额", "f7": "振幅", "f17": "开盘价", "f15": "最高价", "f16": "最低价", "f18": "昨收", "f8": "换手率", "f10": "量比", "f30": "现手", "f31": "买一", "f32": "卖一", "f33": "委比", "f34": "外盘", "f35": "内盘", "f62": "主力净流入-净额", "f184": "主力净流入-净占比", "f66": "超大单净流入-净额", "f69": "超大单净流入-净占比", "f72": "大单净流入-净额", "f75": "大单净流入-净占比", "f78": "中单净流入-净额", "f81": "中单净流入-净占比", "f84": "小单净流入-净额", "f87": "小单净流入-净占比", "f38": "最新份额", "f21": "流通市值", "f20": "总市值", "f402": "基金折价率", "f441": "IOPV实时估值", "f297": "数据日期", "f124": "更新时间", }, inplace=True, ) temp_df = temp_df[ [ "代码", "名称", "最新价", "IOPV实时估值", "基金折价率", "涨跌额", "涨跌幅", "成交量", "成交额", "开盘价", "最高价", "最低价", "昨收", "振幅", "换手率", "量比", "委比", "外盘", "内盘", "主力净流入-净额", "主力净流入-净占比", "超大单净流入-净额", "超大单净流入-净占比", "大单净流入-净额", "大单净流入-净占比", "中单净流入-净额", "中单净流入-净占比", "小单净流入-净额", "小单净流入-净占比", "现手", "买一", "卖一", "最新份额", "流通市值", "总市值", "数据日期", "更新时间", ] ] 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") 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") 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") 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") 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") 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") 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") temp_df["IOPV实时估值"] = pd.to_numeric(temp_df["IOPV实时估值"], errors="coerce") 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" ) 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" ) 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" ) temp_df["小单净流入-净额"] = pd.to_numeric( temp_df["小单净流入-净额"], errors="coerce" ) temp_df["小单净流入-净占比"] = pd.to_numeric( temp_df["小单净流入-净占比"], errors="coerce" ) temp_df["数据日期"] = pd.to_datetime( temp_df["数据日期"], format="%Y%m%d", errors="coerce" ) temp_df["更新时间"] = ( pd.to_datetime(temp_df["更新时间"], unit="s", errors="coerce") .dt.tz_localize("UTC") .dt.tz_convert("Asia/Shanghai") ) return temp_df def get_market_id(symbol: str) -> int: """ 东方财富-ETF市场标识判断 :param symbol: ETF 代码 :type symbol: str :return: ETF 代码和市场标识(1:上证 0:深证) :rtype: int """ if symbol.startswith(("0", "1", "3", "2", "5", "6")): if symbol.startswith(("5", "6")): return 1 else: return 0 else: return 1 def fund_etf_hist_em( symbol: str = "159707", period: str = "daily", start_date: str = "19700101", end_date: str = "20500101", adjust: str = "", ) -> pd.DataFrame: """ 东方财富-ETF行情 https://quote.eastmoney.com/sz159707.html :param symbol: ETF 代码 :type symbol: str :param period: choice of {'daily', 'weekly', 'monthly'} :type period: str :param start_date: 开始日期 :type start_date: str :param end_date: 结束日期 :type end_date: str :param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"} :type adjust: str :return: 每日行情 :rtype: pandas.DataFrame """ # code_id_dict = _fund_etf_code_id_map_em() adjust_dict = {"qfq": "1", "hfq": "2", "": "0"} period_dict = {"daily": "101", "weekly": "102", "monthly": "103"} url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "fields1": "f1,f2,f3,f4,f5,f6", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116", "ut": "7eea3edcaed734bea9cbfc24409ed989", "klt": period_dict[period], "fqt": adjust_dict[adjust], "beg": start_date, "end": end_date, } try: # market_id = code_id_dict[symbol] market_id = get_market_id(symbol) params.update({"secid": f"{market_id}.{symbol}"}) r = requests.get(url, timeout=15, params=params) data_json = r.json() except KeyError: market_id = 1 params.update({"secid": f"{market_id}.{symbol}"}) r = requests.get(url, timeout=15, params=params) data_json = r.json() if not data_json["data"]: market_id = 0 params.update({"secid": f"{market_id}.{symbol}"}) r = requests.get(url, timeout=15, params=params) data_json = r.json() if not (data_json["data"] and data_json["data"]["klines"]): return pd.DataFrame() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) temp_df.columns = [ "日期", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "振幅", "涨跌幅", "涨跌额", "换手率", ] temp_df.index = pd.to_datetime(temp_df["日期"], errors="coerce") temp_df.reset_index(inplace=True, drop=True) 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") 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") 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") temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce") return temp_df def fund_etf_hist_min_em( symbol: str = "159707", start_date: str = "1979-09-01 09:32:00", end_date: str = "2222-01-01 09:32:00", period: str = "5", adjust: str = "", ) -> pd.DataFrame: """ 东方财富-ETF 行情 https://quote.eastmoney.com/sz159707.html :param symbol: ETF 代码 :type symbol: str :param start_date: 开始日期 :type start_date: str :param end_date: 结束日期 :type end_date: str :param period: choice of {"1", "5", "15", "30", "60"} :type period: str :param adjust: choice of {'', 'qfq', 'hfq'} :type adjust: str :return: 每日分时行情 :rtype: pandas.DataFrame """ # code_id_dict = _fund_etf_code_id_map_em() # 商品期货类 ETF # code_id_dict.update( # { # "159980": "0", # "159981": "0", # "159985": "0", # "511090": "1", # "511220": "1", # "511380": "1", # } # ) adjust_map = { "": "0", "qfq": "1", "hfq": "2", } if period == "1": url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get" params = { "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58", "ut": "7eea3edcaed734bea9cbfc24409ed989", "ndays": "5", "iscr": "0", "secid": f"{get_market_id(symbol)}.{symbol}", } r = requests.get(url, timeout=15, params=params) data_json = r.json() temp_df = pd.DataFrame( [item.split(",") for item in data_json["data"]["trends"]] ) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "均价", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") temp_df["均价"] = pd.to_numeric(temp_df["均价"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str) return temp_df else: url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "fields1": "f1,f2,f3,f4,f5,f6", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61", "ut": "7eea3edcaed734bea9cbfc24409ed989", "klt": period, "fqt": adjust_map[adjust], "secid": f"{get_market_id(symbol)}.{symbol}", "beg": "0", "end": "20500000", } r = requests.get(url, timeout=15, params=params) data_json = r.json() temp_df = pd.DataFrame( [item.split(",") for item in data_json["data"]["klines"]] ) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "振幅", "涨跌幅", "涨跌额", "换手率", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") 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") temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str) temp_df = temp_df[ [ "时间", "开盘", "收盘", "最高", "最低", "涨跌幅", "涨跌额", "成交量", "成交额", "振幅", "换手率", ] ] return temp_df if __name__ == "__main__": fund_etf_spot_em_df = fund_etf_spot_em() print(fund_etf_spot_em_df) fund_etf_hist_hfq_em_df = fund_etf_hist_em( symbol="513500", period="daily", start_date="20000101", end_date="20230201", adjust="hfq", ) print(fund_etf_hist_hfq_em_df) fund_etf_hist_qfq_em_df = fund_etf_hist_em( symbol="511010", period="daily", start_date="20000101", end_date="20230718", adjust="", ) print(fund_etf_hist_qfq_em_df) fund_etf_hist_em_df = fund_etf_hist_em( symbol="159985", period="daily", start_date="20000101", end_date="20231211", adjust="", ) print(fund_etf_hist_em_df) fund_etf_hist_min_em_df = fund_etf_hist_min_em( symbol="511380", period="1", adjust="", start_date="2025-03-10 09:30:00", end_date="2025-03-10 17:40:00", ) print(fund_etf_hist_min_em_df) ================================================ FILE: akshare/fund/fund_etf_sina.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/11/10 15:30 Desc: 新浪财经-基金行情 https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf """ import pandas as pd import py_mini_racer import requests from akshare.stock.cons import hk_js_decode from akshare.utils import demjson def fund_etf_category_sina(symbol: str = "LOF基金") -> pd.DataFrame: """ 新浪财经-基金列表 https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf :param symbol: choice of {"封闭式基金", "ETF基金", "LOF基金"} :type symbol: str :return: 指定 symbol 的基金列表 :rtype: pandas.DataFrame """ fund_map = { "封闭式基金": "close_fund", "ETF基金": "etf_hq_fund", "LOF基金": "lof_hq_fund", } url = ( "https://vip.stock.finance.sina.com.cn/quotes_service/api/jsonp.php/" "IO.XSRV2.CallbackList['da_yPT46_Ll7K6WD']/Market_Center.getHQNodeDataSimple" ) params = { "page": "1", "num": "5000", "sort": "symbol", "asc": "0", "node": fund_map[symbol], "[object HTMLDivElement]": "qvvne", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("([") + 1 : -2]) temp_df = pd.DataFrame(data_json) if symbol == "封闭式基金": temp_df.columns = [ "代码", "名称", "最新价", "涨跌额", "涨跌幅", "买入", "卖出", "昨收", "今开", "最高", "最低", "成交量", "成交额", "_", "_", ] else: temp_df.columns = [ "代码", "名称", "最新价", "涨跌额", "涨跌幅", "买入", "卖出", "昨收", "今开", "最高", "最低", "成交量", "成交额", "_", "_", "_", "_", ] temp_df = temp_df[ [ "代码", "名称", "最新价", "涨跌额", "涨跌幅", "买入", "卖出", "昨收", "今开", "最高", "最低", "成交量", "成交额", ] ] 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") 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") 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") temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce") temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce") return temp_df def fund_etf_hist_sina(symbol: str = "sh510050") -> pd.DataFrame: """ 新浪财经-基金-ETF 基金-日行情数据 https://finance.sina.com.cn/fund/quotes/159996/bc.shtml :param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取 :type symbol: str :return: 日行情数据 :rtype: pandas.DataFrame """ url = ( f"https://finance.sina.com.cn/realstock/company/{symbol}/hisdata_klc2/klc_kl.js" ) r = requests.get(url) js_code = py_mini_racer.MiniRacer() js_code.eval(hk_js_decode) dict_list = js_code.call( "d", r.text.split("=")[1].split(";")[0].replace('"', "") ) # 执行js解密代码 temp_df = pd.DataFrame(dict_list) if temp_df.empty: # 处理获取数据为空的问题 return pd.DataFrame() temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.tz_localize( None ) temp_df["open"] = pd.to_numeric(temp_df["open"], errors="coerce") temp_df["high"] = pd.to_numeric(temp_df["high"], errors="coerce") temp_df["low"] = pd.to_numeric(temp_df["low"], errors="coerce") temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce") temp_df["volume"] = pd.to_numeric(temp_df["volume"], errors="coerce") # 转换日期列为日期类型 temp_df["date"] = temp_df["date"].dt.date temp_df = temp_df.sort_values(by="date", ascending=True) return temp_df def fund_etf_dividend_sina(symbol: str = "sh510050") -> pd.DataFrame: """ 新浪财经-基金-ETF 基金-累计分红 https://finance.sina.com.cn/fund/quotes/510050/bc.shtml :param symbol: 基金名称, 可以通过 ak.fund_etf_category_sina() 函数获取 :type symbol: str :return: 累计分红 :rtype: pandas.DataFrame """ # 构建复权数据URL factor_url = f"https://finance.sina.com.cn/realstock/company/{symbol}/hfq.js" r = requests.get(factor_url) text = r.text if text.startswith("var"): json_str = text.split("=")[1].strip().rsplit("}", maxsplit=1)[0].strip() data = eval(json_str + "}") # 这里使用eval而不是json.loads因为数据格式特殊 if isinstance(data, dict) and "data" in data: df = pd.DataFrame(data["data"]) # 重命名列 df.columns = ["date", "f", "s", "u"] if len(df.columns) == 4 else df.columns # 移除1900-01-01的数据 df = df[df["date"] != "1900-01-01"] # 转换日期 df["date"] = pd.to_datetime(df["date"]) # 转换数值类型 df[["f", "s", "u"]] = df[["f", "s", "u"]].astype(float) # 按日期排序 df = df.sort_values(by="date", ascending=True, ignore_index=True) temp_df = df[["date", "u"]].copy() temp_df.columns = ["日期", "累计分红"] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date return temp_df else: return pd.DataFrame() else: return pd.DataFrame() if __name__ == "__main__": fund_etf_category_sina_df = fund_etf_category_sina(symbol="封闭式基金") print(fund_etf_category_sina_df) fund_etf_category_sina_df = fund_etf_category_sina(symbol="ETF基金") print(fund_etf_category_sina_df) fund_etf_category_sina_df = fund_etf_category_sina(symbol="LOF基金") print(fund_etf_category_sina_df) fund_etf_hist_sina_df = fund_etf_hist_sina(symbol="sh510050") print(fund_etf_hist_sina_df) fund_etf_dividend_sina_df = fund_etf_dividend_sina(symbol="sh510050") print(fund_etf_dividend_sina_df) ================================================ FILE: akshare/fund/fund_etf_sse.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/1/20 15:00 Desc: 上海证券交易所-ETF基金份额数据 https://www.sse.com.cn/assortment/fund/etf/list/scale/ """ import pandas as pd import requests def fund_etf_scale_sse(date: str = "20250115") -> pd.DataFrame: """ 上海证券交易所-产品-基金产品-ETF产品-ETF产品列表-基金规模 https://www.sse.com.cn/assortment/fund/etf/list/scale/ :param date: 统计日期, 默认为空返回最新数据, 格式如 "20250115" :type date: str :return: ETF基金份额数据 :rtype: pandas.DataFrame """ data_str = "-".join([date[:4], date[4:6], date[6:]]) url = "https://query.sse.com.cn/commonQuery.do" params = { "isPagination": "true", "pageHelp.pageSize": "10000", "pageHelp.pageNo": "1", "pageHelp.beginPage": "1", "pageHelp.cacheSize": "1", "pageHelp.endPage": "1", "sqlId": "COMMON_SSE_ZQPZ_ETFZL_XXPL_ETFGM_SEARCH_L", "STAT_DATE": data_str, } headers = { "Referer": "https://www.sse.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/88.0.4324.150 Safari/537.36", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]) temp_df.rename( columns={ "NUM": "序号", "SEC_CODE": "基金代码", "SEC_NAME": "基金简称", "ETF_TYPE": "ETF类型", "STAT_DATE": "统计日期", "TOT_VOL": "基金份额", }, inplace=True, ) temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "ETF类型", "统计日期", "基金份额", ] ] 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["基金份额"], errors="coerce") * 10000 return temp_df if __name__ == "__main__": fund_etf_scale_sse_df = fund_etf_scale_sse(date="20250115") print(fund_etf_scale_sse_df) ================================================ FILE: akshare/fund/fund_etf_szse.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/1/20 15:00 Desc: 深圳证券交易所-ETF基金份额数据 https://fund.szse.cn/marketdata/fundslist/index.html """ import warnings import pandas as pd import requests def fund_etf_scale_szse() -> pd.DataFrame: """ 深圳证券交易所-基金产品-基金列表-ETF基金份额 https://fund.szse.cn/marketdata/fundslist/index.html :return: ETF基金份额数据 :rtype: pandas.DataFrame """ url = "https://fund.szse.cn/api/report/ShowReport" params = { "SHOWTYPE": "xlsx", "CATALOGID": "1000_lf", "TABKEY": "tab1", "random": "0.07610353191740105", } headers = { "Referer": "https://fund.szse.cn/marketdata/fundslist/index.html", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/88.0.4324.150 Safari/537.36", } r = requests.get(url, params=params, headers=headers) with warnings.catch_warnings(record=True): warnings.simplefilter("always") temp_df = pd.read_excel(r.content, engine="openpyxl", dtype={"基金代码": str}) temp_df.rename( columns={ "当前规模(份)": "基金份额", }, inplace=True, ) temp_df = temp_df[ [ "基金代码", "基金简称", "基金类别", "投资类别", "上市日期", "基金份额", "基金管理人", "基金发起人", "基金托管人", "净值", ] ] temp_df["上市日期"] = pd.to_datetime(temp_df["上市日期"], errors="coerce").dt.date temp_df["基金份额"] = ( temp_df["基金份额"].astype(str).str.replace(",", "", regex=False) ) temp_df["基金份额"] = pd.to_numeric(temp_df["基金份额"], errors="coerce") temp_df["净值"] = pd.to_numeric(temp_df["净值"], errors="coerce") return temp_df if __name__ == "__main__": fund_etf_scale_szse_df = fund_etf_scale_szse() print(fund_etf_scale_szse_df) ================================================ FILE: akshare/fund/fund_etf_ths.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/2/10 16:00 Desc: 同花顺理财-基金数据-每日净值-ETF https://fund.10jqka.com.cn/datacenter/jz/kfs/etf/ """ import json import pandas as pd import requests def fund_etf_category_ths(symbol: str = "ETF", date: str = "") -> pd.DataFrame: """ 同花顺理财-基金数据-每日净值-实时行情 https://fund.10jqka.com.cn/datacenter/jz/ :param symbol: 基金类型; choice of {"股票型", "债券型", "混合型", "ETF", "LOF", "QDII", "保本型", "指数型", ""}; "" 表示全部 :type symbol: str :param date: 查询日期 :type date: str :return: 基金实时行情 :rtype: pandas.DataFrame """ symbol_map = { "股票型": "gpx", "债券型": "zqx", "混合型": "hhx", "ETF": "ETF", "LOF": "LOF", "QDII": "QDII", "保本型": "bbx", "指数型": "zsx", "": "all", } inner_symbol = symbol_map.get(symbol, "ETF") inner_date = "-".join([date[:4], date[4:6], date[6:]]) if date != "" else 0 url = ( f"https://fund.10jqka.com.cn/data/Net/info/" f"{inner_symbol}_rate_desc_{inner_date}_0_1_9999_0_0_0_jsonp_g.html" ) r = requests.get(url, timeout=15) data_text = r.text[2:-1] data_json = json.loads(data_text) temp_df = pd.DataFrame(data_json["data"]["data"]).T temp_df.reset_index(inplace=True, drop=True) temp_df.reset_index(inplace=True) temp_df["index"] = temp_df["index"] + 1 temp_df.rename( columns={ "index": "序号", "code": "基金代码", "typename": "基金类型", "net": "当前-单位净值", "name": "基金名称", "totalnet": "当前-累计净值", "newnet": "最新-单位净值", "newtotalnet": "最新-累计净值", "newdate": "最新-交易日", "net1": "前一日-单位净值", "totalnet1": "前一日-累计净值", "ranges": "增长值", "rate": "增长率", "shstat": "赎回状态", "sgstat": "申购状态", }, inplace=True, ) temp_df = temp_df[ [ "序号", "基金代码", "基金名称", "当前-单位净值", "当前-累计净值", "前一日-单位净值", "前一日-累计净值", "增长值", "增长率", "赎回状态", "申购状态", "最新-交易日", "最新-单位净值", "最新-累计净值", "基金类型", ] ] query_date = inner_date if inner_date != 0 else temp_df["最新-交易日"][0] temp_df["查询日期"] = query_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" ) 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") temp_df["最新-单位净值"] = pd.to_numeric(temp_df["最新-单位净值"], errors="coerce") temp_df["最新-累计净值"] = pd.to_numeric(temp_df["最新-累计净值"], errors="coerce") temp_df["最新-交易日"] = pd.to_datetime( temp_df["最新-交易日"], errors="coerce" ).dt.date return temp_df def fund_etf_spot_ths(date: str = "") -> pd.DataFrame: """ 同花顺理财-基金数据-每日净值-ETF-实时行情 https://fund.10jqka.com.cn/datacenter/jz/kfs/etf/ :param date: 查询日期 :type date: str :return: ETF 实时行情 :rtype: pandas.DataFrame """ return fund_etf_category_ths(date=date, symbol="ETF") if __name__ == "__main__": fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="股票型") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="债券型") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="混合型") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="ETF") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="LOF") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="QDII") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="保本型") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="指数型") print(fund_etf_category_ths_df) fund_etf_category_ths_df = fund_etf_category_ths(date="20240620", symbol="") print(fund_etf_category_ths_df) fund_etf_spot_ths_df = fund_etf_spot_ths(date="20240620") print(fund_etf_spot_ths_df) ================================================ FILE: akshare/fund/fund_fee_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/12/22 17:00 Desc: 天天基金-基金档案 https://fundf10.eastmoney.com/jjfl_015641.html """ import re from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup def fund_fee_em(symbol: str = "015641", indicator: str = "认购费率") -> pd.DataFrame: """ 天天基金-基金档案-购买信息 https://fundf10.eastmoney.com/jjfl_015641.html :param symbol: 基金代码 :type symbol: str :param indicator: choice of {"交易状态", "申购与赎回金额", "交易确认日", "运作费用", "认购费率(前端)", "认购费率(后端)","申购费率(前端)", "赎回费率"} :type indicator: str :return: 交易规则 :rtype: pandas.DataFrame """ url = f"https://fundf10.eastmoney.com/jjfl_{symbol}.html" r = requests.get(url) soup = BeautifulSoup(r.text, features="html.parser") tables_dict = {} title_elements = soup.find_all(name="h4", class_="t") for title_elem in title_elements: title_text = title_elem.get_text(strip=True) title_text = re.sub(r"\s+", " ", title_text).strip() if title_text == "申购与赎回金额": next_table = title_elem.find_all_next("table")[0] next_next_table = title_elem.find_all_next("table")[1] table_html = str(next_table) next_table_html = str(next_next_table) df_1 = pd.read_html(StringIO(table_html))[0] df_2 = pd.read_html(StringIO(next_table_html))[0] df = pd.concat(objs=[df_1, df_2], ignore_index=True) tables_dict[title_text] = df continue else: next_table = title_elem.find_next("table") if next_table: try: # 将表格转换为HTML字符串,然后使用pd.read_html读取 table_html = str(next_table) df = pd.read_html(StringIO(table_html))[0] tables_dict[title_text] = df except Exception as e: print("Error:", e) continue if indicator == "交易状态": temp_df = tables_dict[indicator] elif indicator == "申购与赎回金额": temp_df = tables_dict[indicator] elif indicator == "交易确认日": temp_df = tables_dict[indicator] elif indicator == "运作费用": temp_df = tables_dict[indicator] elif indicator == "认购费率(后端)": temp_df = tables_dict[indicator] elif indicator == "认购费率(前端)": temp_df = tables_dict[indicator] temp_df[["原费率", "天天基金优惠费率"]] = temp_df[ "原费率|天天基金优惠费率" ].str.split("|", expand=True) del temp_df["原费率|天天基金优惠费率"] temp_df.loc[3, "天天基金优惠费率"] = temp_df.loc[3, "原费率"] temp_df["原费率"] = temp_df["原费率"].str.strip() temp_df["天天基金优惠费率"] = temp_df["天天基金优惠费率"].str.strip() elif indicator == "申购费率(前端)": temp_df = tables_dict[indicator] if "原费率|天天基金优惠费率 银行卡购买|活期宝购买" not in temp_df.columns: # assert temp_df.columns.tolist() == ["适用金额", "适用期限", "费率"] return temp_df splited = temp_df["原费率|天天基金优惠费率 银行卡购买|活期宝购买"].str.split( "|", expand=True ) if splited.shape[1] == 1: temp_df.rename( columns={"原费率|天天基金优惠费率 银行卡购买|活期宝购买": "原费率"}, inplace=True, ) temp_df["天天基金优惠费率-银行卡购买"] = temp_df["原费率"] temp_df["天天基金优惠费率-活期宝购买"] = temp_df["原费率"] else: temp_df[ ["原费率", "天天基金优惠费率-银行卡购买", "天天基金优惠费率-活期宝购买"] ] = splited temp_df["天天基金优惠费率-银行卡购买"] = temp_df[ "天天基金优惠费率-银行卡购买" ].fillna(temp_df["原费率"]) temp_df["天天基金优惠费率-活期宝购买"] = temp_df[ "天天基金优惠费率-活期宝购买" ].fillna(temp_df["原费率"]) del temp_df["原费率|天天基金优惠费率 银行卡购买|活期宝购买"] temp_df["原费率"] = temp_df["原费率"].str.strip() temp_df["天天基金优惠费率-银行卡购买"] = temp_df[ "天天基金优惠费率-银行卡购买" ].str.strip() temp_df["天天基金优惠费率-活期宝购买"] = temp_df[ "天天基金优惠费率-活期宝购买" ].str.strip() elif indicator in ("赎回费率", "赎回费率(前端)", "赎回费率(后端)"): temp_df = tables_dict[indicator] if "原费率|天天基金优惠费率" in temp_df.columns: temp_df[["原费率", "天天基金优惠费率"]] = temp_df[ "原费率|天天基金优惠费率" ].str.split("|", expand=True) del temp_df["原费率|天天基金优惠费率"] else: temp_df = pd.DataFrame([]) return temp_df if __name__ == "__main__": fund_fee_em_df = fund_fee_em(symbol="019005", indicator="交易状态") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="019005", indicator="申购与赎回金额") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="019005", indicator="交易确认日") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="019005", indicator="运作费用") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="019005", indicator="认购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="019005", indicator="申购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="000011", indicator="赎回费率") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="018403", indicator="赎回费率") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="100035", indicator="赎回费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="022364", indicator="申购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="022365", indicator="申购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="006030", indicator="申购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="022568", indicator="申购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="960029", indicator="申购费率(前端)") print(fund_fee_em_df) fund_fee_em_df = fund_fee_em(symbol="000011", indicator="认购费率(后端)") print(fund_fee_em_df) ================================================ FILE: akshare/fund/fund_fhsp_em.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2026/2/22 13:00 Desc: 天天基金网-基金数据-分红送配 https://fund.eastmoney.com/data/fundfenhong.html """ import pandas as pd import requests from akshare.utils.tqdm import get_tqdm def fund_fh_em( year: str = "2025", typ: str = "", rank: str = "BZDM", sort: str = "asc", page: int = -1, ) -> pd.DataFrame: """ 天天基金网-基金数据-分红送配-基金分红 https://fund.eastmoney.com/data/fundfenhong.html#DJR,desc,1,,, :param year: 查询年份 :type year: str :param typ: 基金类型;空串表示全部; choice of {"指数型-其他", "指数型-海外股票", "指数型-固收", "指数型-股票", "债券型-中短债", "债券型-长债", "债券型-理财", "债券型-混合债", "债券型-混合一级", "债券型-混合二级", "货币型-普通货币", "货币型-浮动净值", "混合型-平衡", "混合型-偏债", "混合型-偏股", "混合型-灵活", "混合型-绝对收益", "股票型", "REITs", "Reits", "QDII-商品", "QDII-普通股票", "QDII-混合债", "QDII-混合偏股", "QDII-纯债", "QDII-REITs", "FOF"} :type typ: str :param rank: 排序字段;choice of {"BZDM", "ABBNAME", "DJR", "FSRQ", "FHFCZ", "FFR"}; "BZDM": 基金代码, "ABBNAME": 基金简称, "DJR": 权益登记日, "FSRQ": 除息日期, "FHFCZ": 分红(元/份), "FFR": 分红发放日 :type rank: str :param sort: 排序方向;排序方式; choice of {"asc", "desc"} :type sort: str :param page: 查询页数;请求第page页数据; -1 表示全部页面 :type page: int :return: 基金分红 :rtype: pandas.DataFrame """ def get_df_from_response(response): text = response.text return pd.DataFrame(eval(text[text.find("[["): text.find(";var jjfh_jjgs")])) url = "https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx" params = { "dt": "8", "page": "1" if page == -1 else str(page), "rank": rank, "sort": sort, "gs": "", "ftype": typ, "year": year, } r = requests.get(url, params=params) data_list = [get_df_from_response(r)] if page == -1: data_text = r.text total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0] tqdm = get_tqdm() for p in tqdm(range(2, total_page + 1), leave=False): params.update({"page": str(p)}) r = requests.get(url, params=params) data_list.append(get_df_from_response(r)) big_df = pd.concat(objs=data_list, ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df.index + 1 # 处理空数据时报错的问题 if big_df.empty: big_df = big_df.reindex( columns=[ "序号", "基金代码", "基金简称", "权益登记日", "除息日期", "分红", "分红发放日", "-", ] ) big_df.columns = [ "序号", "基金代码", "基金简称", "权益登记日", "除息日期", "分红", "分红发放日", "-", ] big_df = big_df[ ["序号", "基金代码", "基金简称", "权益登记日", "除息日期", "分红", "分红发放日"] ] big_df["权益登记日"] = pd.to_datetime(big_df["权益登记日"]).dt.date big_df["除息日期"] = pd.to_datetime(big_df["除息日期"]).dt.date big_df["分红发放日"] = pd.to_datetime(big_df["分红发放日"]).dt.date big_df["分红"] = pd.to_numeric(big_df["分红"]) return big_df def fund_cf_em( year: str = "2025", typ: str = "", rank: str = "FSRQ", sort: str = "desc", page: int = -1, ) -> pd.DataFrame: """ 天天基金网-基金数据-分红送配-基金拆分 https://fund.eastmoney.com/data/fundchaifen.html#FSRQ,desc,1,,, :param year: 查询年份 :type year: str :param typ: 基金类型;空串表示全部; choice of {"", "指数型-其他", "指数型-海外股票", "指数型-固收", "指数型-股票", "债券型-中短债", "债券型-长债", "债券型-可转债", "债券型-混合债", "债券型-混合一级", "债券型-混合二级", "商品(不含QDII)", "货币型", "混合型-平衡", "混合型-偏债", "混合型-偏股", "混合型-灵活", "股票型", "QDII", "FOF"} :type typ: str :param rank: 排序字段;choice of {"BZDM", "ABBNAME", "FSRQ", "FHFCZ"}; "BZDM": 基金代码, "ABBNAME": 基金简称, "FSRQ": 拆分折算日, "FHFCZ": 拆分折算(每份) :type rank: str :param sort: 排序方向;choice of {"asc", "desc"} :type sort: str :param page: 查询页数;请求第page页数据; -1 表示全部页面 :type page: int :return: 基金拆分 :rtype: pandas.DataFrame """ def get_df_from_response(response): text = response.text code = text[text.find("[["): text.find(";var jjcf_jjgs")] if code: return pd.DataFrame(eval(code)) return pd.DataFrame() url = "https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx" params = { "dt": "9", "page": "1" if page == -1 else str(page), "rank": rank, "sort": sort, "gs": "", "ftype": typ, "year": year, } r = requests.get(url, params=params) data_list = [get_df_from_response(r)] if page == -1: data_text = r.text total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0] tqdm = get_tqdm() for p in tqdm(range(2, total_page + 1), leave=False): params.update({"page": str(p)}) r = requests.get(url, params=params) data_list.append(get_df_from_response(r)) big_df = pd.concat(objs=data_list, ignore_index=True) big_df.reset_index(inplace=True) big_df.loc[:, "index"] = big_df["index"] + 1 # 处理空数据时报错的问题 if big_df.empty: big_df = big_df.reindex( columns=[ "序号", "基金代码", "基金简称", "拆分折算日", "拆分类型", "拆分折算", "-", ] ) big_df.columns = [ "序号", "基金代码", "基金简称", "拆分折算日", "拆分类型", "拆分折算", "-", ] big_df = big_df[ ["序号", "基金代码", "基金简称", "拆分折算日", "拆分类型", "拆分折算"] ] big_df["拆分折算日"] = pd.to_datetime(big_df["拆分折算日"]).dt.date big_df["拆分折算"] = pd.to_numeric(big_df["拆分折算"], errors="coerce") return big_df def fund_fh_rank_em() -> pd.DataFrame: """ 天天基金网-基金数据-分红送配-基金分红排行 https://fund.eastmoney.com/data/fundleijifenhong.html :return: 基金分红排行 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/Data/funddataIndex_Interface.aspx" params = { "dt": "10", "page": "1", "rank": "FHFCZ", "sort": "desc", "gs": "", "ftype": "", } r = requests.get(url, params=params) data_text = r.text total_page = eval(data_text[data_text.find("=") + 1: data_text.find(";")])[0] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update({"page": str(page)}) r = requests.get(url, params=params) data_text = r.text temp_list = eval( data_text[data_text.find("[["): data_text.find(";var fhph_jjgs")] ) temp_df = pd.DataFrame(temp_list) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df.index + 1 # 处理空数据时报错的问题 if big_df.empty: big_df = big_df.reindex( columns=[ "序号", "基金代码", "基金简称", "累计分红", "累计次数", "成立日期", "-", ] ) big_df.columns = [ "序号", "基金代码", "基金简称", "累计分红", "累计次数", "成立日期", "-", ] big_df = big_df[ ["序号", "基金代码", "基金简称", "累计分红", "累计次数", "成立日期"] ] big_df["成立日期"] = pd.to_datetime(big_df["成立日期"]).dt.date big_df["累计分红"] = pd.to_numeric(big_df["累计分红"], errors="coerce") big_df["累计次数"] = pd.to_numeric(big_df["累计次数"], errors="coerce") return big_df if __name__ == "__main__": fund_fh_em_df = fund_fh_em(year="2025") print(fund_fh_em_df) fund_cf_em_df = fund_cf_em(year="2025") print(fund_cf_em_df) fund_fh_rank_em_df = fund_fh_rank_em() print(fund_fh_rank_em_df) ================================================ FILE: akshare/fund/fund_init_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/11/7 18:30 Desc: 基金数据-新发基金-新成立基金 https://fund.eastmoney.com/data/xinfound.html """ import pandas as pd import requests from akshare.utils import demjson def fund_new_found_em() -> pd.DataFrame: """ 基金数据-新发基金-新成立基金 https://fund.eastmoney.com/data/xinfound.html :return: 新成立基金 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/FundNewIssue.aspx" params = { "t": "xcln", "sort": "jzrgq,desc", "y": "", "page": "1,50000", "isbuy": "1", "v": "0.4069919776543214", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text.strip("var newfunddata=")) temp_df = pd.DataFrame(data_json["datas"]) temp_df.columns = [ "基金代码", "基金简称", "发行公司", "_", "基金类型", "募集份额", "成立日期", "成立来涨幅", "基金经理", "申购状态", "集中认购期", "_", "_", "_", "_", "_", "_", "_", "优惠费率", ] temp_df = temp_df[ [ "基金代码", "基金简称", "发行公司", "基金类型", "集中认购期", "募集份额", "成立日期", "成立来涨幅", "基金经理", "申购状态", "优惠费率", ] ] 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["优惠费率"], errors="coerce") return temp_df if __name__ == "__main__": fund_new_found_em_df = fund_new_found_em() print(fund_new_found_em_df) ================================================ FILE: akshare/fund/fund_init_ths.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/2/27 Desc: 同花顺-新发基金 https://fund.10jqka.com.cn/datacenter/xfjj/ """ import json import pandas as pd import requests def fund_new_found_ths(symbol: str = "全部") -> pd.DataFrame: """ 同花顺-基金数据-新发基金 https://fund.10jqka.com.cn/datacenter/xfjj/ :param symbol: 选择基金类型; choice of {"全部", "发行中", "将发行"} :type symbol: str :return: 新发基金数据 :rtype: pandas.DataFrame """ url = "https://fund.10jqka.com.cn/datacenter/xfjj/" r = requests.get(url, timeout=15) r.encoding = "utf-8" # 从页面中提取 jsonData # 找到 jsonData= 的位置 start_idx = r.text.find("jsonData=") if start_idx == -1: raise ValueError("未找到 jsonData,可能页面结构已变化") # 找到第一个 { start_bracket = r.text.find("{", start_idx) if start_bracket == -1: raise ValueError("未找到 JSON 开始括号") # 通过计数括号找到完整的JSON对象 count = 0 end_idx = start_bracket for i in range(start_bracket, len(r.text)): if r.text[i] == "{": count += 1 elif r.text[i] == "}": count -= 1 if count == 0: end_idx = i + 1 break if end_idx == start_bracket: raise ValueError("未找到完整的 JSON 对象") json_str = r.text[start_bracket:end_idx] data_json = json.loads(json_str) # 转换为 DataFrame temp_df = pd.DataFrame(data_json).T temp_df.reset_index(inplace=True, drop=True) # 根据 symbol 筛选数据 if symbol == "发行中": # 发行中: zzfx=1 temp_df = temp_df[temp_df["zzfx"] == 1] elif symbol == "将发行": # 将发行: zzfx != 1 (即 buy=0 且起始日在未来) temp_df = temp_df[temp_df["zzfx"] != 1] # 提取 manager 字段(可能是数组) if "manager" in temp_df.columns: temp_df["manager"] = temp_df["manager"].apply( lambda x: x[0] if isinstance(x, list) and len(x) > 0 else (x if pd.notna(x) else "") ) # 重命名列 temp_df.rename( columns={ "code": "基金代码", "name": "基金名称", "type": "投资类型", "jjlx": "基金类型", "tzfg": "投资风格", "start": "募集起始日", "end": "募集终止日", "orgname": "管理人", "manager": "基金经理", "zgrgfl": "认购费率", "zdrg": "最低认购", "zdje": "认购金额", "zzfx": "发行中", "buy": "可购买", }, inplace=True, ) # 选择需要的列 columns_order = [ "基金代码", "基金名称", "投资类型", "募集起始日", "募集终止日", "管理人", "基金经理", "认购费率", "最低认购", "基金类型", "投资风格", ] # 只保留存在的列 existing_columns = [col for col in columns_order if col in temp_df.columns] temp_df = temp_df[existing_columns] # 数据类型转换 if "募集起始日" in temp_df.columns: temp_df["募集起始日"] = pd.to_datetime(temp_df["募集起始日"], errors="coerce").dt.date if "募集终止日" in temp_df.columns: temp_df["募集终止日"] = pd.to_datetime(temp_df["募集终止日"], errors="coerce").dt.date if "认购费率" in temp_df.columns: temp_df["认购费率"] = pd.to_numeric(temp_df["认购费率"], errors="coerce") if "最低认购" in temp_df.columns: temp_df["最低认购"] = pd.to_numeric(temp_df["最低认购"], errors="coerce") return temp_df if __name__ == "__main__": # 测试获取全部新发基金 fund_new_found_ths_df = fund_new_found_ths(symbol="全部") print(fund_new_found_ths_df) # 测试获取发行中的基金 fund_new_found_ths_issue_df = fund_new_found_ths(symbol="发行中") print(fund_new_found_ths_issue_df) # 测试获取将发行的基金 fund_new_found_ths_future_df = fund_new_found_ths(symbol="将发行") print(fund_new_found_ths_future_df) ================================================ FILE: akshare/fund/fund_lof_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/3/11 17:00 Desc: 东方财富-LOF 行情 https://quote.eastmoney.com/center/gridlist.html#fund_lof https://quote.eastmoney.com/sz166009.html """ from functools import lru_cache import pandas as pd import requests from akshare.utils.func import fetch_paginated_data @lru_cache() def _fund_lof_code_id_map_em() -> dict: """ 东方财富-LOF 代码和市场标识映射 https://quote.eastmoney.com/center/gridlist.html#fund_lof :return: LOF 代码和市场标识映射 :rtype: pandas.DataFrame """ url = "https://2.push2.eastmoney.com/api/qt/clist/get" params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "wbp2u": "|0|0|0|web", "fid": "f12", "fs": "b:MK0404,b:MK0405,b:MK0406,b:MK0407", "fields": "f3,f12,f13", } temp_df = fetch_paginated_data(url, params) temp_dict = dict(zip(temp_df["f12"], temp_df["f13"])) return temp_dict def fund_lof_spot_em() -> pd.DataFrame: """ 东方财富-LOF 实时行情 https://quote.eastmoney.com/center/gridlist.html#fund_lof :return: LOF 实时行情 :rtype: pandas.DataFrame """ url = "https://88.push2.eastmoney.com/api/qt/clist/get" params = { "pn": "1", "pz": "100", "po": "1", "np": "1", "ut": "bd1d9ddb04089700cf9c27f6f7426281", "fltt": "2", "invt": "2", "wbp2u": "|0|0|0|web", "fid": "f3", "fs": "b:MK0404,b:MK0405,b:MK0406,b:MK0407", "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14," "f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152", } temp_df = fetch_paginated_data(url, params) temp_df.rename( columns={ "f12": "代码", "f14": "名称", "f2": "最新价", "f4": "涨跌额", "f3": "涨跌幅", "f5": "成交量", "f6": "成交额", "f17": "开盘价", "f15": "最高价", "f16": "最低价", "f18": "昨收", "f8": "换手率", "f21": "流通市值", "f20": "总市值", }, inplace=True, ) temp_df = temp_df[ [ "代码", "名称", "最新价", "涨跌额", "涨跌幅", "成交量", "成交额", "开盘价", "最高价", "最低价", "昨收", "换手率", "流通市值", "总市值", ] ] 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") 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") 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") 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") return temp_df def fund_lof_hist_em( symbol: str = "166009", period: str = "daily", start_date: str = "19700101", end_date: str = "20500101", adjust: str = "", ) -> pd.DataFrame: """ 东方财富-LOF 行情 https://quote.eastmoney.com/sz166009.html :param symbol: LOF 代码 :type symbol: str :param period: choice of {'daily', 'weekly', 'monthly'} :type period: str :param start_date: 开始日期 :type start_date: str :param end_date: 结束日期 :type end_date: str :param adjust: choice of {"qfq": "前复权", "hfq": "后复权", "": "不复权"} :type adjust: str :return: 每日行情 :rtype: pandas.DataFrame """ code_id_dict = _fund_lof_code_id_map_em() adjust_dict = {"qfq": "1", "hfq": "2", "": "0"} period_dict = {"daily": "101", "weekly": "102", "monthly": "103"} url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "fields1": "f1,f2,f3,f4,f5,f6", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f116", "ut": "7eea3edcaed734bea9cbfc24409ed989", "klt": period_dict[period], "fqt": adjust_dict[adjust], "secid": f"{code_id_dict[symbol]}.{symbol}", "beg": start_date, "end": end_date, } r = requests.get(url, params=params) data_json = r.json() if not (data_json["data"] and data_json["data"]["klines"]): return pd.DataFrame() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) temp_df.columns = [ "日期", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "振幅", "涨跌幅", "涨跌额", "换手率", ] temp_df.index = pd.to_datetime(temp_df["日期"]) temp_df.reset_index(inplace=True, drop=True) 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") 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") 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") temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce") return temp_df def fund_lof_hist_min_em( symbol: str = "166009", start_date: str = "1979-09-01 09:32:00", end_date: str = "2222-01-01 09:32:00", period: str = "5", adjust: str = "", ) -> pd.DataFrame: """ 东方财富-LOF 分时行情 https://quote.eastmoney.com/sz166009.html :param symbol: LOF 代码 :type symbol: str :param start_date: 开始日期时间 :type start_date: str :param end_date: 结束日期时间 :type end_date: str :param period: choice of {"1", "5", "15", "30", "60"} :type period: str :param adjust: choice of {'', 'qfq', 'hfq'} :type adjust: str :return: 每日分时行情 :rtype: pandas.DataFrame """ code_id_dict = _fund_lof_code_id_map_em() adjust_map = { "": "0", "qfq": "1", "hfq": "2", } if period == "1": url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get" params = { "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58", "ut": "7eea3edcaed734bea9cbfc24409ed989", "ndays": "5", "iscr": "0", "secid": f"{code_id_dict[symbol]}.{symbol}", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame( [item.split(",") for item in data_json["data"]["trends"]] ) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "均价", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") temp_df["均价"] = pd.to_numeric(temp_df["均价"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str) return temp_df else: url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "fields1": "f1,f2,f3,f4,f5,f6", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61", "ut": "7eea3edcaed734bea9cbfc24409ed989", "klt": period, "fqt": adjust_map[adjust], "secid": f"{code_id_dict[symbol]}.{symbol}", "beg": "0", "end": "20500000", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame( [item.split(",") for item in data_json["data"]["klines"]] ) temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "振幅", "涨跌幅", "涨跌额", "换手率", ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") 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") temp_df["换手率"] = pd.to_numeric(temp_df["换手率"], errors="coerce") temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str) temp_df = temp_df[ [ "时间", "开盘", "收盘", "最高", "最低", "涨跌幅", "涨跌额", "成交量", "成交额", "振幅", "换手率", ] ] return temp_df if __name__ == "__main__": fund_lof_spot_em_df = fund_lof_spot_em() print(fund_lof_spot_em_df) fund_lof_hist_em_df = fund_lof_hist_em( symbol="166009", period="daily", start_date="20000101", end_date="20230703", adjust="", ) print(fund_lof_hist_em_df) fund_lof_hist_qfq_em_df = fund_lof_hist_em( symbol="166009", period="daily", start_date="20000101", end_date="20230703", adjust="qfq", ) print(fund_lof_hist_qfq_em_df) fund_lof_hist_em_df = fund_lof_hist_em( symbol="166009", period="daily", start_date="20000101", end_date="20250311", adjust="hfq", ) print(fund_lof_hist_em_df) fund_lof_hist_min_em_df = fund_lof_hist_min_em( symbol="166009", period="1", adjust="", start_date="2025-03-11 09:30:00", end_date="2025-03-11 14:40:00", ) print(fund_lof_hist_min_em_df) ================================================ FILE: akshare/fund/fund_manager.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/9/14 18:00 Desc: 基金经理大全 https://fund.eastmoney.com/manager/default.html """ import pandas as pd import requests from akshare.utils import demjson from akshare.utils.tqdm import get_tqdm def fund_manager_em() -> pd.DataFrame: """ 天天基金网-基金数据-基金经理大全 https://fund.eastmoney.com/manager/default.html :return: 基金经理大全 :rtype: pandas.DataFrame """ big_df = pd.DataFrame() url = "https://fund.eastmoney.com/Data/FundDataPortfolio_Interface.aspx" params = { "dt": "14", "mc": "returnjson", "ft": "all", "pn": "500", "pi": "1", "sc": "abbname", "st": "asc", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text.strip("var returnjson= ")) total_page = data_json["pages"] tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update( { "pi": page, } ) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text.strip("var returnjson= ")) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = range(1, len(big_df) + 1) big_df.columns = [ "序号", "_", "姓名", "_", "所属公司", "现任基金代码", "现任基金", "累计从业时间", "现任基金最佳回报", "_", "_", "现任基金资产总规模", "_", ] big_df = big_df[ [ "序号", "姓名", "所属公司", "现任基金代码", "现任基金", "累计从业时间", "现任基金资产总规模", "现任基金最佳回报", ] ] big_df["现任基金最佳回报"] = ( big_df["现任基金最佳回报"].str.split("%", expand=True).iloc[:, 0] ) big_df["现任基金资产总规模"] = ( big_df["现任基金资产总规模"].str.split("亿元", expand=True).iloc[:, 0] ) big_df["累计从业时间"] = pd.to_numeric(big_df["累计从业时间"], errors="coerce") big_df["现任基金最佳回报"] = pd.to_numeric( big_df["现任基金最佳回报"], errors="coerce" ) big_df["现任基金资产总规模"] = pd.to_numeric( big_df["现任基金资产总规模"], errors="coerce" ) big_df["现任基金代码"] = big_df["现任基金代码"].apply(lambda x: x.split(",")) big_df["现任基金"] = big_df["现任基金"].apply(lambda x: x.split(",")) big_df = big_df.explode(column=["现任基金代码", "现任基金"]) big_df.reset_index(drop=True, inplace=True) return big_df if __name__ == "__main__": fund_manager_em_df = fund_manager_em() print(fund_manager_em_df) ================================================ FILE: akshare/fund/fund_overview_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/9/16 21:00 Desc: 天天基金-基金档案 https://fundf10.eastmoney.com/jbgk_015641.html """ from io import StringIO import pandas as pd import requests def fund_overview_em(symbol: str = "015641") -> pd.DataFrame: """ 天天基金-基金档案-基本概况 https://fundf10.eastmoney.com/jbgk_015641.html :param symbol: 基金代码 :type symbol: str :return: 基本概况 :rtype: pandas.DataFrame """ url = f"https://fundf10.eastmoney.com/jbgk_{symbol}.html" r = requests.get(url) html_content = pd.read_html(StringIO(r.text)) if len(html_content) == 0: temp_df = pd.DataFrame([]) else: df_dict = {} # 最后一个表格的数据是我们想要的,按照Key-Value的形式存储 for _, row in html_content[-1].iterrows(): df_dict[row[0]] = row[1] df_dict[row[2]] = row[3] temp_df = pd.DataFrame([df_dict]) return temp_df if __name__ == "__main__": fund_overview_em_df = fund_overview_em(symbol="015641") print(fund_overview_em_df) ================================================ FILE: akshare/fund/fund_portfolio_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/6/7 20:00 Desc: 天天基金网-基金档案-投资组合 https://fundf10.eastmoney.com/ccmx_000001.html """ from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup from akshare.utils import demjson def fund_portfolio_hold_em(symbol: str = "000001", date: str = "2024") -> pd.DataFrame: """ 天天基金网-基金档案-投资组合-基金持仓 https://fundf10.eastmoney.com/ccmx_000001.html :param symbol: 基金代码 :type symbol: str :param date: 查询年份 :type date: str :return: 基金持仓 :rtype: pandas.DataFrame """ url = "https://fundf10.eastmoney.com/FundArchivesDatas.aspx" params = { "type": "jjcc", "code": symbol, "topline": "10000", "year": date, "month": "", "rt": "0.913877030254846", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) soup = BeautifulSoup(data_json["content"], features="lxml") item_label = [ item.text.split("\xa0\xa0")[1] for item in soup.find_all(name="h4", attrs={"class": "t"}) ] column_name = [ "序号", "股票代码", "股票名称", "占净值比例", "持股数", "持仓市值", "季度", ] big_df = pd.DataFrame(columns=column_name) for item in range(len(item_label)): temp_df = pd.read_html( StringIO(data_json["content"]), converters={"股票代码": str} )[item] del temp_df["相关资讯"] temp_df.rename(columns={"占净值 比例": "占净值比例"}, inplace=True) temp_df["占净值比例"] = ( temp_df["占净值比例"].str.split("%", expand=True).iloc[:, 0] ) temp_df.rename( columns={"持股数(万股)": "持股数", "持仓市值(万元)": "持仓市值"}, inplace=True, ) temp_df.rename( columns={"持股数 (万股)": "持股数", "持仓市值 (万元)": "持仓市值"}, inplace=True, ) temp_df.rename( columns={"持股数(万股)": "持股数", "持仓市值(万元人民币)": "持仓市值"}, inplace=True, ) temp_df.rename( columns={ "持股数 (万股)": "持股数", "持仓市值 (万元人民币)": "持仓市值", }, inplace=True, ) temp_df["季度"] = item_label[item] temp_df = temp_df[column_name] big_df = ( pd.concat(objs=[temp_df, big_df], ignore_index=True) if not big_df.empty else temp_df ) if not big_df.empty: big_df["占净值比例"] = pd.to_numeric(big_df["占净值比例"], errors="coerce") big_df["持股数"] = pd.to_numeric(big_df["持股数"], errors="coerce") big_df["持仓市值"] = pd.to_numeric(big_df["持仓市值"], errors="coerce") del big_df["序号"] big_df.reset_index(inplace=True, drop=False) big_df["index"] = big_df["index"] + 1 big_df.rename(columns={"index": "序号"}, inplace=True) return big_df def fund_portfolio_bond_hold_em( symbol: str = "000001", date: str = "2023" ) -> pd.DataFrame: """ 天天基金网-基金档案-投资组合-债券持仓 https://fundf10.eastmoney.com/ccmx1_000001.html :param symbol: 基金代码 :type symbol: str :param date: 查询年份 :type date: str :return: 债券持仓 :rtype: pandas.DataFrame """ url = "https://fundf10.eastmoney.com/FundArchivesDatas.aspx" params = { "type": "zqcc", "code": symbol, "year": date, "rt": "0.913877030254846", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) soup = BeautifulSoup(data_json["content"], features="lxml") item_label = [ item.text.split("\xa0\xa0")[1] for item in soup.find_all(name="h4", attrs={"class": "t"}) ] big_df = pd.DataFrame() for item in range(len(item_label)): temp_df = pd.read_html( StringIO(data_json["content"]), converters={"债券代码": str} )[item] temp_df["占净值比例"] = ( temp_df["占净值比例"].str.split("%", expand=True).iloc[:, 0] ) temp_df.rename(columns={"持仓市值(万元)": "持仓市值"}, inplace=True) temp_df["季度"] = item_label[item] temp_df = temp_df[ [ "序号", "债券代码", "债券名称", "占净值比例", "持仓市值", "季度", ] ] big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df["占净值比例"] = pd.to_numeric(big_df["占净值比例"], errors="coerce") big_df["持仓市值"] = pd.to_numeric(big_df["持仓市值"], errors="coerce") big_df["序号"] = range(1, len(big_df) + 1) return big_df def fund_portfolio_industry_allocation_em( symbol: str = "000001", date: str = "2023" ) -> pd.DataFrame: """ 天天基金网-基金档案-投资组合-行业配置 https://fundf10.eastmoney.com/hytz_000001.html :param symbol: 基金代码 :type symbol: str :param date: 查询年份 :type date: str :return: 行业配置 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/f10/HYPZ/" headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "api.fund.eastmoney.com", "Pragma": "no-cache", "Referer": "https://fundf10.eastmoney.com/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/99.0.4844.82 Safari/537.36", } params = { "fundCode": symbol, "year": date, "callback": "jQuery183006997159478989867_1648016188499", } r = requests.get(url, params=params, headers=headers) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) temp_list = [] for item in data_json["Data"]["QuarterInfos"]: temp_list.extend(item["HYPZInfo"]) temp_df = pd.DataFrame(temp_list) temp_df.reset_index(inplace=True) temp_df["index"] = temp_df.index + 1 temp_df.columns = [ "序号", "-", "截止时间", "-", "行业类别", "市值", "-", "占净值比例", "-", "-", "-", "-", "-", "-", "-", "-", "-", ] temp_df = temp_df[ [ "序号", "行业类别", "占净值比例", "市值", "截止时间", ] ] temp_df["市值"] = pd.to_numeric(temp_df["市值"], errors="coerce") temp_df["占净值比例"] = pd.to_numeric(temp_df["占净值比例"], errors="coerce") return temp_df def fund_portfolio_change_em( symbol: str = "003567", indicator: str = "累计买入", date: str = "2023" ) -> pd.DataFrame: """ 天天基金网-基金档案-投资组合-重大变动 https://fundf10.eastmoney.com/ccbd_000001.html :param symbol: 基金代码 :type symbol: str :param indicator: choice of {"累计买入", "累计卖出"} :type indicator: str :param date: 查询年份 :type date: str :return: 重大变动 :rtype: pandas.DataFrame """ indicator_map = { "累计买入": "1", "累计卖出": "2", } url = "https://fundf10.eastmoney.com/FundArchivesDatas.aspx" params = { "type": "zdbd", "code": symbol, "zdbd": indicator_map[indicator], "year": date, "rt": "0.913877030254846", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) soup = BeautifulSoup(data_json["content"], features="lxml") item_label = [ item.text.split("\xa0\xa0")[1] for item in soup.find_all(name="h4", attrs={"class": "t"}) ] big_df = pd.DataFrame() for item in range(len(item_label)): temp_df = pd.read_html( StringIO(data_json["content"]), converters={"股票代码": str} )[item] del temp_df["相关资讯"] temp_df["占期初基金资产净值比例(%)"] = ( temp_df["占期初基金资产净值比例(%)"] .str.split("%", expand=True) .iloc[:, 0] ) temp_df["季度"] = item_label[item] temp_df.columns = [ "序号", "股票代码", "股票名称", "本期累计买入金额", "占期初基金资产净值比例", "季度", ] temp_df = temp_df[ [ "序号", "股票代码", "股票名称", "本期累计买入金额", "占期初基金资产净值比例", "季度", ] ] big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) del big_df["序号"] big_df.reset_index(inplace=True) big_df["index"] = big_df.index + 1 big_df.rename(columns={"index": "序号"}, inplace=True) big_df["本期累计买入金额"] = pd.to_numeric( big_df["本期累计买入金额"], errors="coerce" ) big_df["占期初基金资产净值比例"] = pd.to_numeric( big_df["占期初基金资产净值比例"], errors="coerce" ) return big_df if __name__ == "__main__": fund_portfolio_hold_em_df = fund_portfolio_hold_em(symbol="000001", date="2024") print(fund_portfolio_hold_em_df) fund_portfolio_bond_hold_em_df = fund_portfolio_bond_hold_em( symbol="000001", date="2023" ) print(fund_portfolio_bond_hold_em_df) fund_portfolio_industry_allocation_em_df = fund_portfolio_industry_allocation_em( symbol="000001", date="2023" ) print(fund_portfolio_industry_allocation_em_df) fund_portfolio_change_em_df = fund_portfolio_change_em( symbol="003567", indicator="累计买入", date="2023" ) print(fund_portfolio_change_em_df) fund_portfolio_change_em_df = fund_portfolio_change_em( symbol="003567", indicator="累计卖出", date="2023" ) print(fund_portfolio_change_em_df) ================================================ FILE: akshare/fund/fund_position_lg.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/4/5 22:05 Desc: 乐咕乐股-基金仓位 https://legulegu.com/stockdata/fund-position/pos-stock """ import pandas as pd import requests from akshare.stock_feature.stock_a_indicator import get_token_lg, get_cookie_csrf def fund_stock_position_lg() -> pd.DataFrame: """ 乐咕乐股-基金仓位-股票型基金仓位 https://legulegu.com/stockdata/fund-position/pos-stock :return: 股票型基金仓位 :rtype: pandas.DataFrame """ url = "https://legulegu.com/api/stockdata/fund-position" token = get_token_lg() params = { "token": token, "type": "pos_stock", "category": "总仓位", "marketId": "5", } r = requests.get( url, params=params, **get_cookie_csrf(url="https://legulegu.com/stockdata/fund-position/pos-stock"), ) data_json = r.json() temp_df = pd.DataFrame(data_json) temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df = temp_df[ [ "date", "close", "position", ] ] temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce") temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce") return temp_df def fund_balance_position_lg() -> pd.DataFrame: """ 乐咕乐股-基金仓位-平衡混合型基金仓位 https://legulegu.com/stockdata/fund-position/pos-pingheng :return: 平衡混合型基金仓位 :rtype: pandas.DataFrame """ url = "https://legulegu.com/api/stockdata/fund-position" token = get_token_lg() params = { "token": token, "type": "pos_pingheng", "category": "总仓位", "marketId": "5", } r = requests.get( url, params=params, **get_cookie_csrf( url="https://legulegu.com/stockdata/fund-position/pos-pingheng" ), ) data_json = r.json() temp_df = pd.DataFrame(data_json) temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df = temp_df[ [ "date", "close", "position", ] ] temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce") temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce") return temp_df def fund_linghuo_position_lg() -> pd.DataFrame: """ 乐咕乐股-基金仓位-灵活配置型基金仓位 https://legulegu.com/stockdata/fund-position/pos-linghuo :return: 灵活配置型基金仓位 :rtype: pandas.DataFrame """ url = "https://legulegu.com/api/stockdata/fund-position" token = get_token_lg() params = { "token": token, "type": "pos_linghuo", "category": "总仓位", "marketId": "5", } r = requests.get( url, params=params, **get_cookie_csrf( url="https://legulegu.com/stockdata/fund-position/pos-linghuo" ), ) data_json = r.json() temp_df = pd.DataFrame(data_json) temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df = temp_df[ [ "date", "close", "position", ] ] temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date temp_df["close"] = pd.to_numeric(temp_df["close"], errors="coerce") temp_df["position"] = pd.to_numeric(temp_df["position"], errors="coerce") return temp_df if __name__ == "__main__": fund_stock_position_lg_df = fund_stock_position_lg() print(fund_stock_position_lg_df) fund_balance_position_lg_df = fund_balance_position_lg() print(fund_balance_position_lg_df) fund_linghuo_position_lg_df = fund_linghuo_position_lg() print(fund_linghuo_position_lg_df) ================================================ FILE: akshare/fund/fund_rank_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/7/24 13:00 Desc: 东方财富网-数据中心-开放基金排行 https://fund.eastmoney.com/data/fundranking.html 名词解释 https://help.1234567.com.cn/list_236.html """ from datetime import datetime, date import pandas as pd import requests from akshare.utils import demjson def __one_year_ago(date_str: str) -> date: # 将字符串格式的日期转换为date对象 given_date = date(int(date_str[0:4]), int(date_str[4:6]), int(date_str[6:8])) try: # 尝试直接设置为前一年,保持相同的月和日 one_year_before = given_date.replace(year=given_date.year - 1) except ValueError: # 如果前一年没有相同的月和日(比如2月29日),则设置为2月28日 one_year_before = given_date.replace(year=given_date.year - 1, day=28) return one_year_before def fund_open_fund_rank_em(symbol: str = "全部") -> pd.DataFrame: """ 东方财富网-数据中心-开放基金排行 https://fund.eastmoney.com/data/fundranking.html :param symbol: choice of {"全部", "股票型", "混合型", "债券型", "指数型", "QDII", "FOF"} :type symbol: str :return: 开放基金排行 :rtype: pandas.DataFrame """ current_date = datetime.now().date().isoformat() last_date = __one_year_ago(current_date.replace("-", "")).isoformat() url = "https://fund.eastmoney.com/data/rankhandler.aspx" type_map = { "全部": ["all", "1nzf"], "股票型": ["gp", "1nzf"], "混合型": ["hh", "1nzf"], "债券型": ["zq", "1nzf"], "指数型": ["zs", "1nzf"], "QDII": ["qdii", "1nzf"], "LOF": ["lof", "1nzf"], "FOF": ["fof", "1nzf"], } params = { "op": "ph", "dt": "kf", "ft": type_map[symbol][0], "rs": "", "gs": "0", "sc": type_map[symbol][1], "st": "desc", "sd": last_date, "ed": current_date, "qdii": "", "tabSubtype": ",,,,,", "pi": "1", "pn": "30000", "dx": "1", "v": "0.1591891419018292", } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", "Referer": "https://fund.eastmoney.com/fundguzhi.html", } r = requests.get(url, params=params, headers=headers) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) temp_df = pd.DataFrame(data_json["datas"]) temp_df = temp_df.iloc[:, 0].str.split(",", expand=True) temp_df.reset_index(inplace=True) temp_df["index"] = list(range(1, len(temp_df) + 1)) temp_df.columns = [ "序号", "基金代码", "基金简称", "_", "日期", "单位净值", "累计净值", "日增长率", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "_", "_", "自定义", "_", "手续费", "_", "_", "_", "_", ] temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "日期", "单位净值", "累计净值", "日增长率", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "自定义", "手续费", ] ] 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") temp_df["近1周"] = pd.to_numeric(temp_df["近1周"], errors="coerce") temp_df["近1月"] = pd.to_numeric(temp_df["近1月"], errors="coerce") temp_df["近3月"] = pd.to_numeric(temp_df["近3月"], errors="coerce") temp_df["近6月"] = pd.to_numeric(temp_df["近6月"], errors="coerce") temp_df["近1年"] = pd.to_numeric(temp_df["近1年"], errors="coerce") temp_df["近2年"] = pd.to_numeric(temp_df["近2年"], errors="coerce") temp_df["近3年"] = pd.to_numeric(temp_df["近3年"], errors="coerce") 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") return temp_df def fund_exchange_rank_em() -> pd.DataFrame: """ 东方财富网-数据中心-场内交易基金排行 https://fund.eastmoney.com/data/fbsfundranking.html :return: 场内交易基金数据 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/rankhandler.aspx" params = { "op": "ph", "dt": "fb", "ft": "ct", "rs": "", "gs": "0", "sc": "1nzf", "st": "desc", "pi": "1", "pn": "30000", "v": "0.1591891419018292", } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", "Referer": "https://fund.eastmoney.com/fundguzhi.html", } r = requests.get(url, params=params, headers=headers) text_data = r.text json_data = demjson.decode(text_data[text_data.find("{") : -1]) temp_df = pd.DataFrame(json_data["datas"]) temp_df = temp_df.iloc[:, 0].str.split(",", expand=True) temp_df.reset_index(inplace=True) temp_df["index"] = list(range(1, len(temp_df) + 1)) temp_df.columns = [ "序号", "基金代码", "基金简称", "_", "日期", "单位净值", "累计净值", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "成立日期", "_", "_", "_", "_", "_", "类型", "_", ] temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "类型", "日期", "单位净值", "累计净值", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "成立日期", ] ] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["成立日期"] = pd.to_datetime(temp_df["成立日期"]).dt.date temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["累计净值"] = pd.to_numeric(temp_df["累计净值"], errors="coerce") temp_df["近1周"] = pd.to_numeric(temp_df["近1周"], errors="coerce") temp_df["近1月"] = pd.to_numeric(temp_df["近1月"], errors="coerce") temp_df["近3月"] = pd.to_numeric(temp_df["近3月"], errors="coerce") temp_df["近6月"] = pd.to_numeric(temp_df["近6月"], errors="coerce") temp_df["近1年"] = pd.to_numeric(temp_df["近1年"], errors="coerce") temp_df["近2年"] = pd.to_numeric(temp_df["近2年"], errors="coerce") temp_df["近3年"] = pd.to_numeric(temp_df["近3年"], errors="coerce") temp_df["今年来"] = pd.to_numeric(temp_df["今年来"], errors="coerce") temp_df["成立来"] = pd.to_numeric(temp_df["成立来"], errors="coerce") return temp_df def fund_money_rank_em() -> pd.DataFrame: """ 东方财富网-数据中心-货币型基金排行 https://fund.eastmoney.com/data/hbxfundranking.html :return: 货币型基金排行 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/FundRank/GetHbRankList" params = { "intCompany": "0", "MinsgType": "", "IsSale": "1", "strSortCol": "SYL_1N", "orderType": "desc", "pageIndex": "1", "pageSize": "10000", } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", "Referer": "https://fund.eastmoney.com/fundguzhi.html", } r = requests.get(url, params=params, headers=headers) json_data = r.json() temp_df = pd.DataFrame(json_data["Data"]) temp_df.reset_index(inplace=True) temp_df["index"] = list(range(1, len(temp_df) + 1)) temp_df.columns = [ "序号", "近1年", "近2年", "近3年", "近5年", "_", "_", "基金代码", "基金简称", "日期", "万份收益", "年化收益率7日", "_", "年化收益率14日", "年化收益率28日", "近1月", "近3月", "近6月", "今年来", "成立来", "_", "手续费", "_", "_", "_", "_", "_", "_", ] temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "日期", "万份收益", "年化收益率7日", "年化收益率14日", "年化收益率28日", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "近5年", "今年来", "成立来", "手续费", ] ] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["万份收益"] = pd.to_numeric(temp_df["万份收益"], errors="coerce") temp_df["年化收益率7日"] = pd.to_numeric(temp_df["年化收益率7日"], errors="coerce") temp_df["年化收益率14日"] = pd.to_numeric( temp_df["年化收益率14日"], errors="coerce" ) temp_df["年化收益率28日"] = pd.to_numeric( temp_df["年化收益率28日"], errors="coerce" ) temp_df["近1月"] = pd.to_numeric(temp_df["近1月"], errors="coerce") temp_df["近3月"] = pd.to_numeric(temp_df["近3月"], errors="coerce") temp_df["近6月"] = pd.to_numeric(temp_df["近6月"], errors="coerce") temp_df["近1年"] = pd.to_numeric(temp_df["近1年"], errors="coerce") temp_df["近2年"] = pd.to_numeric(temp_df["近2年"], errors="coerce") temp_df["近3年"] = pd.to_numeric(temp_df["近3年"], errors="coerce") temp_df["近5年"] = pd.to_numeric(temp_df["近5年"], errors="coerce") temp_df["今年来"] = pd.to_numeric(temp_df["今年来"], errors="coerce") temp_df["成立来"] = pd.to_numeric(temp_df["成立来"], errors="coerce") return temp_df def fund_lcx_rank_em() -> pd.DataFrame: """ 东方财富网-数据中心-理财基金排行 # 该接口暂时没有数据 https://fund.eastmoney.com/data/lcxfundranking.html#t;c0;r;sSYL_Z;ddesc;pn50;f;os1; :return: 理财基金排行 :rtype: pandas.DataFrame """ url = "https://api.fund.eastmoney.com/FundRank/GetLcRankList" params = { "intCompany": "0", "MinsgType": "undefined", "IsSale": "1", "strSortCol": "SYL_Z", "orderType": "desc", "pageIndex": "1", "pageSize": "50", "FBQ": "", "callback": "jQuery18303264654966943197_1603867158043", } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", "Referer": "https://fund.eastmoney.com/fundguzhi.html", } r = requests.get(url, params=params, headers=headers) try: data_json = r.json() except: # noqa: E722 return pd.DataFrame() temp_df = pd.DataFrame(data_json["Data"]) temp_df.reset_index(inplace=True) temp_df["index"] = list(range(1, len(temp_df) + 1)) temp_df.columns = [ "序号", "近1周", "基金代码", "基金简称", "日期", "万份收益", "年化收益率-7日", "_", "年化收益率-14日", "年化收益率-28日", "近1月", "近3月", "近6月", "今年来", "成立来", "可购买", "手续费", "_", "_", "_", "_", "_", "_", ] temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "日期", "万份收益", "年化收益率-7日", "年化收益率-14日", "年化收益率-28日", "近1周", "近1月", "近3月", "近6月", "今年来", "成立来", "可购买", "手续费", ] ] return temp_df def fund_hk_rank_em() -> pd.DataFrame: """ 东方财富网-数据中心-香港基金排行 https://overseas.1234567.com.cn/FundList :return: 香港基金排行 :rtype: pandas.DataFrame """ format_date = datetime.now().date().isoformat() url = "https://overseas.1234567.com.cn/overseasapi/OpenApiHander.ashx" params = { "api": "HKFDApi", "m": "MethodFundList", "action": "1", "pageindex": "0", "pagesize": "5000", "dy": "1", "date1": format_date, "date2": format_date, "sortfield": "Y", "sorttype": "-1", "isbuy": "0", } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", "Referer": "https://fund.eastmoney.com/fundguzhi.html", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]) temp_df.reset_index(inplace=True) temp_df["index"] = list(range(1, len(temp_df) + 1)) temp_df.columns = [ "序号", "_", "香港基金代码", "基金代码", "_", "基金简称", "可购买", "日期", "单位净值", "日增长率", "_", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "币种", ] temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "币种", "日期", "单位净值", "日增长率", "近1周", "近1月", "近3月", "近6月", "近1年", "近2年", "近3年", "今年来", "成立来", "可购买", "香港基金代码", ] ] 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["近1周"] = pd.to_numeric(temp_df["近1周"], errors="coerce") temp_df["近1月"] = pd.to_numeric(temp_df["近1月"], errors="coerce") temp_df["近3月"] = pd.to_numeric(temp_df["近3月"], errors="coerce") temp_df["近6月"] = pd.to_numeric(temp_df["近6月"], errors="coerce") temp_df["近1年"] = pd.to_numeric(temp_df["近1年"], errors="coerce") temp_df["近2年"] = pd.to_numeric(temp_df["近2年"], errors="coerce") temp_df["近3年"] = pd.to_numeric(temp_df["近3年"], errors="coerce") 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") temp_df["可购买"] = temp_df["可购买"].map( lambda x: "可购买" if x == "1" else "不可购买" ) return temp_df if __name__ == "__main__": fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="全部") print(fund_open_fund_rank_em_df) fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="股票型") print(fund_open_fund_rank_em_df) fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="混合型") print(fund_open_fund_rank_em_df) fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="债券型") print(fund_open_fund_rank_em_df) fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="指数型") print(fund_open_fund_rank_em_df) fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="QDII") print(fund_open_fund_rank_em_df) fund_open_fund_rank_em_df = fund_open_fund_rank_em(symbol="FOF") print(fund_open_fund_rank_em_df) fund_exchange_rank_em_df = fund_exchange_rank_em() print(fund_exchange_rank_em_df) fund_money_rank_em_df = fund_money_rank_em() print(fund_money_rank_em_df) fund_lcx_rank_em_df = fund_lcx_rank_em() print(fund_lcx_rank_em_df) fund_hk_rank_em_df = fund_hk_rank_em() print(fund_hk_rank_em_df) ================================================ FILE: akshare/fund/fund_rating.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/12/12 16:30 Desc: 基金评级 https://fund.eastmoney.com/data/fundrating.html """ import pandas as pd import requests from bs4 import BeautifulSoup def fund_rating_all() -> pd.DataFrame: """ 天天基金网-基金评级-基金评级总汇 https://fund.eastmoney.com/data/fundrating.html :return: 基金评级总汇 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/fundrating.html" r = requests.get(url) soup = BeautifulSoup(r.text, features="lxml") data_text = soup.find(name="div", attrs={"id": "fundinfo"}).find("script").string data_content = [ item.split("|") for item in data_text.split("var")[6] .split("=")[1] .strip() .strip(";") .strip('"') .strip("|") .split("|_") ] temp_df = pd.DataFrame(data_content) temp_df.columns = [ "代码", "简称", "类型", "基金经理", "-", "基金公司", "-", "5星评级家数", "-", "-", "招商证券", "-", "上海证券", "-", "晨星评级", "-", "济安金信", "-", "手续费", "-", "-", "-", "-", "-", "-", "-", "-", ] temp_df = temp_df[ [ "代码", "简称", "基金经理", "基金公司", "5星评级家数", "上海证券", "招商证券", "济安金信", "晨星评级", "手续费", "类型", ] ] temp_df["5星评级家数"] = pd.to_numeric(temp_df["5星评级家数"], errors="coerce") 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") temp_df["晨星评级"] = pd.to_numeric(temp_df["晨星评级"], errors="coerce") temp_df["手续费"] = ( pd.to_numeric(temp_df["手续费"].str.strip("%"), errors="coerce") / 100 ) return temp_df def fund_rating_sh(date: str = "20230630") -> pd.DataFrame: """ 天天基金网-基金评级-上海证券评级 https://fund.eastmoney.com/data/fundrating_3.html :param date: 日期; https://fund.eastmoney.com/data/fundrating_3.html 获取查询日期 :type date: str :return: 上海证券评级 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/fundrating_3.html" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") date_list = [ item["value"] for item in soup.find("select", attrs={"id": "rqoptions"}) ] date_format = "-".join([date[:4], date[4:6], date[6:]]) if date_format not in date_list: raise "请访问 https://fund.eastmoney.com/data/fundrating_3.html 获取查询日期" url = f"https://fund.eastmoney.com/data/fundrating_3_{'-'.join([date[:4], date[4:6], date[6:]])}.html" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") data_text = soup.find("div", attrs={"id": "fundinfo"}).find("script").string data_content = [ item.split("|") for item in data_text.split("var")[1] .split("=")[1] .strip() .strip(";") .strip('"') .strip("|") .split("|_") ] temp_df = pd.DataFrame(data_content) temp_df.columns = [ "代码", "简称", "类型", "基金经理", "_", "基金公司", "_", "3年期评级-3年评级", "3年期评级-较上期", "5年期评级-5年评级", "5年期评级-较上期", "单位净值", "日期", "日增长率", "近1年涨幅", "近3年涨幅", "近5年涨幅", "手续费", "_", "_", "_", "_", ] temp_df = temp_df[ [ "代码", "简称", "基金经理", "基金公司", "3年期评级-3年评级", "3年期评级-较上期", "5年期评级-5年评级", "5年期评级-较上期", "单位净值", "日期", "日增长率", "近1年涨幅", "近3年涨幅", "近5年涨幅", "手续费", "类型", ] ] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["3年期评级-3年评级"] = pd.to_numeric( temp_df["3年期评级-3年评级"], errors="coerce" ) temp_df["3年期评级-较上期"] = pd.to_numeric( temp_df["3年期评级-较上期"], errors="coerce" ) temp_df["5年期评级-5年评级"] = pd.to_numeric( temp_df["5年期评级-5年评级"], errors="coerce" ) temp_df["5年期评级-较上期"] = pd.to_numeric( temp_df["5年期评级-较上期"], errors="coerce" ) temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce") temp_df["近1年涨幅"] = pd.to_numeric(temp_df["近1年涨幅"], errors="coerce") temp_df["近3年涨幅"] = pd.to_numeric(temp_df["近3年涨幅"], errors="coerce") temp_df["近5年涨幅"] = pd.to_numeric(temp_df["近5年涨幅"], errors="coerce") return temp_df def fund_rating_zs(date: str = "20230331") -> pd.DataFrame: """ 天天基金网-基金评级-招商证券评级 https://fund.eastmoney.com/data/fundrating_2.html :param date: 日期; https://fund.eastmoney.com/data/fundrating_2.html 获取查询日期 :type date: str :return: 招商证券评级-混合型 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/fundrating_2.html" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") date_list = [ item["value"] for item in soup.find("select", attrs={"id": "rqoptions"}) ] date_format = "-".join([date[:4], date[4:6], date[6:]]) if date_format not in date_list: raise "请访问 https://fund.eastmoney.com/data/fundrating_2.html 获取查询日期" url = f"https://fund.eastmoney.com/data/fundrating_2_{'-'.join([date[:4], date[4:6], date[6:]])}.html" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") data_text = soup.find("div", attrs={"id": "fundinfo"}).find("script").string data_content = [ item.split("|") for item in data_text.split("var")[1] .split("=")[1] .strip() .strip(";") .strip('"') .strip("|") .split("|_") ] temp_df = pd.DataFrame(data_content) temp_df.columns = [ "代码", "简称", "_", "基金经理", "_", "基金公司", "_", "3年期评级-3年评级", "3年期评级-较上期", "单位净值", "日期", "日增长率", "近1年涨幅", "近3年涨幅", "近5年涨幅", "手续费", "_", "_", "_", "_", ] temp_df = temp_df[ [ "代码", "简称", "基金经理", "基金公司", "3年期评级-3年评级", "3年期评级-较上期", "单位净值", "日期", "日增长率", "近1年涨幅", "近3年涨幅", "近5年涨幅", "手续费", ] ] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["3年期评级-3年评级"] = pd.to_numeric( temp_df["3年期评级-3年评级"], errors="coerce" ) temp_df["3年期评级-较上期"] = pd.to_numeric( temp_df["3年期评级-较上期"], errors="coerce" ) temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce") temp_df["近1年涨幅"] = pd.to_numeric(temp_df["近1年涨幅"], errors="coerce") temp_df["近3年涨幅"] = pd.to_numeric(temp_df["近3年涨幅"], errors="coerce") temp_df["近5年涨幅"] = pd.to_numeric(temp_df["近5年涨幅"], errors="coerce") return temp_df def fund_rating_ja(date: str = "20230331") -> pd.DataFrame: """ 天天基金网-基金评级-济安金信评级 https://fund.eastmoney.com/data/fundrating_4.html :param date: 日期; https://fund.eastmoney.com/data/fundrating_4.html 获取查询日期 :type date: str :return: 济安金信评级 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/fundrating_4.html" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") date_list = [ item["value"] for item in soup.find("select", attrs={"id": "rqoptions"}) ] date_format = "-".join([date[:4], date[4:6], date[6:]]) if date_format not in date_list: raise "请访问 http://fund.eastmoney.com/data/fundrating_4.html 获取查询日期" url = f"https://fund.eastmoney.com/data/fundrating_4_{'-'.join([date[:4], date[4:6], date[6:]])}.html" r = requests.get(url) soup = BeautifulSoup(r.text, "lxml") data_text = soup.find("div", attrs={"id": "fundinfo"}).find("script").string data_content = [ item.split("|") for item in data_text.split("var")[1] .split("=")[1] .strip() .strip(";") .strip('"') .strip("|") .split("|_") ] temp_df = pd.DataFrame(data_content) temp_df.columns = [ "代码", "简称", "类型", "基金经理", "_", "基金公司", "_", "3年期评级-3年评级", "3年期评级-较上期", "单位净值", "日期", "日增长率", "近1年涨幅", "近3年涨幅", "近5年涨幅", "手续费", "_", "_", "_", "_", ] temp_df = temp_df[ [ "代码", "简称", "基金经理", "基金公司", "3年期评级-3年评级", "3年期评级-较上期", "单位净值", "日期", "日增长率", "近1年涨幅", "近3年涨幅", "近5年涨幅", "手续费", "类型", ] ] temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date temp_df["3年期评级-3年评级"] = pd.to_numeric( temp_df["3年期评级-3年评级"], errors="coerce" ) temp_df["3年期评级-较上期"] = pd.to_numeric( temp_df["3年期评级-较上期"], errors="coerce" ) temp_df["单位净值"] = pd.to_numeric(temp_df["单位净值"], errors="coerce") temp_df["日增长率"] = pd.to_numeric(temp_df["日增长率"], errors="coerce") temp_df["近1年涨幅"] = pd.to_numeric(temp_df["近1年涨幅"], errors="coerce") temp_df["近3年涨幅"] = pd.to_numeric(temp_df["近3年涨幅"], errors="coerce") temp_df["近5年涨幅"] = pd.to_numeric(temp_df["近5年涨幅"], errors="coerce") return temp_df if __name__ == "__main__": fund_rating_all_df = fund_rating_all() print(fund_rating_all_df) fund_rating_sh_df = fund_rating_sh(date="20230630") print(fund_rating_sh_df) fund_rating_zs_df = fund_rating_zs(date="20230331") print(fund_rating_zs_df) fund_rating_ja_df = fund_rating_ja(date="20230331") print(fund_rating_ja_df) ================================================ FILE: akshare/fund/fund_report_cninfo.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/7/24 23:30 Desc: 巨潮资讯-数据中心-专题统计-基金报表 https://webapi.cninfo.com.cn/#/thematicStatistics """ import pandas as pd import py_mini_racer import requests from akshare.datasets import get_ths_js def _get_file_content_cninfo(file: str = "cninfo.js") -> str: """ 获取 JS 文件的内容 :param file: JS 文件名 :type file: str :return: 文件内容 :rtype: str """ setting_file_path = get_ths_js(file) with open(setting_file_path, encoding="utf-8") as f: file_data = f.read() return file_data def fund_report_stock_cninfo(date: str = "20210630") -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-基金报表-基金重仓股 https://webapi.cninfo.com.cn/#/thematicStatistics :param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"} :type date: str :return: 基金重仓股 :rtype: pandas.DataFrame """ url = "https://webapi.cninfo.com.cn/api/sysapi/p_sysapi1112" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "https://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "https://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "rdate": "-".join([date[:4], date[4:6], date[6:]]), } r = requests.post(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F003N": "持股总市值", "F002N": "持股总数", "F001N": "基金覆盖家数", "SECNAME": "股票简称", "ID": "序号", "SECCODE": "股票代码", "ENDDATE": "报告期", }, inplace=True, ) temp_df = temp_df[ [ "序号", "股票代码", "股票简称", "报告期", "基金覆盖家数", "持股总数", "持股总市值", ] ] 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") temp_df["序号"] = range(1, len(temp_df) + 1) return temp_df def fund_report_industry_allocation_cninfo(date: str = "20210630") -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-基金报表-基金行业配置 https://webapi.cninfo.com.cn/#/thematicStatistics :param date: 报告时间; choice of {"XXXX0331", "XXXX0630", "XXXX0930", "XXXX1231"}, 从 2017 年开始 :type date: str :return: 基金行业配置 :rtype: pandas.DataFrame """ url = "https://webapi.cninfo.com.cn/api/sysapi/p_sysapi1113" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "https://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "https://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } params = { "rdate": "-".join([date[:4], date[4:6], date[6:]]), } r = requests.post(url, headers=headers, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F004N": "行业规模", "F003N": "基金覆盖家数", "F002V": "证监会行业名称", "F001V": "行业编码", "ENDDATE": "报告期", "F005N": "占净资产比例", }, inplace=True, ) temp_df = temp_df[ [ "行业编码", "证监会行业名称", "报告期", "基金覆盖家数", "行业规模", "占净资产比例", ] ] 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") return temp_df def fund_report_asset_allocation_cninfo() -> pd.DataFrame: """ 巨潮资讯-数据中心-专题统计-基金报表-基金资产配置 https://webapi.cninfo.com.cn/#/thematicStatistics :return: 基金资产配置 :rtype: pandas.DataFrame """ url = "https://webapi.cninfo.com.cn/api/sysapi/p_sysapi1114" js_code = py_mini_racer.MiniRacer() js_content = _get_file_content_cninfo("cninfo.js") js_code.eval(js_content) mcode = js_code.call("getResCode1") headers = { "Accept": "*/*", "Accept-Enckey": mcode, "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "0", "Host": "webapi.cninfo.com.cn", "Origin": "https://webapi.cninfo.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "https://webapi.cninfo.com.cn/", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/93.0.4577.63 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } r = requests.post(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["records"]) temp_df.rename( columns={ "F001N": "基金覆盖家数", "F008N": "现金货币类占净资产比例", "F007N": "债券固定收益类占净资产比例", "F006N": "股票权益类占净资产比例", "ENDDATE": "报告期", "F005N": "基金市场净资产规模", }, inplace=True, ) temp_df = temp_df[ [ "报告期", "基金覆盖家数", "股票权益类占净资产比例", "债券固定收益类占净资产比例", "现金货币类占净资产比例", "基金市场净资产规模", ] ] 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" ) temp_df["现金货币类占净资产比例"] = pd.to_numeric( temp_df["现金货币类占净资产比例"], errors="coerce" ) temp_df["基金市场净资产规模"] = pd.to_numeric( temp_df["基金市场净资产规模"], errors="coerce" ) return temp_df if __name__ == "__main__": fund_report_stock_cninfo_df = fund_report_stock_cninfo(date="20210630") print(fund_report_stock_cninfo_df) fund_report_industry_allocation_cninfo_df = fund_report_industry_allocation_cninfo( date="20210930" ) print(fund_report_industry_allocation_cninfo_df) fund_report_asset_allocation_cninfo_df = fund_report_asset_allocation_cninfo() print(fund_report_asset_allocation_cninfo_df) ================================================ FILE: akshare/fund/fund_scale_em.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2023/10/27 20:30 Desc: 天天基金网-基金数据-规模份额 https://fund.eastmoney.com/data/cyrjglist.html """ import pandas as pd import requests from akshare.utils import demjson def fund_scale_change_em() -> pd.DataFrame: """ 天天基金网-基金数据-规模份额-规模变动 https://fund.eastmoney.com/data/gmbdlist.html :return: 规模变动 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx" params = { "dt": "9", "pi": "1", "pn": "50", "mc": "hypzDetail", "st": "desc", "sc": "reportdate", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) total_page = data_json["pages"] big_df = pd.DataFrame() for page in range(1, int(total_page) + 1): params.update({"pi": page}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df["index"] + 1 big_df.columns = [ "序号", "截止日期", "基金家数", "期间申购", "期间赎回", "期末总份额", "期末净资产", ] big_df["截止日期"] = pd.to_datetime(big_df["截止日期"], errors="coerce").dt.date big_df["基金家数"] = pd.to_numeric(big_df["基金家数"], errors="coerce") big_df["期间申购"] = pd.to_numeric( big_df["期间申购"].str.replace(",", ""), errors="coerce" ) big_df["期间赎回"] = pd.to_numeric( big_df["期间赎回"].str.replace(",", ""), errors="coerce" ) big_df["期末总份额"] = pd.to_numeric( big_df["期末总份额"].str.replace(",", ""), errors="coerce" ) big_df["期末净资产"] = pd.to_numeric( big_df["期末净资产"].str.replace(",", ""), errors="coerce" ) return big_df def fund_hold_structure_em() -> pd.DataFrame: """ 天天基金网-基金数据-规模份额-持有人结构 https://fund.eastmoney.com/data/cyrjglist.html :return: 持有人结构 :rtype: pandas.DataFrame """ url = "https://fund.eastmoney.com/data/FundDataPortfolio_Interface.aspx" params = { "dt": "11", "pi": "1", "pn": "50", "mc": "hypzDetail", "st": "desc", "sc": "reportdate", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) total_page = data_json["pages"] big_df = pd.DataFrame() for page in range(1, int(total_page) + 1): params.update({"pi": page}) r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[data_text.find("{") : -1]) temp_df = pd.DataFrame(data_json["data"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df["index"] + 1 big_df.columns = [ "序号", "截止日期", "基金家数", "机构持有比列", "个人持有比列", "内部持有比列", "总份额", ] big_df["截止日期"] = pd.to_datetime(big_df["截止日期"], errors="coerce").dt.date big_df["基金家数"] = pd.to_numeric(big_df["基金家数"], errors="coerce") big_df["机构持有比列"] = pd.to_numeric(big_df["机构持有比列"], errors="coerce") big_df["个人持有比列"] = pd.to_numeric(big_df["个人持有比列"], errors="coerce") big_df["内部持有比列"] = pd.to_numeric(big_df["内部持有比列"], errors="coerce") big_df["总份额"] = pd.to_numeric( big_df["总份额"].str.replace(",", ""), errors="coerce" ) return big_df if __name__ == "__main__": fund_scale_change_em_df = fund_scale_change_em() print(fund_scale_change_em_df) fund_hold_structure_em_df = fund_hold_structure_em() print(fund_hold_structure_em_df) ================================================ FILE: akshare/fund/fund_scale_sina.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/9/1 16:20 Desc: 新浪财经-基金规模 https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjgmall """ import pandas as pd import requests from akshare.utils import demjson def fund_scale_open_sina(symbol: str = "股票型基金") -> pd.DataFrame: """ 新浪财经-基金数据中心-基金规模-开放式基金 https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf :param symbol: choice of {"股票型基金", "混合型基金", "债券型基金", "货币型基金", "QDII基金"} :type symbol: str :return: 基金规模 :rtype: pandas.DataFrame """ fund_map = { "股票型基金": "2", "混合型基金": "1", "债券型基金": "3", "货币型基金": "5", "QDII基金": "6", } url = ( "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2." "CallbackList['J2cW8KXheoWKdSHc']/NetValueReturn_Service.NetValueReturnOpen" ) params = { "page": "1", "num": "10000", "sort": "zmjgm", "asc": "0", "ccode": "", "type2": fund_map[symbol], "type3": "", } r = requests.get(url, params=params) data_text = r.text 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) temp_df.rename( columns={ "index": "序号", "symbol": "基金代码", "sname": "基金简称", "per_nav": "-", "total_nav": "-", "three_month": "-", "six_month": "-", "one_year": "-", "form_year": "-", "form_start": "-", "name": "-", "zmjgm": "总募集规模", "clrq": "成立日期", "jjjl": "基金经理", "dwjz": "单位净值", "ljjz": "-", "jzrq": "更新日期", "zjzfe": "最近总份额", "jjglr_code": "-", }, inplace=True, ) temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "单位净值", "总募集规模", "最近总份额", "成立日期", "基金经理", "更新日期", ] ] 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") return temp_df def fund_scale_close_sina() -> pd.DataFrame: """ 新浪财经-基金数据中心-基金规模-封闭式基金 https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjhqetf :return: 基金规模 :rtype: pandas.DataFrame """ url = ( "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2." "CallbackList['_bjN6KvXOkfPy2Bu']/NetValueReturn_Service.NetValueReturnClose" ) params = { "page": "1", "num": "1000", "sort": "zmjgm", "asc": "0", "ccode": "", "type2": "", "type3": "", } r = requests.get(url, params=params) data_text = r.text 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) temp_df.rename( columns={ "index": "序号", "symbol": "基金代码", "sname": "基金简称", "per_nav": "-", "total_nav": "-", "three_month": "-", "six_month": "-", "one_year": "-", "form_year": "-", "form_start": "-", "name": "-", "zmjgm": "总募集规模", "clrq": "成立日期", "jjjl": "基金经理", "dwjz": "单位净值", "ljjz": "-", "jzrq": "更新日期", "zjzfe": "最近总份额", "jjglr_code": "-", }, inplace=True, ) temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "单位净值", "总募集规模", "最近总份额", "成立日期", "基金经理", "更新日期", ] ] 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") return temp_df def fund_scale_structured_sina() -> pd.DataFrame: """ 新浪财经-基金数据中心-基金规模-分级子基金 https://vip.stock.finance.sina.com.cn/fund_center/index.html#jjgmfjall :return: 基金规模 :rtype: pandas.DataFrame """ url = ( "http://vip.stock.finance.sina.com.cn/fund_center/data/jsonp.php/IO.XSRV2." "CallbackList['cRrwseM7NWX68rDa']/NetValueReturn_Service.NetValueReturnCX" ) params = { "page": "1", "num": "1000", "sort": "zmjgm", "asc": "0", "ccode": "", "type2": "", "type3": "", } r = requests.get(url, params=params) data_text = r.text 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) temp_df.rename( columns={ "index": "序号", "symbol": "基金代码", "sname": "基金简称", "per_nav": "-", "total_nav": "-", "three_month": "-", "six_month": "-", "one_year": "-", "form_year": "-", "form_start": "-", "name": "-", "zmjgm": "总募集规模", "clrq": "成立日期", "jjjl": "基金经理", "dwjz": "单位净值", "ljjz": "-", "jzrq": "更新日期", "zjzfe": "最近总份额", "jjglr_code": "-", }, inplace=True, ) temp_df = temp_df[ [ "序号", "基金代码", "基金简称", "单位净值", "总募集规模", "最近总份额", "成立日期", "基金经理", "更新日期", ] ] 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") return temp_df if __name__ == "__main__": 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) fund_scale_structured_sina_df = fund_scale_structured_sina() print(fund_scale_structured_sina_df) fund_scale_open_sina_df = fund_scale_open_sina(symbol="股票型基金") print(fund_scale_open_sina_df) ================================================ FILE: akshare/fund/fund_xq.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/10/27 22:30 Desc: 雪球基金-基金详情 https://danjuanfunds.com/funding/003545 """ import pandas as pd import requests def fund_individual_basic_info_xq( symbol: str = "000001", timeout: float = None ) -> pd.DataFrame: """ 雪球基金-基金详情 https://danjuanfunds.com/djapi/fund/675091 :param symbol: 基金代码 :type symbol: str :param timeout: choice of None or a positive float number :type timeout: float :return: 基金信息 :rtype: pandas.DataFrame """ url = f"https://danjuanfunds.com/djapi/fund/{symbol}" headers = { "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" } r = requests.get(url, headers=headers, timeout=timeout) json_data = r.json()["data"] temp_df = pd.json_normalize(json_data) temp_df.rename( columns={ "fd_code": "基金代码", "fd_name": "基金名称", "fd_full_name": "基金全称", "found_date": "成立时间", "totshare": "最新规模", "keeper_name": "基金公司", "manager_name": "基金经理", "trup_name": "托管银行", "type_desc": "基金类型", "rating_source": "评级机构", "rating_desc": "基金评级", "invest_orientation": "投资策略", "invest_target": "投资目标", "performance_bench_mark": "业绩比较基准", }, inplace=True, ) if "评级机构" not in temp_df.columns: temp_df["评级机构"] = pd.NA temp_df = temp_df[ [ "基金代码", "基金名称", "基金全称", "成立时间", "最新规模", "基金公司", "基金经理", "托管银行", "基金类型", "评级机构", "基金评级", "投资策略", "投资目标", "业绩比较基准", ] ] temp_df = temp_df.T.reset_index() temp_df.columns = ["item", "value"] return temp_df def fund_individual_achievement_xq( symbol: str = "000001", timeout: float = None ) -> pd.DataFrame: """ 雪球基金-基金业绩 https://danjuanfunds.com/djapi/fundx/base/fund/achievement/675091 :param symbol: 基金代码 :type symbol: str :param timeout: choice of None or a positive float number :type timeout: float :return: 基金业绩 :rtype: pandas.DataFrame """ url = f"https://danjuanfunds.com/djapi/fundx/base/fund/achievement/{symbol}" headers = { "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" } r = requests.get(url, headers=headers, timeout=timeout) json_data = r.json()["data"] combined_df = None type_dict = { "annual_performance_list": "年度业绩", "stage_performance_list": "阶段业绩", } for k, v in type_dict.items(): temp_df = pd.DataFrame.from_dict(json_data[k], orient="columns") temp_df["type"] = v temp_df = temp_df[ [ "type", "period_time", "self_nav", "self_max_draw_down", "self_nav_rank", ] ] temp_df.columns = [ "业绩类型", "周期", "本产品区间收益", "本产品最大回撒", "周期收益同类排名", ] combined_df = pd.concat([combined_df, temp_df], ignore_index=True) combined_df = combined_df.map( lambda x: x if "%" not in str(x) else x.replace("%", "") ) combined_df[["本产品区间收益", "本产品最大回撒"]] = combined_df[ ["本产品区间收益", "本产品最大回撒"] ].astype(float) return combined_df def fund_individual_analysis_xq( symbol: str = "000001", timeout: float = None ) -> pd.DataFrame: """ 雪球基金-基金数据分析 https://danjuanfunds.com/djapi/fund/base/quote/data/index/analysis/675091 :param symbol: 基金代码 :type symbol: str :param timeout: choice of None or a positive float number :type timeout: float :return: 基金数据分析 :rtype: pandas.DataFrame """ url = f"https://danjuanfunds.com/djapi/fund/base/quote/data/index/analysis/{symbol}" headers = { "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" } r = requests.get(url, headers=headers, timeout=timeout) json_data = r.json()["data"]["index_data_list"] temp_df = pd.json_normalize(json_data) temp_df = temp_df[ [ "index_time_period", "investment_cost_performance", "risk_control", "self_index.volatility_rank", "self_index.sharpe_rank", "self_index.max_draw_down", ] ] temp_df.columns = [ "周期", "较同类风险收益比", "较同类抗风险波动", "年化波动率", "年化夏普比率", "最大回撤", ] temp_df = temp_df.map(lambda x: x if "%" not in str(x) else x.replace("%", "")) temp_df[["年化波动率", "最大回撤"]] *= 100 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") temp_df["年化夏普比率"] = pd.to_numeric(temp_df["年化夏普比率"], errors="coerce") temp_df["最大回撤"] = pd.to_numeric(temp_df["最大回撤"], errors="coerce") return temp_df def fund_individual_profit_probability_xq( symbol: str = "000001", timeout: float = None ) -> pd.DataFrame: """ 雪球基金-盈利概率-历史任意时点买入,持有满 X 年,盈利概率 Y% https://danjuanfunds.com/djapi/fundx/base/fund/profit/ratio/675091 :param symbol: 基金代码 :type symbol: str :param timeout: choice of None or a positive float number :type timeout: float :return: 盈利概率 :rtype: pandas.DataFrame """ url = f"https://danjuanfunds.com/djapi/fundx/base/fund/profit/ratio/{symbol}" headers = { "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" } r = requests.get(url, headers=headers, timeout=timeout) json_data = r.json()["data"]["data_list"] temp_df = pd.DataFrame.from_dict(json_data, orient="columns") temp_df = temp_df[ [ "holding_time", "profit_ratio", "average_income", ] ] temp_df.columns = [ "持有时长", "盈利概率", "平均收益", ] temp_df = temp_df.map(lambda x: x if "%" not in str(x) else x.replace("%", "")) temp_df["盈利概率"] = pd.to_numeric(temp_df["盈利概率"], errors="coerce") temp_df["平均收益"] = pd.to_numeric(temp_df["平均收益"], errors="coerce") return temp_df def fund_individual_detail_info_xq( symbol: str = "000001", timeout: float = None ) -> pd.DataFrame: """ 雪球基金-交易规则 https://danjuanfunds.com/djapi/fund/detail/675091 :param symbol: 基金代码 :type symbol: str :param timeout: choice of None or a positive float number :type timeout: float :return: 交易规则 :rtype: pandas.DataFrame """ url = f"https://danjuanfunds.com/djapi/fund/detail/{symbol}" headers = { "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" } r = requests.get(url, headers=headers, timeout=timeout) json_data = r.json()["data"] combined_df = None rate_type_dict = { "declare_rate_table": "买入规则", "withdraw_rate_table": "卖出规则", "other_rate_table": "其他费用", } for k, v in rate_type_dict.items(): temp_df = pd.DataFrame.from_dict(json_data["fund_rates"][k], orient="columns") temp_df["rate_type"] = v temp_df = temp_df[ [ "rate_type", "name", "value", ] ] temp_df.columns = [ "费用类型", "条件或名称", "费用", ] combined_df = pd.concat(objs=[combined_df, temp_df], ignore_index=True) combined_df["费用"] = pd.to_numeric(combined_df["费用"], errors="coerce") return combined_df def fund_individual_detail_hold_xq( symbol: str = "002804", date: str = "20231231", timeout: float = None ) -> pd.DataFrame: """ 雪球基金-持仓 https://danjuanfunds.com/rn/fund-detail/archive?id=103&code=002804 :param symbol: 基金代码 :type symbol: str :param date: 财报日期 :type date: str :param timeout: choice of None or a positive float number :type timeout: float :return: 雪球基金-持仓 :rtype: pandas.DataFrame """ url = "https://danjuanfunds.com/djapi/fundx/base/fund/record/asset/percent" headers = { "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" } params = { "fund_code": f"{symbol}", "report_date": f"{'-'.join([date[:4], date[4:6], date[6:]])}", } r = requests.get(url, headers=headers, params=params, timeout=timeout) data_json = r.json() temp_df = pd.DataFrame.from_dict(data_json["data"]["chart_list"], orient="columns") temp_df = temp_df[ [ "type_desc", "percent", ] ] temp_df.columns = [ "资产类型", "仓位占比", ] temp_df["仓位占比"] = pd.to_numeric(temp_df["仓位占比"], errors="coerce") return temp_df if __name__ == "__main__": fund_individual_basic_info_xq_df = fund_individual_basic_info_xq(symbol="000005") print(fund_individual_basic_info_xq_df) fund_individual_achievement_xq_df = fund_individual_achievement_xq(symbol="000001") print(fund_individual_achievement_xq_df) fund_individual_analysis_xq_df = fund_individual_analysis_xq(symbol="000001") print(fund_individual_analysis_xq_df) fund_individual_profit_probability_xq_df = fund_individual_profit_probability_xq( symbol="000001" ) print(fund_individual_profit_probability_xq_df) fund_individual_detail_info_xq_df = fund_individual_detail_info_xq(symbol="000001") print(fund_individual_detail_info_xq_df) fund_individual_detail_hold_xq_df = fund_individual_detail_hold_xq( symbol="002804", date="20231231" ) print(fund_individual_detail_hold_xq_df) ================================================ FILE: akshare/futures/__init__.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2019/9/30 13:58 Desc: """ ================================================ FILE: akshare/futures/cons.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/7/21 15:00 Desc: 期货配置文件 """ import datetime import json import os import pickle import re futures_inventory_em_symbol_dict = { "a": "A", # 豆一 "ag": "AG", # 沪银 "al": "AL", # 沪铝 "ao": "AO", # 氧化铝 "AP": "AP", # 苹果 "au": "AU", # 沪金 "b": "B", # 豆二 "bb": None, # 胶合板 (new中没有对应) "bc": None, # 国际铜 (new中没有对应) "br": "BR", # BR橡胶 "bu": "BU", # 沥青 "c": "C", # 玉米 "CF": "CF", # 棉花/郑棉 "CJ": "CJ", # 红枣 "cs": "CS", # 淀粉/玉米淀粉 "cu": "CU", # 沪铜 "CY": "CY", # 棉纱 "eb": "EB", # 苯乙烯 "ec": "ec", # 集运欧线/集运指数(欧线) "eg": "EG", # 乙二醇 "fb": None, # 纤维板 (new中没有对应) "FG": "FG", # 玻璃 "PL": "PL", # 丙烯 "fu": "FU", # 燃料油/燃油 "hc": "HC", # 热卷 "i": "I", # 铁矿石 "IC": "IC", # 中证500 "IF": "IF", # 沪深300 "IH": "IH", # 上证50 "IM": "IM", # 中证1000 "j": "J", # 焦炭 "jd": "JD", # 鸡蛋 "jm": "JM", # 焦煤 "JR": None, # 粳稻 (new中没有对应) "l": "L", # 塑料 "lc": "lc", # 碳酸锂 "lh": "LH", # 生猪 "LR": None, # 晚籼稻 (new中没有对应) "lu": "lu", # LU燃油/低硫燃料油 "m": "M", # 豆粕 "MA": "MA", # 甲醇 "ni": "NI", # 沪镍/镍 "nr": "nr", # 20号胶 "OI": "OI", # 菜籽油/菜油 "p": "P", # 棕榈油/棕榈 "pb": "PB", # 沪铅 "PF": "PF", # 短纤 "pg": "PG", # 液化气/液化石油气 "PK": "PK", # 花生 "PM": None, # 普麦 (new中没有对应) "pp": "PP", # 聚丙烯 "PX": "PX", # 对二甲苯 "rb": "RB", # 螺纹钢 "RI": None, # 早籼稻 (new中没有对应) "RM": "RM", # 菜籽粕/菜粕 "rr": None, # 粳米 (new中没有对应) "RS": "RS", # 油菜籽/菜籽 "ru": "RU", # 橡胶 "SA": "SA", # 纯碱 "sc": None, # 原油 (new中没有对应) "SF": "SF", # 硅铁 "SH": "SH", # 烧碱 "si": "si", # 工业硅 "SM": "SM", # 锰硅 "sn": "SN", # 沪锡/锡 "sp": "SP", # 纸浆 "SR": "SR", # 白糖 "ss": "SS", # 不锈钢 "T": "T", # 十年国债/10年期国债 "TA": "TA", # PTA "TF": "TF", # 五年国债/5年期国债 "TL": "TL", # 三十年国债/30年期国债期货 "TS": "TS", # 二年国债/2年期国债 "UR": "UR", # 尿素 "v": "V", # PVC "WH": None, # 强麦 (new中没有对应) "wr": None, # 线材 (new中没有对应) "y": "Y", # 豆油 "ZC": None, # 动力煤 (new中没有对应) "zn": "ZN", # 沪锌 } hq_sina_spot_headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp," "image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "finance.sina.com.cn", "Pragma": "no-cache", "Referer": "https://finance.sina.com.cn/futuremarket/", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", } # zh_sina_spot zh_subscribe_exchange_symbol_url = ( "http://vip.stock.finance.sina.com.cn/quotes_service/view/js/qihuohangqing.js" ) zh_match_main_contract_url = ( "http://vip.stock.finance.sina.com.cn/quotes_service/" "api/json_v2.php/Market_Center.getHQFuturesData" ) zh_match_main_contract_payload = { "page": "1", "num": "5", "sort": "position", "asc": "0", "node": "001", "base": "futures", } zh_sina_spot_headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "hq.sinajs.cn", "Pragma": "no-cache", "Referer": "https://finance.sina.com.cn/futuremarket/", "Sec-Fetch-Mode": "no-cors", "Sec-Fetch-Site": "cross-site", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/78.0.3904.97 Safari/537.36", } # 99 期货 inventory_temp_headers = { "Accept": "image/webp,image/apng,image/*,*/*;q=0.8", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Connection": "keep-alive", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "UM_distinctid=16c378978de5cc-02cfeac5f7869b-c343162-1fa400-16c378978df8d7; " "__utmz=181566328.1570520149.3.2.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; " "ASP.NET_SessionId=wj5gxuzl3fvvr25503tquq55; __utmc=181566328; _fxaid=1D9A634AB9F5D026585" "6F7E85E7BC196%1D%2BOOl1inxPE7181fmKs5HCs%2BdLO%2Fq%2FbSvf46UVjo%2BE7w%3D%1DPYphpUa9OlzW" "UzatrOQTXLPOVillbwMhTIJas%2ByfkyVL2Hd5XA1GOSslksqDkMTccXvQ2duLNsc0CHT4789JrYNbakJrpzrxL" "nwtBC5GCTssKHGEpor6EwAZfWJgBUlCs4JYFcGUnh3jIO69A4LsOlRMOGf4c9cd%2FbohSjTx3VA%3D; __utma" "=181566328.1348268634.1564299852.1571066568.1571068391.7; tgw_l7_route=eb1311426274fc07" "631b2135a6431f7d; __utmt=1; __utmb=181566328.7.10.1571068391", "Host": "service.99qh.com", "Referer": "http://service.99qh.com/Storage/Storage.aspx?page=99qh", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36", } # 奇货可查 QHKC_INDEX_URL = "https://www.qhkch.com/ajax/index_show.php" QHKC_INDEX_TREND_URL = "https://qhkch.com/ajax/indexes_trend.php" QHKC_INDEX_PROFIT_LOSS_URL = "https://qhkch.com/ajax/indexes_profit_loss.php" QHKC_FUND_BS_URL = "https://qhkch.com/ajax/fund_bs_pie.php" QHKC_FUND_POSITION_URL = "https://qhkch.com/ajax/fund_position_pie.php" QHKC_FUND_POSITION_CHANGE_URL = "https://qhkch.com/ajax/fund_position_chge_pie.php" QHKC_FUND_DEAL_URL = "https://qhkch.com/ajax/fund_deal_pie.php" QHKC_FUND_BIG_CHANGE_URL = "https://qhkch.com/ajax/fund_big_chge.php" QHKC_TOOL_FOREIGN_URL = "https://qhkch.com/ajax/toolbox_foreign.php" QHKC_TOOL_GDP_URL = "https://qhkch.com/dist/views/toolbox/gdp.html?v=1.10.7.1" # 键值对: 键为交易所代码, 值为具体合约代码 market_exchange_symbols = { "cffex": ["IF", "IC", "IM", "IH", "T", "TF", "TS", "TL"], "dce": [ "C", "CS", "A", "B", "M", "Y", "P", "FB", "BB", "JD", "L", "V", "PP", "J", "JM", "I", "EG", "RR", "EB", # 20191009 "PG", "LH", # 20210108 生猪期货 "LG", # 20241118 原木期货 "BZ", # 20250708 纯苯期货 ], "czce": [ "WH", "PM", "CF", "SR", "TA", "OI", "RI", "MA", "ME", "FG", "RS", "RM", "ZC", "JR", "LR", "SF", "SM", "WT", "TC", "GN", "RO", "ER", "SRX", "SRY", "WSX", "WSY", "CY", "AP", "UR", "CJ", # 红枣期货 "SA", # 纯碱期货 "PK", # 20210201 花生期货 "PF", # 短纤 "PX", # 对二甲苯 "SH", # 烧碱 "PR", # 瓶片 "PL", # 丙烯 ], "shfe": [ "CU", "AL", "ZN", "PB", "NI", "SN", "AU", "AG", "RB", "WR", "HC", "FU", "BU", "RU", "SC", "NR", "SP", "SS", "LU", "BC", "AO", "BR", "EC", # 集运指数 "AD", # 铸造铝合金期货 "OP", # 胶版印刷纸期货 ], "gfex": ["SI", "LC", "PS"], } contract_symbols = [] [contract_symbols.extend(i) for i in market_exchange_symbols.values()] headers = { "Host": "www.czce.com.cn", "Connection": "keep-alive", "Cache-Control": "max-age=0", "Accept": "text/html, */*; q=0.01", "X-Requested-With": "XMLHttpRequest", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/56.0.2924.87 Safari/537.36", "DNT": "1", "Referer": "http://www.super-ping.com/?ping=www.google.com&locale=sc", "Accept-Encoding": "gzip, deflate, sdch", "Accept-Language": "zh-CN,zh;q=0.8,ja;q=0.6", } shfe_headers = {"User-Agent": "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)"} dce_headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng," "*/*;q=0.8,application/signed-exchange;v=b3", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "max-age=0", "Content-Length": "71", "Content-Type": "application/x-www-form-urlencoded", "Host": "www.dce.com.cn", "Origin": "http://www.dce.com.cn", "Proxy-Connection": "keep-alive", "Referer": "http://www.dce.com.cn/publicweb/quotesdata/weekQuotesCh.html", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/77.0.3865.90 Safari/537.36", } SYS_SPOT_PRICE_URL = "http://www.100ppi.com/sf/day-{}.html" SYS_SPOT_PRICE_LATEST_URL = "http://www.100ppi.com/sf/" SHFE_VOL_RANK_URL = "https://tsite.shfe.com.cn/data/dailydata/kx/pm%s.dat" SHFE_VOL_RANK_URL_20250701 = ( "https://www.shfe.com.cn/data/tradedata/future/dailydata/pm%s.dat" ) CFFEX_VOL_RANK_URL = "http://www.cffex.com.cn/sj/ccpm/%s/%s/%s_1.csv" DCE_VOL_RANK_URL_1 = ( "http://portal.dce.com.cn/publicweb/quotesdata/exportMemberDealPosiQuotesData.html?" "memberDealPosiQuotes.variety=%s&memberDealPosiQuotes.trade_type=0&contract.cont" "ract_id=%s&contract.variety_id=%s&year=%s&month=%s&day=%s&exportFlag=txt" ) DCE_VOL_RANK_URL_2 = ( "http://portal.dce.com.cn/publicweb/quotesdata/memberDealPosiQuotes.html?memberDeal" "PosiQuotes.variety=%s&memberDealPosiQuotes.trade_type=0&contract.contract_id=" "all&contract.variety_id=%s&year=%s&month=%s&day=%s" ) CZCE_VOL_RANK_URL_1 = "http://www.czce.com.cn/cn/exchange/jyxx/pm/pm%s.html" CZCE_VOL_RANK_URL_2 = "http://www.czce.com.cn/cn/exchange/%s/datatradeholding/%s.htm" CZCE_VOL_RANK_URL_3 = ( "http://www.czce.com.cn/cn/DFSStaticFiles/Future/%s/%s/FutureDataHolding.htm" ) DCE_RECEIPT_URL = "http://portal.dce.com.cn/publicweb/quotesdata/wbillWeeklyQuotes.html" SHFE_RECEIPT_URL_1 = "http://tsite.shfe.com.cn/data/dailydata/%sdailystock.html" SHFE_RECEIPT_URL_2 = "http://tsite.shfe.com.cn/data/dailydata/%sdailystock.dat" SHFE_RECEIPT_URL_20250701 = ( "https://www.shfe.com.cn/data/tradedata/future/dailydata/%sdailystock.dat" ) CZCE_RECEIPT_URL_1 = "http://www.czce.com.cn/cn/exchange/jyxx/sheet/sheet%s.html" CZCE_RECEIPT_URL_2 = "http://www.czce.com.cn/cn/exchange/%s/datawhsheet/%s.htm" CZCE_RECEIPT_URL_3 = ( "http://www.czce.com.cn/cn/DFSStaticFiles/Future/%s/%s/FutureDataWhsheet.htm" ) CFFEX_DAILY_URL = "http://www.cffex.com.cn/fzjy/mrhq/{}/{}/{}_1.csv" SHFE_DAILY_URL = "http://tsite.shfe.com.cn/data/dailydata/kx/kx%s.dat" SHFE_DAILY_URL_20250630 = ( "https://www.shfe.com.cn/data/tradedata/future/dailydata/kx%s.dat" ) SHFE_V_WAP_URL = "http://tsite.shfe.com.cn/data/dailydata/ck/%sdailyTimePrice.dat" DCE_DAILY_URL = "http://www.dce.com.cn//publicweb/quotesdata/dayQuotesCh.html" CZCE_DAILY_URL_1 = "http://www.czce.com.cn/cn/exchange/jyxx/hq/hq%s.html" CZCE_DAILY_URL_2 = "http://www.czce.com.cn/cn/exchange/%s/datadaily/%s.txt" CZCE_DAILY_URL_3 = ( "http://www.czce.com.cn/cn/DFSStaticFiles/Future/%s/%s/FutureDataDaily.txt" ) DATE_PATTERN = re.compile(r"^([0-9]{4})[-/]?([0-9]{2})[-/]?([0-9]{2})") FUTURES_SYMBOL_PATTERN = re.compile(r"(^[A-Za-z]{1,2})[0-9]+") CFFEX_COLUMNS = [ "open", "high", "low", "volume", "turnover", "open_interest", "close", "settle", "change1", "change2", ] CZCE_COLUMNS = [ "pre_settle", "open", "high", "low", "close", "settle", "change1", "change2", "volume", "open_interest", "oi_chg", "turnover", "final_settle", ] CZCE_COLUMNS_2 = [ "pre_settle", "open", "high", "low", "close", "settle", "change1", "volume", "open_interest", "oi_chg", "turnover", "final_settle", ] SHFE_COLUMNS = { "CLOSEPRICE": "close", "HIGHESTPRICE": "high", "LOWESTPRICE": "low", "OPENINTEREST": "open_interest", "OPENPRICE": "open", "PRESETTLEMENTPRICE": "pre_settle", "SETTLEMENTPRICE": "settle", "VOLUME": "volume", } SHFE_V_WAP_COLUMNS = { ":B1": "date", "INSTRUMENT_ID": "symbol", "TIME": "time_range", "REF_SETTLEMENT_PRICE": "v_wap", } DCE_COLUMNS = [ "open", "high", "low", "close", "pre_settle", "settle", "change1", "change2", "volume", "open_interest", "oi_chg", "turnover", ] DCE_OPTION_COLUMNS = [ "open", "high", "low", "close", "pre_settle", "settle", "change1", "change2", "delta", "volume", "open_interest", "oi_chg", "turnover", "exercise_volume", ] OUTPUT_COLUMNS = [ "symbol", "date", "open", "high", "low", "close", "volume", "open_interest", "turnover", "settle", "pre_settle", "variety", ] OPTION_OUTPUT_COLUMNS = [ "symbol", "date", "open", "high", "low", "close", "pre_settle", "settle", "delta", "volume", "open_interest", "oi_chg", "turnover", "implied_volatility", "exercise_volume", "variety", ] DCE_MAP = { "大豆": "A", "豆一": "A", "豆二": "B", "豆粕": "M", "豆油": "Y", "棕榈油": "P", "玉米": "C", "玉米淀粉": "CS", "鸡蛋": "JD", "纤维板": "FB", "胶合板": "BB", "聚乙烯": "L", "聚氯乙烯": "V", "聚丙烯": "PP", "焦炭": "J", "焦煤": "JM", "铁矿石": "I", "乙二醇": "EG", "粳米": "RR", "苯乙烯": "EB", "液化石油气": "PG", "生猪": "LH", "原木": "LG", "纯苯": "BZ", "聚氯乙烯月均价": "VF", "聚丙烯月均价": "PPF", "聚乙烯月均价": "LF", } def convert_date(date): """ transform a date string to datetime.date object :param date, string, e.g. 2016-01-01, 20160101 or 2016/01/01 :return: object of datetime.date(such as 2016-01-01) or None """ if isinstance(date, datetime.date): return date elif isinstance(date, str): match = DATE_PATTERN.match(date) if match: groups = match.groups() if len(groups) == 3: return datetime.date( year=int(groups[0]), month=int(groups[1]), day=int(groups[2]), ) return None def get_json_path(name, module_file): """ 获取 JSON 配置文件的路径(从模块所在目录查找) :param name: 文件名 :param module_file: filename :return: str json_file_path """ module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file))) module_json_path = os.path.join(module_folder, "file_fold", name) return module_json_path def get_pk_path(name, module_file): """ 获取 pickle 配置文件的路径(从模块所在目录查找) :param name: 文件名 :param module_file: filename :return: str json_file_path """ module_folder = os.path.abspath(os.path.dirname(os.path.dirname(module_file))) module_json_path = os.path.join(module_folder, "file_fold", name) return module_json_path def get_pk_data(file_name): """ 获取交易日历至 2019 年结束, 这里的交易日历需要按年更新 :return: json """ setting_file_name = file_name setting_file_path = get_pk_path(setting_file_name, __file__) return pickle.load(open(setting_file_path, "rb")) def get_calendar(): """ 获取交易日历, 这里的交易日历需要按年更新, 主要是从新浪获取的 :return: 交易日历 :rtype: json """ setting_file_name = "calendar.json" setting_file_path = get_json_path(setting_file_name, __file__) with open(setting_file_path, "r", encoding="utf-8") as f: data_json = json.load(f) return data_json def last_trading_day(day): """ 获取前一个交易日 :param day: "%Y%m%d" or datetime.date() :return last_day: "%Y%m%d" or datetime.date() """ calendar = get_calendar() if isinstance(day, str): if day not in calendar: print("Today is not trading day:" + day) return False pos = calendar.index(day) last_day = calendar[pos - 1] return last_day elif isinstance(day, datetime.date): d_str = day.strftime("%Y%m%d") if d_str not in calendar: print("Today is not working day:" + d_str) return False pos = calendar.index(d_str) last_day = calendar[pos - 1] last_day = datetime.datetime.strptime(last_day, "%Y%m%d").date() return last_day def get_latest_data_date(day): """ 获取最新的有数据的交易日 :param day: datetime.datetime :return string YYYYMMDD """ calendar = get_calendar() if day.strftime("%Y%m%d") in calendar: if day.time() > datetime.time(17, 0, 0): return day.strftime("%Y%m%d") else: return last_trading_day(day.strftime("%Y%m%d")) else: while day.strftime("%Y%m%d") not in calendar: day = day - datetime.timedelta(days=1) return day.strftime("%Y%m%d") if __name__ == "__main__": d = datetime.datetime(2018, 10, 5, 17, 1, 0) print(get_latest_data_date(d)) ================================================ FILE: akshare/futures/cot.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/7/21 15:00 Desc: 期货-中国-交易所-会员持仓数据接口 大连商品交易所、上海期货交易所、郑州商品交易所、中国金融期货交易所、广州期货交易所 采集前 20 会员持仓数据; 建议下午 16:30 以后采集当天数据, 避免交易所数据更新不稳定; 郑州商品交易所格式分为三类 大连商品交易所有具体合约的持仓排名, 通过 futures_dce_position_rank 获取 20171228 http://www.czce.com.cn/cn/DFSStaticFiles/Future/2020/20200727/FutureDataHolding.txt 20100825 http://www.czce.com.cn/cn/exchange/2014/datatradeholding/20140515.txt """ import datetime import json import re import time import warnings import zipfile from io import BytesIO from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup from akshare.futures import cons from akshare.futures.requests_fun import requests_link from akshare.futures.symbol_var import symbol_varieties calendar = cons.get_calendar() rank_columns = [ "vol_party_name", "vol", "vol_chg", "long_party_name", "long_open_interest", "long_open_interest_chg", "short_party_name", "short_open_interest", "short_open_interest_chg", ] intColumns = [ "vol", "vol_chg", "long_open_interest", "long_open_interest_chg", "short_open_interest", "short_open_interest_chg", ] def get_rank_sum_daily( start_day: str = "20210510", end_day: str = "20210510", vars_list: list = cons.contract_symbols, ): """ 采集四个期货交易所前 5、前 10、前 15、前 20 会员持仓排名数据 注1:由于上期所和中金所只公布每个品种内部的标的排名,没有公布品种的总排名; 所以函数输出的品种排名是由品种中的每个标的加总获得,并不是真实的品种排名列表 注2:大商所只公布了品种排名,未公布标的排名 :param start_day: 开始日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :type start_day: str :param end_day: 结束数据 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :type end_day: str :param vars_list: 合约品种如 ['RB'、'AL'] 等列表为空时为所有商品 :type vars_list: list :return: 会员持仓排名数据 :rtype: pandas.DataFrame symbol 标的合约 string var 商品品种 string vol_top5 成交量前5会员成交量总和 int vol_chg_top5 成交量前5会员成交量变化总和 int long_open_interest_top5 持多单前5会员持多单总和 int long_open_interest_chg_top5 持多单前5会员持多单变化总和 int short_open_interest_top5 持空单前5会员持空单总和 int short_open_interest_chg_top5 持空单前5会员持空单变化总和 int vol_top10 成交量前10会员成交量总和 int """ start_day = ( cons.convert_date(start_day) if start_day is not None else datetime.date.today() ) end_day = ( cons.convert_date(end_day) if end_day is not None else cons.convert_date(cons.get_latest_data_date(datetime.datetime.now())) ) records = pd.DataFrame() while start_day <= end_day: print(start_day) if start_day.strftime("%Y%m%d") in calendar: data = get_rank_sum(start_day, vars_list) if data is False: print( f"{start_day.strftime('%Y-%m-%d')}日交易所数据连接失败,已超过20次,您的地址被网站墙了,请保存好返回数据,稍后从该日期起重试" ) return records.reset_index(drop=True) records = pd.concat(objs=[records, data], ignore_index=True) else: warnings.warn(f"{start_day.strftime('%Y%m%d')}非交易日") start_day += datetime.timedelta(days=1) return records.reset_index(drop=True) def get_rank_sum(date: str = "20210525", vars_list: list = cons.contract_symbols): """ 采集五个期货交易所前5、前10、前15、前20会员持仓排名数据 注1:由于上期所和中金所只公布每个品种内部的标的排名, 没有公布品种的总排名; 所以函数输出的品种排名是由品种中的每个标的加总获得, 并不是真实的品种排名列表 注2:大商所只公布了品种排名, 未公布标的排名 :param date: 日期 format: YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :type date: date :param vars_list: 合约品种如 ['RB', 'AL'] 等列表为空时为所有商品 :type vars_list: list :return: 持仓排名数据 :rtype: pandas.DataFrame symbol 标的合约 string var 商品品种 string vol_top5 成交量前5会员成交量总和 int vol_chg_top5 成交量前5会员成交量变化总和 int long_open_interest_top5 持多单前5会员持多单总和 int long_open_interest_chg_top5 持多单前5会员持多单变化总和 int short_open_interest_top5 持空单前5会员持空单总和 int short_open_interest_chg_top5 持空单前5会员持空单变化总和 int vol_top10 成交量前10会员成交量总和 int """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return None dce_var = [i for i in vars_list if i in cons.market_exchange_symbols["dce"]] shfe_var = [i for i in vars_list if i in cons.market_exchange_symbols["shfe"]] czce_var = [i for i in vars_list if i in cons.market_exchange_symbols["czce"]] cffex_var = [i for i in vars_list if i in cons.market_exchange_symbols["cffex"]] gfex_var = [i for i in vars_list if i in cons.market_exchange_symbols["gfex"]] big_dict = {} if len(dce_var) > 0: data = futures_dce_position_rank(date, dce_var) if data is False: return False big_dict.update(data) if len(shfe_var) > 0: data = get_shfe_rank_table(date, shfe_var) if data is False: return False big_dict.update(data) if len(czce_var) > 0: data = get_rank_table_czce(date) if data is False: return False big_dict.update(data) if len(cffex_var) > 0: data = get_cffex_rank_table(date, cffex_var) if data is False: return False big_dict.update(data) if len(gfex_var) > 0: data = futures_gfex_position_rank(date, gfex_var) if data is False: return False big_dict.update(data) records = pd.DataFrame() for symbol, table in big_dict.items(): table = table.map(lambda x: 0 if x == "" else x) for symbol_inner in set(table["symbol"]): var = symbol_varieties(symbol_inner) if var in vars_list: if var in czce_var: for col in [ item for item in table.columns if item.find("open_interest") > -1 ] + ["vol", "vol_chg"]: table[col] = [ float(value.replace(",", "")) if value != "-" else 0.0 for value in table[col] ] table_cut = table[table["symbol"] == symbol_inner] table_cut["rank"] = table_cut["rank"].astype("float") table_cut_top5 = table_cut[table_cut["rank"] <= 5] table_cut_top10 = table_cut[table_cut["rank"] <= 10] table_cut_top15 = table_cut[table_cut["rank"] <= 15] table_cut_top20 = table_cut[table_cut["rank"] <= 20] big_dict = { "symbol": symbol_inner, "variety": var, "vol_top5": table_cut_top5["vol"].sum(), "vol_chg_top5": table_cut_top5["vol_chg"].sum(), "long_open_interest_top5": table_cut_top5[ "long_open_interest" ].sum(), "long_open_interest_chg_top5": table_cut_top5[ "long_open_interest_chg" ].sum(), "short_open_interest_top5": table_cut_top5[ "short_open_interest" ].sum(), "short_open_interest_chg_top5": table_cut_top5[ "short_open_interest_chg" ].sum(), "vol_top10": table_cut_top10["vol"].sum(), "vol_chg_top10": table_cut_top10["vol_chg"].sum(), "long_open_interest_top10": table_cut_top10[ "long_open_interest" ].sum(), "long_open_interest_chg_top10": table_cut_top10[ "long_open_interest_chg" ].sum(), "short_open_interest_top10": table_cut_top10[ "short_open_interest" ].sum(), "short_open_interest_chg_top10": table_cut_top10[ "short_open_interest_chg" ].sum(), "vol_top15": table_cut_top15["vol"].sum(), "vol_chg_top15": table_cut_top15["vol_chg"].sum(), "long_open_interest_top15": table_cut_top15[ "long_open_interest" ].sum(), "long_open_interest_chg_top15": table_cut_top15[ "long_open_interest_chg" ].sum(), "short_open_interest_top15": table_cut_top15[ "short_open_interest" ].sum(), "short_open_interest_chg_top15": table_cut_top15[ "short_open_interest_chg" ].sum(), "vol_top20": table_cut_top20["vol"].sum(), "vol_chg_top20": table_cut_top20["vol_chg"].sum(), "long_open_interest_top20": table_cut_top20[ "long_open_interest" ].sum(), "long_open_interest_chg_top20": table_cut_top20[ "long_open_interest_chg" ].sum(), "short_open_interest_top20": table_cut_top20[ "short_open_interest" ].sum(), "short_open_interest_chg_top20": table_cut_top20[ "short_open_interest_chg" ].sum(), "date": date.strftime("%Y%m%d"), } records = pd.concat( [records, pd.DataFrame(big_dict, index=[0])], ignore_index=True ) if len(big_dict.items()) > 0: add_vars = [ i for i in cons.market_exchange_symbols["dce"] + cons.market_exchange_symbols["shfe"] + cons.market_exchange_symbols["cffex"] if i in records["variety"].tolist() ] for var in add_vars: records_cut = records[records["variety"] == var] var_record = pd.DataFrame(records_cut.sum()).T var_record["date"] = date.strftime("%Y%m%d") var_record.loc[:, ["variety", "symbol"]] = var records = pd.concat([records, var_record], ignore_index=True) return records.reset_index(drop=True) def get_shfe_rank_table( date: str = None, vars_list: list = cons.contract_symbols ) -> dict: """ 上海期货交易所会员成交及持仓排名表 https://www.shfe.com.cn/ https://tsite.shfe.com.cn/statements/dataview.html?paramid=kx 注:该交易所只公布每个品种内部的标的排名,没有公布品种的总排名 数据从 20020107 开始,每交易日 16:30 左右更新数据 :param date: 交易日 :type date: str :param vars_list: 合约品种如 RB、AL等列表; 为空时为所有商品 :type vars_list: list :return: 上海期货交易所会员成交及持仓排名表 :rtype: dict rank 排名 int vol_party_name 成交量排序的当前名次会员 string(中文) vol 该会员成交量 int vol_chg 该会员成交量变化量 int long_party_name 持多单排序的当前名次会员 string(中文) long_open_interest 该会员持多单 int long_open_interest_chg 该会员持多单变化量 int short_party_name 持空单排序的当前名次会员 string(中文) short_open_interest 该会员持空单 int short_open_interest_chg 该会员持空单变化量 int symbol 标的合约 string var 品种 string date 日期 string YYYYMMDD """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date < datetime.date(year=2002, month=1, day=7): print("shfe数据源开始日期为 20020107,跳过") return {} if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} url = cons.SHFE_VOL_RANK_URL_20250701 % (date.strftime("%Y%m%d")) r = requests_link(url, encoding="utf-8", headers=cons.shfe_headers) try: context = json.loads(r.text) except: # noqa: E722 return {} df = pd.DataFrame(context["o_cursor"]) df = df.rename( columns={ "CJ1": "vol", "CJ1_CHG": "vol_chg", "CJ2": "long_open_interest", "CJ2_CHG": "long_open_interest_chg", "CJ3": "short_open_interest", "CJ3_CHG": "short_open_interest_chg", "PARTICIPANTABBR1": "vol_party_name", "PARTICIPANTABBR2": "long_party_name", "PARTICIPANTABBR3": "short_party_name", "PRODUCTNAME": "product1", "RANK": "rank", "INSTRUMENTID": "symbol", "PRODUCTSORTNO": "product2", } ) if len(df.columns) < 3: return {} df = df.map(lambda x: x.strip() if isinstance(x, str) else x) df = df.map(lambda x: None if x == "" else x) df["variety"] = df["symbol"].apply(lambda x: symbol_varieties(x)) df = df[df["rank"] > 0] for col in [ "PARTICIPANTID1", "PARTICIPANTID2", "PARTICIPANTID3", "product1", "product2", ]: try: del df[col] except: # noqa: E722 pass get_vars = [var for var in vars_list if var in df["variety"].tolist()] big_dict = {} for var in get_vars: df_var = df[df["variety"] == var] for symbol in set(df_var["symbol"]): df_symbol = df_var[df_var["symbol"] == symbol].copy() df_symbol["symbol"] = df_symbol["symbol"].str.upper() big_dict[symbol] = df_symbol.reset_index(drop=True) return big_dict def _czce_df_read(url, skip_rows, encoding="utf-8", header=0): """ 郑州商品交易所的网页数据 :param header: :type header: :param url: 网站 string :param skip_rows: 去掉前几行 int :param encoding: utf-8 or gbk or gb2312 :return: pd.DataFrame """ headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9," "image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/84.0.4147.89 Safari/537.36", "Host": "www.czce.com.cn", "Cookie": "XquW6dFMPxV380S=CAaD3sMkdXv3fUoaJlICIEv0MVegGq5EoMyBcxkOjCgSjmpuovYFuTLtYFcxTZGw; " "XquW6dFMPxV380T=5QTTjUlA6f6WiDO7fMGmqNxHBWz.hKIc8lb_tc1o4nHrJM4nsXCAI9VHaKyV_jkHh4cIVvD25kGQAh." "MvLL1SHRA20HCG9mVVHPhAzktNdPK3evjm0NYbTg2Gu_XGGtPhecxLvdFQ0." "JlAxy_z0C15_KdO8kOI18i4K0rFERNPxjXq5qG1Gs.QiOm976wODY.pe8XCQtAsuLYJ." "N4DpTgNfHJp04jhMl0SntHhr.jhh3dFjMXBx.JEHngXBzY6gQAhER7uSKAeSktruxFeuKlebse.vrPghHqWvJm4WPTEvDQ8q", } r = requests_link(url, encoding, headers=headers) data = pd.read_html( StringIO(r.text), match=".+", flavor=None, header=header, index_col=0, skiprows=skip_rows, attrs=None, parse_dates=False, thousands=", ", encoding="gbk", decimal=".", converters=None, na_values=None, keep_default_na=True, ) return data def get_rank_table_czce(date: str = "20251103") -> dict: """ 郑州商品交易所前 20 会员持仓排名数据明细 https://www.czce.com.cn/cn/jysj/ccpm/H077003004index_1.htm 注:该交易所既公布了品种排名, 也公布了标的排名 :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :return: 持仓排名数据明细 :rtype: pandas.DataFrame 返回值格式 rank 排名 int vol_party_name 成交量排序的当前名次会员 string(中文) vol 该会员成交量 int vol_chg 该会员成交量变化量 int long_party_name 持多单排序的当前名次会员 string(中文) long_open_interest 该会员持多单 int long_open_interest_chg 该会员持多单变化量 int short_party_name 持空单排序的当前名次会员 string(中文) short_open_interest 该会员持空单 int short_open_interest_chg 该会员持空单变化量 int symbol 标的合约 string var 品种 string date 日期 string YYYYMMDD """ date = cons.convert_date(date) if date is not None else datetime.date.today() headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36" } temp_df = pd.DataFrame() if date < datetime.date(2015, 10, 8): print("CZCE可获取的数据源开始日期为 20151008, 请输入合适的日期参数") return {} if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} if date > datetime.date(year=2025, month=11, day=1): url = ( f"http://www.czce.com.cn/cn/DFSStaticFiles/Future/{date.year}/" f"{date.isoformat().replace('-', '')}/FutureDataHolding.xlsx" ) else: url = ( f"http://www.czce.com.cn/cn/DFSStaticFiles/Future/{date.year}/" f"{date.isoformat().replace('-', '')}/FutureDataHolding.xls" ) r = requests.get(url, headers=headers) temp_df = pd.read_excel(BytesIO(r.content)) temp_pinzhong_index = [ item + 1 for item in temp_df[ temp_df.iloc[:, 0].str.contains("合计", na=False) ].index.to_list() ] temp_pinzhong_index.insert(0, 0) temp_pinzhong_index.pop() temp_symbol_index = ( temp_df.iloc[temp_pinzhong_index, 0].str.split(" ", expand=True).iloc[:, 0] ) symbol_list = [ re.compile(r"[0-9a-zA-Z_]+").findall(item)[0] for item in temp_symbol_index.values ] temp_symbol_index_list = temp_symbol_index.index.to_list() big_dict = {} for i in range(len(temp_symbol_index_list) - 1): inner_temp_df = temp_df[ temp_symbol_index_list[i] + 2 : temp_symbol_index_list[i + 1] - 1 ] inner_temp_df.columns = [ "rank", "vol_party_name", "vol", "vol_chg", "long_party_name", "long_open_interest", "long_open_interest_chg", "short_party_name", "short_open_interest", "short_open_interest_chg", ] inner_temp_df.reset_index(inplace=True, drop=True) big_dict[symbol_list[i]] = inner_temp_df inner_temp_df = temp_df[temp_symbol_index_list[i + 1] + 2 : -1] inner_temp_df.columns = [ "rank", "vol_party_name", "vol", "vol_chg", "long_party_name", "long_open_interest", "long_open_interest_chg", "short_party_name", "short_open_interest", "short_open_interest_chg", ] inner_temp_df.reset_index(inplace=True, drop=True) big_dict[symbol_list[-1]] = inner_temp_df new_big_dict = {} for key, value in big_dict.items(): value = value.assign(symbol=key) value = value.assign(variety=re.compile(r"[a-zA-Z_]+").findall(key)[0]) new_big_dict[key] = value return new_big_dict def _get_dce_contract_list(date, var): """ 大连商品交易所取消了品种排名,只提供标的合约排名,需要获取标的合约列表 :param date: 日期 datetime.date 对象, 为空时为当天 :param var: 合约品种 :return: list 公布了持仓排名的合约列表 """ url = "http://portal.dce.com.cn/publicweb/quotesdata/memberDealPosiQuotes.html" headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;" "q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "close", "Host": "www.dce.com.cn", "Origin": "http://portal.dce.com.cn", "Pragma": "no-cache", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", } params = { "memberDealPosiQuotes.variety": var.lower(), "memberDealPosiQuotes.trade_type": "0", "year": date.year, "month": date.month - 1, "day": date.day, "contract.contract_id": "all", "contract.variety_id": var.lower(), "contract": "", } while 1: try: r = requests.post(url, params=params, headers=headers) soup = BeautifulSoup(r.text, "lxml") contract_list = [ re.findall( r"\d+", item["onclick"].strip("javascript:setContract_id('").strip("');"), )[0] for item in soup.find_all(attrs={"name": "contract"}) ] contract_list = [var.lower() + item for item in contract_list] return contract_list # noqa: E722 except: # noqa: E722 time.sleep(5) continue def get_dce_rank_table(date: str = "20230706", vars_list=cons.contract_symbols) -> dict: """ 大连商品交易所前 20 会员持仓排名数据明细, 由于交易所网站问题, 需要 20200720 之后才有数据 注: 该交易所只公布标的合约排名 :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date 对象, 为空时为当天 :param vars_list: 合约品种如 RB、AL 等列表为空时为所有商品, 数据从 20060104 开始,每交易日 16:30 左右更新数据 :return: 持仓排名 :rtype: pandas.DataFrame 返回值格式 rank 排名 int vol_party_name 成交量排序的当前名次会员 string(中文) vol 该会员成交量 int vol_chg 该会员成交量变化量 int long_party_name 持多单排序的当前名次会员 string(中文) long_open_interest 该会员持多单 int long_open_interest_chg 该会员持多单变化量 int short_party_name 持空单排序的当前名次会员 string(中文) short_open_interest 该会员持空单 int short_open_interest_chg 该会员持空单变化量 int symbol 标的合约 string var 品种 string date 日期 string YYYYMMDD """ print("如果本接口不可用,请使用 ak.futures_dce_position_rank() 接口") date_string = date date = cons.convert_date(date) if date is not None else datetime.date.today() if date < datetime.date(2006, 1, 4): print(Exception("大连商品交易所数据源开始日期为 20060104,跳过")) return {} if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} vars_list = [i for i in vars_list if i in cons.market_exchange_symbols["dce"]] big_dict = {} for var in vars_list: # var = 'V' symbol_list = _get_dce_contract_list(date, var) for symbol in symbol_list: # print(symbol) url = cons.DCE_VOL_RANK_URL_1 % ( var.lower(), symbol, var.lower(), date.year, date.month - 1, date.day, ) try: temp_df = pd.read_excel(url[:-3] + "excel", header=0, skiprows=3) temp_df.dropna(how="any", axis=0, inplace=True) temp_df = temp_df.map(lambda x: str(x).replace(",", "")) del temp_df["名次.1"] del temp_df["名次.2"] temp_df.rename( columns={ "名次": "rank", "会员简称": "vol_party_name", "成交量": "vol", "增减": "vol_chg", "会员简称.1": "long_party_name", "持买单量": "long_open_interest", "增减.1": "long_open_interest_chg", "会员简称.2": "short_party_name", "持卖单量": "short_open_interest", "增减.2": "short_open_interest_chg", }, inplace=True, ) temp_df["symbol"] = symbol.upper() temp_df["var"] = var temp_df["date"] = date_string temp_df = temp_df.map( lambda x: str(x).replace("-", "0") if x == "-" else x ) temp_df["rank"] = range(1, len(temp_df) + 1) temp_df["vol"] = temp_df["vol"].astype(float) temp_df["vol_chg"] = temp_df["vol_chg"].astype(float) temp_df["long_open_interest"] = temp_df["long_open_interest"].astype( float ) temp_df["long_open_interest_chg"] = temp_df[ "long_open_interest_chg" ].astype(float) temp_df["short_open_interest"] = temp_df["short_open_interest"].astype( float ) temp_df["short_open_interest_chg"] = temp_df[ "short_open_interest_chg" ].astype(float) big_dict[symbol] = temp_df except: # noqa: E722 temp_url = "http://portal.dce.com.cn/publicweb/quotesdata/memberDealPosiQuotes.html" payload = { "memberDealPosiQuotes.variety": var.lower(), "memberDealPosiQuotes.trade_type": "0", "year": date.year, "month": date.month - 1, "day": str(date.day).zfill(2), "contract.contract_id": symbol, "contract.variety_id": var.lower(), "contract": "", } r = requests.post(temp_url, data=payload) if r.status_code != 200: big_dict[symbol] = {} else: temp_df = pd.read_html(StringIO(r.text))[1].iloc[:-1, :] del temp_df["名次.1"] del temp_df["名次.2"] temp_df.rename( columns={ "名次": "rank", "会员简称": "vol_party_name", "成交量": "vol", "增减": "vol_chg", "会员简称.1": "long_party_name", "持买单量": "long_open_interest", "增减.1": "long_open_interest_chg", "会员简称.2": "short_party_name", "持卖单量": "short_open_interest", "增减.2": "short_open_interest_chg", }, inplace=True, ) temp_df["symbol"] = symbol.upper() temp_df["var"] = var temp_df["date"] = date_string temp_df = temp_df.map( lambda x: str(x).replace("-", "0") if x == "-" else x ) temp_df["rank"] = range(1, len(temp_df) + 1) temp_df["vol"] = temp_df["vol"].astype(float) temp_df["vol_chg"] = temp_df["vol_chg"].astype(float) temp_df["long_open_interest"] = temp_df[ "long_open_interest" ].astype(float) temp_df["long_open_interest_chg"] = temp_df[ "long_open_interest_chg" ].astype(float) temp_df["short_open_interest"] = temp_df[ "short_open_interest" ].astype(float) temp_df["short_open_interest_chg"] = temp_df[ "short_open_interest_chg" ].astype(float) big_dict[symbol] = temp_df return big_dict def get_cffex_rank_table(date: str = "20190805", vars_list=cons.contract_symbols): """ 中国金融期货交易所前 20 会员持仓排名数据明细 http://www.cffex.com.cn/ccpm/ 注:该交易所既公布品种排名,也公布标的排名 :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :param vars_list: 合约品种如RB、AL等列表 为空时为所有商品, 数据从20100416开始,每交易日16:30左右更新数据 :return: 持仓排名 :rtype: pandas.DataFrame :rfield: rank 排名 int vol_party_name 成交量排序的当前名次会员 string(中文) vol 该会员成交量 int vol_chg 该会员成交量变化量 int long_party_name 持多单排序的当前名次会员 string(中文) long_open_interest 该会员持多单 int long_open_interest_chg 该会员持多单变化量 int short_party_name 持空单排序的当前名次会员 string(中文) short_open_interest 该会员持空单 int short_open_interest_chg 该会员持空单变化量 int symbol 标的合约 string var 品种 string date 日期 string YYYYMMDD """ vars_list = [i for i in vars_list if i in cons.market_exchange_symbols["cffex"]] date = cons.convert_date(date) if date is not None else datetime.date.today() if date < datetime.date(2010, 4, 16): print(Exception("CFFEX 数据源开始日期为 20100416,跳过")) return {} if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/81.0.4044.138 Safari/537.36", } big_dict = {} for var in vars_list: # print(var) # var = "IF" url = cons.CFFEX_VOL_RANK_URL % ( date.strftime("%Y%m"), date.strftime("%d"), var, ) # url = 'http://www.cffex.com.cn/sj/ccpm/201908/05/IF_1.csv' # url = 'http://www.cffex.com.cn/sj/ccpm/202308/08/IF_1.csv' r = requests.get(url, headers=headers) # 20200316 开始数据结构变化,统一格式 if r.status_code == 200: try: # 当所需要的合约没有数据时 temp_df = pd.read_table(BytesIO(r.content), encoding="gbk", header=None) except: # noqa: E722 continue need_index = temp_df.iloc[:, 0].str.contains("交易日") if sum(need_index) > 2: table = temp_df.iloc[temp_df[need_index].index[1] :, 0].str.split( ",", expand=True ) table.columns = table.iloc[0, :] table = table.iloc[2:, :].copy() table.reset_index(inplace=True, drop=True) else: table = pd.read_csv(BytesIO(r.content), encoding="gbk") else: return table = table.dropna(how="any") table = table.map(lambda x: x.strip() if isinstance(x, str) else x) del table["交易日"] for symbol in set(table["合约"]): table_cut = table[table["合约"] == symbol] table_cut.columns = ["symbol", "rank"] + rank_columns table_cut = _table_cut_cal(pd.DataFrame(table_cut), symbol) big_dict[symbol] = table_cut.reset_index(drop=True) return big_dict def _table_cut_cal(table_cut, symbol): """ 表格切分 :param table_cut: 需要切分的表格 :type table_cut: pandas.DataFrame :param symbol: 具体合约的代码 :type symbol: str :return: 表格切分后的结果 :rtype: pandas.DataFrame """ var = symbol_varieties(symbol) table_cut[intColumns + ["rank"]] = table_cut[intColumns + ["rank"]].astype(int) table_cut_sum = table_cut.sum() table_cut_sum["rank"] = 999 for col in ["vol_party_name", "long_party_name", "short_party_name"]: table_cut_sum[col] = None table_cut = pd.concat([table_cut, pd.DataFrame(table_cut_sum).T], sort=True) table_cut["symbol"] = symbol table_cut["variety"] = var table_cut[intColumns + ["rank"]] = table_cut[intColumns + ["rank"]].astype(int) return table_cut def futures_dce_position_rank( date: str = "20160919", vars_list=cons.contract_symbols ) -> dict: """ 大连商品交易所-每日持仓排名-具体合约 http://www.dce.com.cn/dalianshangpin/xqsj/tjsj26/rtj/rcjccpm/index.html :param date: 指定交易日; e.g., "20200511" :type date: str :param vars_list: 品种列表 :type vars_list: list :return: 指定日期的持仓排名数据 :rtype: pandas.DataFrame """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} date_str = date.strftime("%Y%m%d") url = "http://www.dce.com.cn/dcereport/publicweb/dailystat/memberDealPosi/batchDownload" payload = { "tradeDate": date_str, "varietyId": "a", "contractId": "a2601", "tradeType": "1", "lang": "zh", } r = requests.post(url, json=payload) big_dict = dict() with zipfile.ZipFile(BytesIO(r.content), mode="r") as z: for i in z.namelist(): file_name = i if not file_name.startswith(date_str): continue try: data = pd.read_table(z.open(i), header=None, sep="\t") if sum(data.iloc[:, 0].str.find("会员类别") == 0) > 0: data = data.iloc[:-6] if len(data) < 12: # 处理没有活跃合约的情况 big_dict[file_name.split("_")[1]] = pd.DataFrame() continue temp_filter = data[data.iloc[:, 0].str.find("名次") == 0].index.tolist() if ( temp_filter[1] - temp_filter[0] < 5 ): # 过滤有无成交量但是有买卖持仓的数据, 如 20201105_c2011_成交量_买持仓_卖持仓排名.txt big_dict[file_name.split("_")[1]] = pd.DataFrame() continue start_list = data[data.iloc[:, 0].str.find("名次") == 0].index.tolist() data = data.iloc[ start_list[0] :, data.columns[data.iloc[start_list[0], :].notnull()], ] data.reset_index(inplace=True, drop=True) start_list = data[data.iloc[:, 0].str.find("名次") == 0].index.tolist() end_list = data[ data.iloc[:, 0].str.contains(r"(?:总计|合计)", na=False) ].index.tolist() part_one = data[start_list[0] : end_list[0]].iloc[1:, :] part_two = data[start_list[1] : end_list[1]].iloc[1:, :] part_three = data[start_list[2] : end_list[2]].iloc[1:, :] temp_df = pd.concat( objs=[ part_one.reset_index(drop=True), part_two.reset_index(drop=True), part_three.reset_index(drop=True), ], axis=1, ignore_index=True, ) temp_df.columns = [ "名次", "会员简称", "成交量", "增减", "名次", "会员简称", "持买单量", "增减", "名次", "会员简称", "持卖单量", "增减", ] temp_df["rank"] = range(1, len(temp_df) + 1) del temp_df["名次"] temp_df.columns = [ "vol_party_name", "vol", "vol_chg", "long_party_name", "long_open_interest", "long_open_interest_chg", "short_party_name", "short_open_interest", "short_open_interest_chg", "rank", ] temp_df["symbol"] = file_name.split("_")[1].upper() temp_df["variety"] = file_name.split("_")[1][:-4].upper() temp_df = temp_df[ [ "long_open_interest", "long_open_interest_chg", "long_party_name", "rank", "short_open_interest", "short_open_interest_chg", "short_party_name", "vol", "vol_chg", "vol_party_name", "symbol", "variety", ] ] temp_df = temp_df.map(lambda x: str(x).replace(",", "")) temp_df["long_open_interest"] = pd.to_numeric( temp_df["long_open_interest"], errors="coerce" ) temp_df["long_open_interest_chg"] = pd.to_numeric( temp_df["long_open_interest_chg"], errors="coerce" ) temp_df["rank"] = pd.to_numeric(temp_df["rank"], errors="coerce") temp_df["short_open_interest"] = pd.to_numeric( temp_df["short_open_interest"], errors="coerce" ) temp_df["short_open_interest_chg"] = pd.to_numeric( temp_df["short_open_interest_chg"], errors="coerce" ) temp_df["vol"] = pd.to_numeric(temp_df["vol"], errors="coerce") temp_df["vol_chg"] = pd.to_numeric(temp_df["vol_chg"], errors="coerce") big_dict[file_name.split("_")[1]] = temp_df except UnicodeDecodeError: try: data = pd.read_table( z.open(i), header=None, sep="\\s+", encoding="gb2312", skiprows=3, ) except: # noqa: E722 data = pd.read_table( z.open(i), header=None, sep="\\s+", encoding="gb2312", skiprows=4, ) start_list = data[data.iloc[:, 0].str.find("名次") == 0].index.tolist() end_list = data[data.iloc[:, 0].str.find("总计") == 0].index.tolist() part_one = data[start_list[0] : end_list[0]].iloc[1:, :] part_two = data[start_list[1] : end_list[1]].iloc[1:, :] part_three = data[start_list[2] : end_list[2]].iloc[1:, :] temp_df = pd.concat( objs=[ part_one.reset_index(drop=True), part_two.reset_index(drop=True), part_three.reset_index(drop=True), ], axis=1, ignore_index=True, ) temp_df.columns = [ "名次", "会员简称", "成交量", "增减", "名次", "会员简称", "持买单量", "增减", "名次", "会员简称", "持卖单量", "增减", ] temp_df["rank"] = range(1, len(temp_df) + 1) del temp_df["名次"] temp_df.columns = [ "vol_party_name", "vol", "vol_chg", "long_party_name", "long_open_interest", "long_open_interest_chg", "short_party_name", "short_open_interest", "short_open_interest_chg", "rank", ] temp_df["symbol"] = file_name.split("_")[1].upper() temp_df["variety"] = file_name.split("_")[1][:-4].upper() temp_df = temp_df[ [ "long_open_interest", "long_open_interest_chg", "long_party_name", "rank", "short_open_interest", "short_open_interest_chg", "short_party_name", "vol", "vol_chg", "vol_party_name", "symbol", "variety", ] ] temp_df = temp_df.map(lambda x: str(x).replace(",", "")) temp_df["long_open_interest"] = pd.to_numeric( temp_df["long_open_interest"], errors="coerce" ) temp_df["long_open_interest_chg"] = pd.to_numeric( temp_df["long_open_interest_chg"], errors="coerce" ) temp_df["rank"] = pd.to_numeric(temp_df["rank"], errors="coerce") temp_df["short_open_interest"] = pd.to_numeric( temp_df["short_open_interest"], errors="coerce" ) temp_df["short_open_interest_chg"] = pd.to_numeric( temp_df["short_open_interest_chg"], errors="coerce" ) temp_df["vol"] = pd.to_numeric(temp_df["vol"], errors="coerce") temp_df["vol_chg"] = pd.to_numeric(temp_df["vol_chg"], errors="coerce") big_dict[file_name.split("_")[1]] = temp_df dict_keys = list(big_dict.keys()) for item in dict_keys: result = re.sub(r"\d", "", item) if result.upper() not in vars_list: del big_dict[item] filtered_dict = {k: v for k, v in big_dict.items() if len(v) > 1} return filtered_dict def futures_dce_position_rank_other(date: str = "20160104"): """ 大连商品交易所-每日持仓排名-具体合约-补充 http://www.dce.com.cn/dalianshangpin/xqsj/tjsj26/rtj/rcjccpm/index.html :param date: 交易日 :type date: str :return: 合约具体名称列表 :rtype: list """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} url = "http://www.dce.com.cn/publicweb/quotesdata/memberDealPosiQuotes.html" payload = { "memberDealPosiQuotes.variety": "c", "memberDealPosiQuotes.trade_type": "0", "year": date.year, "month": date.month - 1, "day": date.day, "contract.contract_id": "all", "contract.variety_id": "c", "contract": "", } r = requests.post(url, data=payload) soup = BeautifulSoup(r.text, features="lxml") symbol_list = [ item["onclick"].strip("javascript:setVariety(").strip("');") for item in soup.find_all(attrs={"class": "selBox"})[-3].find_all("input") ] big_df = dict() for symbol in symbol_list: payload = { "memberDealPosiQuotes.variety": symbol, "memberDealPosiQuotes.trade_type": "0", "year": date.year, "month": date.month - 1, "day": date.day, "contract.contract_id": "all", "contract.variety_id": symbol, "contract": "", } r = requests.post(url, data=payload) soup = BeautifulSoup(r.text, features="lxml") contract_list = [ item["onclick"].strip("javascript:setContract_id('").strip("');") for item in soup.find_all(attrs={"name": "contract"}) ] if contract_list: if len(contract_list[0]) == 4: contract_list = [symbol + item for item in contract_list] for contract in contract_list: payload = { "memberDealPosiQuotes.variety": symbol, "memberDealPosiQuotes.trade_type": "0", "year": date.year, "month": date.month - 1, "day": date.day, "contract.contract_id": contract, "contract.variety_id": symbol, "contract": "", } r = requests.post(url, data=payload) temp_df = pd.read_html(StringIO(r.text))[1].iloc[:-1, :] temp_df.columns = [ "rank", "vol_party_name", "vol", "vol_chg", "_", "long_party_name", "long_open_interest", "long_open_interest_chg", "_", "short_party_name", "short_open_interest", "short_open_interest_chg", ] temp_df["variety"] = symbol.upper() temp_df["symbol"] = contract temp_df = temp_df[ [ "long_open_interest", "long_open_interest_chg", "long_party_name", "rank", "short_open_interest", "short_open_interest_chg", "short_party_name", "vol", "vol_chg", "vol_party_name", "symbol", "variety", ] ] big_df[contract] = temp_df return big_df def __futures_gfex_vars_list() -> list: """ 广州期货交易所-合约品种名称列表 http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml :return: 合约品种名称列表 :rtype: list """ url = "http://www.gfex.com.cn/u/interfacesWebVariety/loadList" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/119.0.0.0 Safari/537.36" } r = requests.post(url=url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]) var_list = temp_df["varietyId"].tolist() return var_list def __futures_gfex_contract_list(symbol: str = "si", date: str = "20240729") -> list: """ 广州期货交易所-合约具体名称列表 http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml :param symbol: 品种 :type symbol: str :param date: 交易日 :type date: str :return: 合约具体名称列表 :rtype: list """ url = "http://www.gfex.com.cn/u/interfacesWebTiMemberDealPosiQuotes/loadListContract_id" payload = { "variety": symbol, "trade_date": date, } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/119.0.0.0 Safari/537.36" } r = requests.post(url=url, data=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]) if temp_df.empty: return [] contract_list = temp_df.iloc[:, 0].tolist() return contract_list def __futures_gfex_contract_data( symbol: str = "si", contract_id: str = "si2312", date: str = "20231113" ) -> pd.DataFrame: """ 广州期货交易所-合约具体数据 http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml :param symbol: 品种 :type symbol: str :param contract_id: 具体合约 :type contract_id: str :param date: 交易日 :type date: str :return: 合约具体数据 :rtype: pandas.DataFrame """ url = "http://www.gfex.com.cn/u/interfacesWebTiMemberDealPosiQuotes/loadList" payload = { "trade_date": date, "trade_type": "0", "variety": symbol, "contract_id": contract_id, "data_type": "1", } headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/119.0.0.0 Safari/537.36" } big_df = pd.DataFrame() for page in range(1, 4): payload.update( { "data_type": page, } ) r = requests.post(url=url, data=payload, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]) if "qtySub" in temp_df.columns: temp_df.rename( columns={ "abbr": "vol_party_name", "todayQty": "vol", "qtySub": "vol_chg", }, inplace=True, ) else: temp_df.rename( columns={ "abbr": "vol_party_name", "todayQty": "vol", "todayQtyChg": "vol_chg", }, inplace=True, ) temp_df = temp_df[["vol_party_name", "vol", "vol_chg"]] big_df = pd.concat(objs=[big_df, temp_df], axis=1, ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df["index"] + 1 big_df.columns = [ "rank", "vol_party_name", "vol", "vol_chg", "long_party_name", "long_open_interest", "long_open_interest_chg", "short_party_name", "short_open_interest", "short_open_interest_chg", ] big_df["symbol"] = contract_id.upper() big_df["variety"] = symbol.upper() big_df = big_df.iloc[:-1, :] big_df["vol"] = pd.to_numeric(big_df["vol"], errors="coerce") big_df["vol_chg"] = pd.to_numeric(big_df["vol_chg"], errors="coerce") big_df["long_open_interest"] = pd.to_numeric( big_df["long_open_interest"], errors="coerce" ) big_df["long_open_interest_chg"] = pd.to_numeric( big_df["long_open_interest_chg"], errors="coerce" ) big_df["short_open_interest"] = pd.to_numeric( big_df["short_open_interest"], errors="coerce" ) big_df["short_open_interest_chg"] = pd.to_numeric( big_df["short_open_interest_chg"], errors="coerce" ) return big_df def futures_gfex_position_rank(date: str = "20231113", vars_list: list = None): """ 广州期货交易所-日成交持仓排名 http://www.gfex.com.cn/gfex/rcjccpm/hqsj_tjsj.shtml :param date: 开始日期; 广州期货交易所的日成交持仓排名从 20231110 开始 :type date: str :param vars_list: 商品代码列表 :type vars_list: list :return: 日成交持仓排名 :rtype: pandas.DataFrame """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return {} date = date.strftime("%Y%m%d") if vars_list is None: vars_list = __futures_gfex_vars_list() else: vars_list = [item.lower() for item in vars_list] big_dict = {} for item in vars_list: try: futures_contract_list = __futures_gfex_contract_list( symbol=item.lower(), date=date ) except: # noqa: E722 return big_dict for name in futures_contract_list: try: temp_df = __futures_gfex_contract_data( symbol=item.lower(), contract_id=name, date=date ) big_dict[name] = temp_df except: # noqa: E722 return big_dict return big_dict if __name__ == "__main__": # 郑州商品交易所 get_rank_table_czce_df = get_rank_table_czce(date="20230109") print(get_rank_table_czce_df) get_rank_table_czce_df = get_rank_table_czce(date="20201026") print(get_rank_table_czce_df) # 中国金融期货交易所 get_cffex_rank_table_df = get_cffex_rank_table(date="20250721") print(get_cffex_rank_table_df) # 上海期货交易所 get_shfe_rank_table_df = get_shfe_rank_table(date="20240509") print(get_shfe_rank_table_df) # 大连商品交易所-老接口 get_dce_rank_table_first_df = get_dce_rank_table(date="20131227") print(get_dce_rank_table_first_df) get_dce_rank_table_second_df = get_dce_rank_table(date="20171227") print(get_dce_rank_table_second_df) get_dce_rank_table_third_df = get_dce_rank_table(date="20200929") print(get_dce_rank_table_third_df) get_dce_rank_table_third_df = get_dce_rank_table(date="20230706") print(get_dce_rank_table_third_df) get_dce_rank_table_fourth_df = get_dce_rank_table(date="20210517", vars_list=["V"]) print(get_dce_rank_table_fourth_df) # 大连商品交易所-新接口 futures_dce_detail_dict = futures_dce_position_rank(date="20240517") print(futures_dce_detail_dict) futures_dce_position_rank_other_df = futures_dce_position_rank_other( date="20200727" ) print(futures_dce_position_rank_other_df) # 广州期货交易所 futures_gfex_position_rank_df = futures_gfex_position_rank(date="20250718") print(futures_gfex_position_rank_df) # 总接口 get_rank_sum_daily_df = get_rank_sum_daily( start_day="20251031", end_day="20251103", ) print(get_rank_sum_daily_df) ================================================ FILE: akshare/futures/futures_basis.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/12/12 17:00 Desc: 生意社网站采集大宗商品现货价格及相应基差数据, 数据时间段从 20110104-至今 备注:现期差 = 现货价格 - 期货价格(这里的期货价格为结算价) 黄金为 元/克, 白银为 元/千克, 玻璃现货为 元/平方米, 鸡蛋现货为 元/公斤, 鸡蛋期货为 元/500千克, 其余为 元/吨. 焦炭现货规格是: 一级冶金焦; 焦炭期货规格: 介于一级和二级之间, 焦炭现期差仅供参考. 铁矿石现货价格是: 湿吨, 铁矿石期货价格是: 干吨 网页地址: https://www.100ppi.com/sf/ 历史数据可以通过修改 url 地址来获取, 比如: https://www.100ppi.com/sf/day-2017-09-12.html 发现生意社的 bugs: 1. 2018-09-12 周三 数据缺失是因为生意社源数据在该交易日缺失: https://www.100ppi.com/sf/day-2018-09-12.html """ import datetime import re import time import warnings from typing import List import pandas as pd from akshare.futures import cons from akshare.futures.requests_fun import pandas_read_html_link from akshare.futures.symbol_var import chinese_to_english calendar = cons.get_calendar() def futures_spot_price_daily( start_day: str = "20210201", end_day: str = "20210208", vars_list: list = cons.contract_symbols, ): """ 指定时间段内大宗商品现货价格及相应基差 https://www.100ppi.com/sf/ :param start_day: str 开始日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象; 默认为当天 :param end_day: str 结束数据 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象; 默认为当天 :param vars_list: list 合约品种如 [RB, AL]; 默认参数为所有商品 :return: 基差 :rtype: pandas.DataFrame 展期收益率数据: var 商品品种 string sp 现货价格 float near_symbol 临近交割合约 string near_price 临近交割合约结算价 float dom_symbol 主力合约 string dom_price 主力合约结算价 float near_basis 临近交割合约相对现货的基差 float dom_basis 主力合约相对现货的基差 float near_basis_rate 临近交割合约相对现货的基差率 float dom_basis_rate 主力合约相对现货的基差率 float date 日期 string YYYYMMDD """ start_day = ( cons.convert_date(start_day) if start_day is not None else datetime.date.today() ) end_day = ( cons.convert_date(end_day) if end_day is not None else cons.convert_date(cons.get_latest_data_date(datetime.datetime.now())) ) df_list = [] while start_day <= end_day: temp_df = futures_spot_price(start_day, vars_list) if temp_df is False: return pd.concat(df_list).reset_index(drop=True) elif temp_df is not None: df_list.append(temp_df) start_day += datetime.timedelta(days=1) if len(df_list) > 0: temp_df = pd.concat(df_list) temp_df.reset_index(drop=True, inplace=True) return temp_df def futures_spot_price( date: str = "20240430", vars_list: list = cons.contract_symbols ) -> pd.DataFrame: """ 指定交易日大宗商品现货价格及相应基差 https://www.100ppi.com/sf/day-2017-09-12.html :param date: 开始日期 format: YYYY-MM-DD 或 YYYYMMDD 或 datetime.date 对象; 为空时为当天 :param vars_list: 合约品种如 RB、AL 等列表 为空时为所有商品 :return: pandas.DataFrame 展期收益率数据: var 商品品种 string sp 现货价格 float near_symbol 临近交割合约 string near_price 临近交割合约结算价 float dom_symbol 主力合约 string dom_price 主力合约结算价 float near_basis 临近交割合约相对现货的基差 float dom_basis 主力合约相对现货的基差 float near_basis_rate 临近交割合约相对现货的基差率 float dom_basis_rate 主力合约相对现货的基差率 float date 日期 string YYYYMMDD """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date < datetime.date(2011, 1, 4): raise Exception( "数据源开始日期为 20110104, 请将获取数据时间点设置在 20110104 后" ) if date.strftime("%Y%m%d") not in calendar: warnings.warn(f"{date.strftime('%Y%m%d')}非交易日") return pd.DataFrame() u1 = "https://www.100ppi.com/sf/" u2 = f"https://www.100ppi.com/sf/day-{date.strftime('%Y-%m-%d')}.html" i = 1 while True: for url in [u2, u1]: try: # url = u2 headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9," "image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7" } r = pandas_read_html_link(url, headers=headers) string = r[0].loc[1, 1] news = "".join(re.findall(r"[0-9]", string)) if news[3:11] == date.strftime("%Y%m%d"): records = _check_information(r[1], date) records.index = records["symbol"] var_list_in_market = [i for i in vars_list if i in records.index] temp_df = records.loc[var_list_in_market, :] temp_df.reset_index(drop=True, inplace=True) return temp_df else: time.sleep(3) except Exception as e: # noqa: E722 print( f"{date.strftime('%Y-%m-%d')}日生意社数据连接失败[错误信息:{e}],第{str(i)}次尝试,最多5次" ) i += 1 if i > 5: print( f"{date.strftime('%Y-%m-%d')}日生意社数据连接失败, 如果当前交易日是 2018-09-12, " f"由于生意社源数据缺失, 无法访问, 否则为重复访问已超过5次,您的地址被网站墙了," f"请保存好返回数据,稍后从该日期起重试" ) return pd.DataFrame() def _check_information(df_data, date): """ 数据验证和计算模块 :param df_data: pandas.DataFrame 采集的数据 :param date: datetime.date 具体某一天 YYYYMMDD :return: pandas.DataFrame 中间数据 symbol spot_price near_contract ... near_basis_rate dom_basis_rate date CU 49620.00 cu1811 ... -0.002418 -0.003426 20181108 RB 4551.54 rb1811 ... -0.013521 -0.134359 20181108 ZN 22420.00 zn1811 ... -0.032114 -0.076271 20181108 AL 13900.00 al1812 ... 0.005396 0.003957 20181108 AU 274.10 au1811 ... 0.005655 0.020430 20181108 WR 4806.25 wr1903 ... -0.180026 -0.237035 20181108 RU 10438.89 ru1811 ... -0.020969 0.084406 20181108 PB 18600.00 pb1811 ... -0.001344 -0.010215 20181108 AG 3542.67 ag1811 ... -0.000754 0.009408 20181108 BU 4045.53 bu1811 ... -0.129904 -0.149679 20181108 HC 4043.33 hc1811 ... -0.035449 -0.088128 20... """ df_data = df_data.loc[:, [0, 1, 2, 3, 5, 6]] df_data.columns = [ "symbol", "spot_price", "near_contract", "near_contract_price", "dominant_contract", "dominant_contract_price", ] records = pd.DataFrame() for string in df_data["symbol"].tolist(): news = "".join(re.findall(r"[\u4e00-\u9fa5]", string)) if news == "": news = string.strip() """ if string == "PTA": news = "PTA" else: news = "".join(re.findall(r"[\u4e00-\u9fa5]", string)) """ if news != "" and news not in [ "商品", "价格", "上海期货交易所", "郑州商品交易所", "大连商品交易所", "广州期货交易所", # 某些天网站没有数据,比如 20180912,此时返回"暂无数据",但并不是网站被墙了 "暂无数据", ]: symbol = chinese_to_english(news) record = pd.DataFrame(df_data[df_data["symbol"] == string]) record.loc[:, "symbol"] = symbol record["spot_price"] = record["spot_price"].astype(float) if ( symbol == "JD" ): # 鸡蛋现货为元/公斤, 鸡蛋期货为元/500千克, 其余元/吨(http://www.100ppi.com/sf/) record.loc[:, "spot_price"] = float(record["spot_price"].iloc[0]) * 500 elif ( symbol == "FG" ): # 上表中现货单位为元/平方米, 期货单位为元/吨. 换算公式:元/平方米*80=元/吨(http://www.100ppi.com/sf/959.html) record.loc[:, "spot_price"] = float(record["spot_price"].iloc[0]) * 80 elif ( symbol == "LH" ): # 上表中现货单位为元/公斤, 期货单位为元/吨. 换算公式:元/公斤*1000=元/吨(http://www.100ppi.com/sf/959.html) record.loc[:, "spot_price"] = float(record["spot_price"].iloc[0]) * 1000 records = pd.concat([records, record]) # 20241129:如果某日没有数据,直接返回返回空表 if records.empty: records = df_data.iloc[0:0] records["near_basis"] = pd.Series(dtype="float") records["dom_basis"] = pd.Series(dtype="float") records["near_basis_rate"] = pd.Series(dtype="float") records["dom_basis_rate"] = pd.Series(dtype="float") records["date"] = pd.Series(dtype="object") return records records[["near_contract_price", "dominant_contract_price", "spot_price"]] = ( records[["near_contract_price", "dominant_contract_price", "spot_price"] ].astype("float") ) records["near_contract"] = records["near_contract"].replace( r"[^0-9]*(\d*)$", r"\g<1>", regex=True ) records["dominant_contract"] = records["dominant_contract"].replace( r"[^0-9]*(\d*)$", r"\g<1>", regex=True ) records["near_month"] = records.loc[:, "near_contract"] records["near_contract"] = records["symbol"] + records.loc[ :, "near_contract" ].astype("int").astype("str") records["dominant_month"] = records.loc[:, "dominant_contract"] records["dominant_contract"] = records["symbol"] + records.loc[ :, "dominant_contract" ].astype("int").astype("str") records["near_contract"] = records["near_contract"].apply( lambda x: ( x.lower() if x[:-4] in cons.market_exchange_symbols["shfe"] + cons.market_exchange_symbols["dce"] else x ) ) records["dominant_contract"] = records["dominant_contract"].apply( lambda x: ( x.lower() if x[:-4] in cons.market_exchange_symbols["shfe"] + cons.market_exchange_symbols["dce"] else x ) ) records["near_contract"] = records["near_contract"].apply( lambda x: ( x[:-4] + x[-3:] if x[:-4] in cons.market_exchange_symbols["czce"] else x ) ) records["dominant_contract"] = records["dominant_contract"].apply( lambda x: ( x[:-4] + x[-3:] if x[:-4] in cons.market_exchange_symbols["czce"] else x ) ) records["near_basis"] = records["near_contract_price"] - records["spot_price"] records["dom_basis"] = records["dominant_contract_price"] - records["spot_price"] records["near_basis_rate"] = ( records["near_contract_price"] / records["spot_price"] - 1 ) records["dom_basis_rate"] = ( records["dominant_contract_price"] / records["spot_price"] - 1 ) # records.loc[:, "date"] = date.strftime("%Y%m%d") records.insert(0, "date", date.strftime("%Y%m%d")) records.reset_index(inplace=True, drop=True) return records def _join_head(content: pd.DataFrame) -> List: headers = [] for s1, s2 in zip(content.iloc[0], content.iloc[1]): if s1 != s2: s = f"{s1}{s2}" else: s = s1 headers.append(s) return headers def futures_spot_price_previous(date: str = "20240430") -> pd.DataFrame: """ 具体交易日大宗商品现货价格及相应基差 https://www.100ppi.com/sf/day-2017-09-12.html :param date: 交易日; 历史日期 :type date: str :return: 现货价格及相应基差 :rtype: pandas.DataFrame """ date = cons.convert_date(date) if date is not None else datetime.date.today() if date < datetime.date(2011, 1, 4): raise Exception( "数据源开始日期为 20110104, 请将获取数据时间点设置在 20110104 后" ) if date.strftime("%Y%m%d") not in calendar: warnings.warn(f"{date.strftime('%Y%m%d')}非交易日") return pd.DataFrame() url = date.strftime("https://www.100ppi.com/sf2/day-%Y-%m-%d.html") headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp," "image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7" } content = pandas_read_html_link(url, headers=headers) main = content[1] # Header header = _join_head(main) # Values values = main[main[4].str.endswith("%")] values.columns = header # Basis # 对于没有数据的天,xml文件中没有数据,所以content[2:-1]可能为空 if len(content[2:-1]) > 0: basis = pd.concat(content[2:-1]) else: basis = pd.DataFrame(columns=["主力合约基差", "主力合约基差(%)"]) basis.columns = ["主力合约基差", "主力合约基差(%)"] # 20241125(jasonudu):因为部分日期,存在多个品种的现货价格,比如20151125的白糖、豆粕、豆油等, # 如果用商品名来merge,会出现重复列名,所以改用index来merge # basis["商品"] = values["商品"].tolist() basis.index = values.index basis = pd.merge( values[["商品", "现货价格", "主力合约代码", "主力合约价格"]], basis, left_index=True, right_index=True, ) basis = pd.merge( basis, values[ [ "180日内主力基差最高", "180日内主力基差最低", "180日内主力基差平均", ] ], left_index=True, right_index=True, ) basis.columns = [ "商品", "现货价格", "主力合约代码", "主力合约价格", "主力合约基差", "主力合约变动百分比", "180日内主力基差最高", "180日内主力基差最低", "180日内主力基差平均", ] basis["主力合约变动百分比"] = basis["主力合约变动百分比"].str.strip("%") basis.reset_index(inplace=True, drop=True) return basis if __name__ == "__main__": futures_spot_price_daily_df = futures_spot_price_daily( start_day="20260303", end_day="20260303", vars_list=['PL'] ) print(futures_spot_price_daily_df) futures_spot_price_df = futures_spot_price(date="20260303") print(futures_spot_price_df) futures_spot_price_previous_df = futures_spot_price_previous(date="20240430") print(futures_spot_price_previous_df) ================================================ FILE: akshare/futures/futures_comex_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2023/11/15 18:00 Desc: 东方财富网-数据中心-期货期权-COMEX库存数据 https://data.eastmoney.com/pmetal/comex/by.html """ import pandas as pd import requests from akshare.utils.tqdm import get_tqdm def futures_comex_inventory(symbol: str = "黄金") -> pd.DataFrame: """ 东方财富网-数据中心-期货期权-COMEX库存数据 https://data.eastmoney.com/pmetal/comex/by.html :param symbol: choice of {"黄金", "白银"} :type symbol: str :return: COMEX库存数据 :rtype: pandas.DataFrame """ symbol_map = { "黄金": "EMI00069026", "白银": "EMI00069027", } url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "sortColumns": "REPORT_DATE", "sortTypes": "-1", "pageSize": "500", "pageNumber": "1", "reportName": "RPT_FUTUOPT_GOLDSIL", "columns": "ALL", "quoteColumns": "", "source": "WEB", "client": "WEB", "filter": f'(INDICATOR_ID1="{symbol_map[symbol]}")(@STORAGE_TON<>"NULL")', } r = requests.get(url, params=params) data_json = r.json() total_page = data_json["result"]["pages"] big_df = pd.DataFrame() tqdm = get_tqdm() for page in tqdm(range(1, total_page + 1), leave=False): params.update( { "pageNumber": page, } ) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) big_df = pd.concat(objs=[big_df, temp_df], axis=0, ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df["index"] + 1 big_df.rename( columns={ "index": "序号", "REPORT_DATE": "日期", "INDICATOR_NAME": "-", "INDICATOR_ID1": "-", "STORAGE_TON": f"COMEX{symbol}库存量-吨", "STORAGE_OUNCE": f"COMEX{symbol}库存量-盎司", "INDICATOR_ID2": "-", "NETPOSITION_TON": "-", "NETPOSITION_OUNCE": "-", "NETPOSITION_DOLLAR": "-", "INDICATOR_ID3": "-", "OPENPOSI_STOCK": "-", "OPENPOSTOCK_WECHANGE": "-", "OPENPOSI_STOCK_SUM": "-", }, inplace=True, ) big_df = big_df[ [ "序号", "日期", f"COMEX{symbol}库存量-吨", f"COMEX{symbol}库存量-盎司", ] ] big_df[f"COMEX{symbol}库存量-吨"] = pd.to_numeric( big_df[f"COMEX{symbol}库存量-吨"], errors="coerce" ) big_df[f"COMEX{symbol}库存量-盎司"] = pd.to_numeric( big_df[f"COMEX{symbol}库存量-盎司"], errors="coerce" ) big_df["日期"] = pd.to_datetime(big_df["日期"], errors="coerce").dt.date big_df.sort_values(["日期"], inplace=True, ignore_index=True) big_df["序号"] = range(1, len(big_df) + 1) return big_df if __name__ == "__main__": futures_comex_inventory_df = futures_comex_inventory(symbol="黄金") print(futures_comex_inventory_df) ================================================ FILE: akshare/futures/futures_comm_ctp.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/7/6 18:00 Desc: openctp 期货交易费用参照表 http://openctp.cn/fees.html """ from datetime import datetime from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup def futures_fees_info() -> pd.DataFrame: """ openctp 期货交易费用参照表 http://openctp.cn/fees.html :return: 期货交易费用参照表 :rtype: pandas.DataFrame """ url = "http://openctp.cn/fees.html" r = requests.get(url) r.encoding = "utf-8" soup = BeautifulSoup(r.text, features="lxml") datetime_str = soup.find("p").string.strip("Generated at ").strip(".") datetime_raw = datetime.strptime(datetime_str, "%Y-%m-%d %H:%M:%S") temp_df = pd.read_html(StringIO(r.text))[0] temp_df["更新时间"] = datetime_raw.strftime("%Y-%m-%d %H:%M:%S") return temp_df if __name__ == "__main__": futures_fees_info_df = futures_fees_info() print(futures_fees_info_df) ================================================ FILE: akshare/futures/futures_comm_js.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/2/22 15:45 Desc: 金十数据-期货手续费 https://www.jin10.com/ """ import json import pandas as pd import requests def futures_comm_js(date: str = "20260213") -> pd.DataFrame: """ 金十财经-期货手续费 https://www.jin10.com/ :param date: 日期; 格式为 YYYYMMDD,例如 "20250213" :type date: str :return: 期货手续费数据 :rtype: pandas.DataFrame """ headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/107.0.0.0 Safari/537.36", "x-app-id": "fiXF2nOnDycGutVA", "x-version": "1.0", "referer": "https://www.jin10.com/", "origin": "https://www.jin10.com", } url = "https://mp-api.jin10.com/api/dynamic-data/child" formatted_date = "-".join([date[:4], date[4:6], date[6:]]) params = { "tb_name": "_vir_26", "search": json.dumps({"range,date": f"{formatted_date},{formatted_date}", "status": 1}), "order": "date,desc", } r = requests.get(url, params=params, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]) temp_df = temp_df.rename( columns={ "date": "日期", "heyue_name": "合约品种", "heyue_code": "合约代码", "pub_date_commission": "手续费公布时间", "pub_date_price": "价格公布时间", "heyue_price": "现价", "up_limit_num": "涨停板", "down_limit_num": "跌停板", "buy_ratio": "保证金/买开", "sell_ratio": "保证金/卖开", "per_lot_price": "保证金/每手", "per_ratio": "每手跳数", "buy_commission": "开仓", "sell_yesterday_commission": "平昨", "sell_cur_commission": "平今", "per_commission_price": "每跳毛利", "per_net_profit": "每跳净利", "jys": "交易所", } ) temp_df = temp_df.drop( columns=["id", "status", "created_at", "updated_at", "_date", "_pub_date_commission", "_pub_date_price"], errors="ignore") 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") 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") return temp_df if __name__ == "__main__": futures_comm_js_df = futures_comm_js(date="20260213") print(futures_comm_js_df) ================================================ FILE: akshare/futures/futures_comm_qihuo.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/4/11 17:00 Desc: 九期网-期货手续费 https://www.9qihuo.com/qihuoshouxufei """ from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup def _futures_comm_qihuo_process(df: pd.DataFrame, name: str = None) -> pd.DataFrame: """ 期货手续费数据细节处理函数 https://www.9qihuo.com/qihuoshouxufei :param df: 获取到的 pandas.DataFrame 数据 :type df: pandas.DataFrame :param name: 交易所名称 :type name: str :return: 处理后的数据 :rtype: pandas.DataFrame """ import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) common_temp_df = df.copy() common_temp_df["合约名称"] = ( common_temp_df["合约品种"].str.split("(", expand=True).iloc[:, 0].str.strip() ) common_temp_df["合约代码"] = ( common_temp_df["合约品种"].str.split("(", expand=True).iloc[:, 1].str.strip(")") ) common_temp_df["涨停板"] = ( common_temp_df["涨/跌停板"].str.split("/", expand=True).iloc[:, 0].str.strip() ) common_temp_df["跌停板"] = ( common_temp_df["涨/跌停板"].str.split("/", expand=True).iloc[:, 1].str.strip() ) common_temp_df["保证金-买开"] = common_temp_df["保证金-买开"].str.strip("%") common_temp_df["保证金-卖开"] = common_temp_df["保证金-卖开"].str.strip("%") common_temp_df["保证金-每手"] = common_temp_df["保证金-保证金/每手"].str.strip("元") common_temp_df["手续费"] = common_temp_df["手续费(开+平)"].str.strip("元") try: temp_df_ratio = ( common_temp_df["手续费标准-开仓"][ common_temp_df["手续费标准-开仓"].str.contains("万分之") ] .str.split("/", expand=True) .iloc[:, 0] .astype(float) / 10000 ) except IndexError: temp_df_ratio = pd.NA temp_df_yuan = common_temp_df["手续费标准-开仓"][ common_temp_df["手续费标准-开仓"].str.contains("元") ] common_temp_df["手续费标准-开仓-万分之"] = temp_df_ratio common_temp_df["手续费标准-开仓-元"] = temp_df_yuan.str.strip("元") try: temp_df_ratio = ( common_temp_df["手续费标准-平昨"][ common_temp_df["手续费标准-平昨"].str.contains("万分之") ] .str.split("/", expand=True) .iloc[:, 0] .astype(float) / 10000 ) except IndexError: temp_df_ratio = pd.NA temp_df_yuan = common_temp_df["手续费标准-平昨"][ common_temp_df["手续费标准-平昨"].str.contains("元") ] common_temp_df["手续费标准-平昨-万分之"] = temp_df_ratio common_temp_df["手续费标准-平昨-元"] = temp_df_yuan.str.strip("元") try: temp_df_ratio = ( common_temp_df["手续费标准-平今"][ common_temp_df["手续费标准-平今"].str.contains("万分之") ] .str.split("/", expand=True) .iloc[:, 0] .astype(float) / 10000 ) except IndexError: temp_df_ratio = pd.NA temp_df_yuan = common_temp_df["手续费标准-平今"][ common_temp_df["手续费标准-平今"].str.contains("元") ] common_temp_df["手续费标准-平今-万分之"] = temp_df_ratio common_temp_df["手续费标准-平今-元"] = temp_df_yuan.str.strip("元") del common_temp_df["手续费标准-开仓"] del common_temp_df["手续费标准-平昨"] del common_temp_df["手续费标准-平今"] del common_temp_df["合约品种"] del common_temp_df["涨/跌停板"] del common_temp_df["手续费(开+平)"] del common_temp_df["保证金-保证金/每手"] common_temp_df["交易所名称"] = name common_temp_df = common_temp_df[ [ "交易所名称", "合约名称", "合约代码", "现价", "涨停板", "跌停板", "保证金-买开", "保证金-卖开", "保证金-每手", "手续费标准-开仓-万分之", "手续费标准-开仓-元", "手续费标准-平昨-万分之", "手续费标准-平昨-元", "手续费标准-平今-万分之", "手续费标准-平今-元", "每跳毛利", "手续费", "每跳净利", "备注", ] ] common_temp_df["现价"] = pd.to_numeric(common_temp_df["现价"]) common_temp_df["涨停板"] = pd.to_numeric(common_temp_df["涨停板"]) common_temp_df["跌停板"] = pd.to_numeric(common_temp_df["跌停板"]) common_temp_df["保证金-买开"] = pd.to_numeric(common_temp_df["保证金-买开"]) common_temp_df["保证金-卖开"] = pd.to_numeric(common_temp_df["保证金-卖开"]) common_temp_df["保证金-每手"] = pd.to_numeric(common_temp_df["保证金-每手"]) # common_temp_df["手续费标准-开仓-元"] = pd.to_numeric(common_temp_df["手续费标准-开仓-元"]) # common_temp_df["手续费标准-平昨-元"] = pd.to_numeric(common_temp_df["手续费标准-平昨-元"]) # common_temp_df["手续费标准-平今-元"] = pd.to_numeric(common_temp_df["手续费标准-平今-元"]) common_temp_df["每跳毛利"] = pd.to_numeric(common_temp_df["每跳毛利"]) common_temp_df["手续费"] = pd.to_numeric(common_temp_df["手续费"]) common_temp_df["每跳净利"] = pd.to_numeric(common_temp_df["每跳净利"]) session = requests.Session() headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/125.0.0.0 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive", "Referer": "https://www.9qihuo.com/", "Sec-Fetch-Dest": "document", "Sec-Fetch-Mode": "navigate", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-User": "?1", "Upgrade-Insecure-Requests": "1", "Cache-Control": "max-age=0", } session.get("https://www.9qihuo.com/", headers=headers, timeout=10) r = session.get( "https://www.9qihuo.com/qihuoshouxufei", headers=headers, timeout=10 ) soup = BeautifulSoup(r.text, features="lxml") raw_date_text = soup.find(name="a", attrs={"id": "dlink"}).previous comm_update_time = raw_date_text.split(",")[0].strip("(手续费更新时间:") price_update_time = ( raw_date_text.split(",")[1].strip("价格更新时间:").strip("。)") ) common_temp_df["手续费更新时间"] = comm_update_time common_temp_df["价格更新时间"] = price_update_time return common_temp_df def futures_comm_info(symbol: str = "所有") -> pd.DataFrame: """ 九期网-期货手续费 https://www.9qihuo.com/qihuoshouxufei :param symbol: choice of {"所有", "上海期货交易所", "大连商品交易所", "郑州商品交易所", "上海国际能源交易中心", "中国金融期货交易所", "广州期货交易所"} :type symbol: str :return: 期货手续费 :rtype: pandas.DataFrame """ session = requests.Session() headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/125.0.0.0 Safari/537.36", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Accept-Encoding": "gzip, deflate, br", "Connection": "keep-alive", "Referer": "https://www.9qihuo.com/", "Sec-Fetch-Dest": "document", "Sec-Fetch-Mode": "navigate", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-User": "?1", "Upgrade-Insecure-Requests": "1", "Cache-Control": "max-age=0", } session.get("https://www.9qihuo.com/", headers=headers, timeout=10) r = session.get( "https://www.9qihuo.com/qihuoshouxufei", headers=headers, timeout=10 ) temp_df = pd.read_html(StringIO(r.text))[0] temp_df.columns = [ "合约品种", "现价", "涨/跌停板", "保证金-买开", "保证金-卖开", "保证金-保证金/每手", "手续费标准-开仓", "手续费标准-平昨", "手续费标准-平今", "每跳毛利", "手续费(开+平)", "每跳净利", "备注", "-", "-", ] df_0 = temp_df[temp_df["合约品种"].str.contains("上海期货交易所")].index.values[0] df_1 = temp_df[temp_df["合约品种"].str.contains("大连商品交易所")].index.values[0] df_2 = temp_df[temp_df["合约品种"].str.contains("郑州商品交易所")].index.values[0] df_3 = temp_df[ temp_df["合约品种"].str.contains("上海国际能源交易中心") ].index.values[0] df_4 = temp_df[temp_df["合约品种"].str.contains("广州期货交易所")].index.values[0] df_5 = temp_df[temp_df["合约品种"].str.contains("中国金融期货交易所")].index.values[ 0 ] shfe_df = temp_df.iloc[df_0 + 3 : df_1, :].reset_index(drop=True) dce_df = temp_df.iloc[df_1 + 3 : df_2, :].reset_index(drop=True) czce_df = temp_df.iloc[df_2 + 3 : df_3, :].reset_index(drop=True) ine_df = temp_df.iloc[df_3 + 3 : df_4, :].reset_index(drop=True) gfex_df = temp_df.iloc[df_4 + 3 : df_5, :].reset_index(drop=True) cffex_df = temp_df.iloc[df_5 + 3 :, :].reset_index(drop=True) if symbol == "上海期货交易所": return _futures_comm_qihuo_process(shfe_df, name="上海期货交易所") elif symbol == "大连商品交易所": return _futures_comm_qihuo_process(dce_df, name="大连商品交易所") elif symbol == "郑州商品交易所": return _futures_comm_qihuo_process(czce_df, name="郑州商品交易所") elif symbol == "上海国际能源交易中心": return _futures_comm_qihuo_process(ine_df, name="上海国际能源交易中心") elif symbol == "广州期货交易所": return _futures_comm_qihuo_process(gfex_df, name="广州期货交易所") elif symbol == "中国金融期货交易所": return _futures_comm_qihuo_process(cffex_df, name="中国金融期货交易所") else: big_df = pd.DataFrame() big_df = pd.concat( objs=[big_df, _futures_comm_qihuo_process(shfe_df, name="上海期货交易所")], ignore_index=True, ) big_df = pd.concat( objs=[big_df, _futures_comm_qihuo_process(dce_df, name="大连商品交易所")], ignore_index=True, ) big_df = pd.concat( objs=[big_df, _futures_comm_qihuo_process(czce_df, name="郑州商品交易所")], ignore_index=True, ) big_df = pd.concat( objs=[ big_df, _futures_comm_qihuo_process(ine_df, name="上海国际能源交易中心"), ], ignore_index=True, ) big_df = pd.concat( objs=[big_df, _futures_comm_qihuo_process(gfex_df, name="广州期货交易所")], ignore_index=True, ) big_df = pd.concat( objs=[ big_df, _futures_comm_qihuo_process(cffex_df, name="中国金融期货交易所"), ], ignore_index=True, ) return big_df if __name__ == "__main__": futures_comm_info_df = futures_comm_info(symbol="所有") print(futures_comm_info_df) ================================================ FILE: akshare/futures/futures_contract_detail.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/10/30 17:00 Desc: 查询期货合约当前时刻的详情 https://finance.sina.com.cn/futures/quotes/V2101.shtml """ from io import StringIO import pandas as pd import requests from bs4 import BeautifulSoup def futures_contract_detail(symbol: str = "AP2101") -> pd.DataFrame: """ 查询期货合约详情 https://finance.sina.com.cn/futures/quotes/V2101.shtml :param symbol: 合约 :type symbol: str :return: 期货合约详情 :rtype: pandas.DataFrame """ url = f"https://finance.sina.com.cn/futures/quotes/{symbol}.shtml" r = requests.get(url) r.encoding = "gb2312" temp_df = pd.read_html(StringIO(r.text))[6] data_one = temp_df.iloc[:, :2] data_one.columns = ["item", "value"] data_two = temp_df.iloc[:, 2:4] data_two.columns = ["item", "value"] data_three = temp_df.iloc[:, 4:] data_three.columns = ["item", "value"] temp_df = pd.concat( objs=[data_one, data_two, data_three], axis=0, ignore_index=True ) return temp_df def futures_contract_detail_em(symbol: str = "v2602F") -> pd.DataFrame: """ 查询期货合约详情 https://quote.eastmoney.com/qihuo/v2602F.html :param symbol: 合约 :type symbol: str :return: 期货合约详情 :rtype: pandas.DataFrame """ url = f"https://quote.eastmoney.com/qihuo/{symbol}.html" r = requests.get(url) soup = BeautifulSoup(r.text, features="lxml") url_text = ( soup.find(name="div", attrs={"class": "sidertabbox_tsplit"}) .find(name="div", attrs={"class": "onet"}) .find("a")["href"] ) inner_symbol = url_text.split("#")[-1].strip("futures_") url = f"https://futsse-static.eastmoney.com/redis?msgid={inner_symbol}_info" r = requests.get(url) data_json = r.json() temp_df = pd.DataFrame.from_dict(data_json, orient="index") column_mapping = { "vname": "交易品种", "vcode": "交易代码", "jydw": "交易单位", "bjdw": "报价单位", "market": "上市交易所", "zxbddw": "最小变动价格", "zdtbfd": "跌涨停板幅度", "hyjgyf": "合约交割月份", "jysj": "交易时间", "zhjyr": "最后交易日", "zhjgr": "最后交割日", "jgpj": "交割品级", "zcjybzj": "最初交易保证金", "jgfs": "交割方式", } temp_df.rename(index=column_mapping, inplace=True) temp_df.reset_index(drop=False, inplace=True) temp_df.columns = ["item", "value"] return temp_df if __name__ == "__main__": futures_contract_detail_df = futures_contract_detail(symbol="V2101") print(futures_contract_detail_df) futures_contract_detail_em_df = futures_contract_detail_em(symbol="l2602F") print(futures_contract_detail_em_df) ================================================ FILE: akshare/futures/futures_daily_bar.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/11/30 18:00 Desc: 期货日线行情 """ import datetime import json import re import zipfile from io import BytesIO, StringIO import numpy as np import pandas as pd import requests from akshare.futures import cons from akshare.futures.requests_fun import requests_link calendar = cons.get_calendar() def _futures_daily_czce( date: str = "20100824", dataset: str = "datahistory2010" ) -> pd.DataFrame: """ 郑州商品交易所-交易数据-历史行情下载 http://www.czce.com.cn/cn/jysj/lshqxz/H770319index_1.htm :param date: 需要的日期 :type date: str :param dataset: 数据集的名称; 此处只需要替换 datahistory2010 中的 2010 即可 :type dataset: str :return: 指定日期的所有品种行情数据 :rtype: pandas.DataFrame """ url = f"http://www.czce.com.cn/cn/exchange/{dataset}.zip" r = requests.get(url) with zipfile.ZipFile(BytesIO(r.content)) as file: with file.open(f"{dataset}.txt") as my_file: data = my_file.read().decode("gb2312") data_df = pd.read_table(StringIO(data), sep=r"|", header=1) data_df.columns = [item.strip() for item in data_df.columns] data_df.dropna(axis=1, inplace=True) for column in data_df.columns: try: data_df[column] = data_df[column].str.strip("\t") data_df[column] = data_df[column].str.replace(",", "") except: # noqa: E722 data_df[column] = data_df[column] data_df["昨结算"] = pd.to_numeric(data_df["昨结算"]) data_df["今开盘"] = pd.to_numeric(data_df["今开盘"]) data_df["最高价"] = pd.to_numeric(data_df["最高价"]) data_df["最低价"] = pd.to_numeric(data_df["最低价"]) data_df["今收盘"] = pd.to_numeric(data_df["今收盘"]) data_df["今结算"] = pd.to_numeric(data_df["今结算"]) data_df["涨跌1"] = pd.to_numeric(data_df["涨跌1"]) data_df["涨跌2"] = pd.to_numeric(data_df["涨跌2"]) data_df["成交量(手)"] = pd.to_numeric(data_df["成交量(手)"]) data_df["空盘量"] = pd.to_numeric(data_df["空盘量"]) data_df["增减量"] = pd.to_numeric(data_df["增减量"]) data_df["成交额(万元)"] = pd.to_numeric(data_df["成交额(万元)"]) data_df["交割结算价"] = pd.to_numeric(data_df["交割结算价"]) data_df["交易日期"] = pd.to_datetime(data_df["交易日期"]) data_df.columns = [ "date", "symbol", "pre_settle", "open", "high", "low", "close", "settle", "-", "-", "volume", "open_interest", "-", "turnover", "-", ] variety_list = [ re.compile(r"[a-zA-Z_]+").findall(item)[0] for item in data_df["symbol"] ] data_df["variety"] = variety_list data_df = data_df[ [ "symbol", "date", "open", "high", "low", "close", "volume", "open_interest", "turnover", "settle", "pre_settle", "variety", ] ] temp_df = data_df[data_df["date"] == pd.Timestamp(date)].copy() temp_df["date"] = date temp_df.reset_index(inplace=True, drop=True) return temp_df def get_cffex_daily(date: str = "20100416") -> pd.DataFrame: """ 中国金融期货交易所-日频率交易数据 http://www.cffex.com.cn/rtj/ :param date: 交易日; 数据开始时间为 20100416 :type date: str :return: 日频率交易数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() if day.strftime("%Y%m%d") not in calendar: # warnings.warn("%s非交易日" % day.strftime("%Y%m%d")) return pd.DataFrame() url = f"http://www.cffex.com.cn/sj/historysj/{date[:-2]}/zip/{date[:-2]}.zip" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", } r = requests.get(url, headers=headers) try: with zipfile.ZipFile(BytesIO(r.content)) as file: with file.open(f"{date}_1.csv") as my_file: data = my_file.read().decode("gb2312") data_df = pd.read_csv(StringIO(data)) except: # noqa: E722 return pd.DataFrame() data_df = data_df[data_df["合约代码"] != "小计"] data_df = data_df[data_df["合约代码"] != "合计"] data_df = data_df[~data_df["合约代码"].str.contains("IO")] data_df = data_df[~data_df["合约代码"].str.contains("MO")] data_df = data_df[~data_df["合约代码"].str.contains("HO")] data_df.reset_index(inplace=True, drop=True) data_df["合约代码"] = data_df["合约代码"].str.strip() symbol_list = data_df["合约代码"].to_list() variety_list = [re.compile(r"[a-zA-Z_]+").findall(item)[0] for item in symbol_list] if data_df.shape[1] == 15: data_df.columns = [ "symbol", "open", "high", "low", "volume", "turnover", "open_interest", "_", "close", "settle", "pre_settle", "_", "_", "_", "_", ] else: data_df.columns = [ "symbol", "open", "high", "low", "volume", "turnover", "open_interest", "_", "close", "settle", "pre_settle", "_", "_", "_", ] data_df["date"] = date data_df["variety"] = variety_list data_df = data_df[ [ "symbol", "date", "open", "high", "low", "close", "volume", "open_interest", "turnover", "settle", "pre_settle", "variety", ] ] return data_df def get_gfex_daily(date: str = "20221223") -> pd.DataFrame: """ 广州期货交易所-日频率-量价数据 广州期货交易所: 工业硅(上市时间: 20221222) http://www.gfex.com.cn/gfex/rihq/hqsj_tjsj.shtml :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 广州期货交易所-日频率-量价数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() if day.strftime("%Y%m%d") not in calendar: # warnings.warn(f"{day.strftime('%Y%m%d')}非交易日") return pd.DataFrame() url = "http://www.gfex.com.cn/u/interfacesWebTiDayQuotes/loadList" payload = {"trade_date": date, "trade_type": "0"} headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Content-Length": "32", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Host": "www.gfex.com.cn", "Origin": "http://www.gfex.com.cn", "Pragma": "no-cache", "Proxy-Connection": "keep-alive", "Referer": "http://www.gfex.com.cn/gfex/rihq/hqsj_tjsj.shtml", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36", "X-Requested-With": "XMLHttpRequest", "content-type": "application/x-www-form-urlencoded", } r = requests.post(url, data=payload, headers=headers) try: data_json = r.json() except: # noqa: E722 return pd.DataFrame() result_df = pd.DataFrame(data_json["data"]) result_df = result_df[~result_df["variety"].str.contains("小计")] result_df = result_df[~result_df["variety"].str.contains("总计")] result_df["symbol"] = ( result_df["varietyOrder"].str.upper() + result_df["delivMonth"] ) result_df["date"] = date result_df["open"] = pd.to_numeric(result_df["open"], errors="coerce") result_df["high"] = pd.to_numeric(result_df["high"], errors="coerce") result_df["low"] = pd.to_numeric(result_df["low"], errors="coerce") result_df["close"] = pd.to_numeric(result_df["close"], errors="coerce") result_df["volume"] = pd.to_numeric(result_df["volumn"], errors="coerce") result_df["open_interest"] = pd.to_numeric( result_df["openInterest"], errors="coerce" ) result_df["turnover"] = pd.to_numeric(result_df["turnover"], errors="coerce") result_df["settle"] = pd.to_numeric(result_df["clearPrice"], errors="coerce") result_df["pre_settle"] = pd.to_numeric(result_df["lastClear"], errors="coerce") result_df["variety"] = result_df["varietyOrder"].str.upper() result_df = result_df[ [ "symbol", "date", "open", "high", "low", "close", "volume", "open_interest", "turnover", "settle", "pre_settle", "variety", ] ] return result_df def get_ine_daily(date: str = "20241129") -> pd.DataFrame: """ 上海国际能源交易中心-日频率-量价数据 上海国际能源交易中心: 原油期货(上市时间: 20180326); 20号胶期货(上市时间: 20190812) trade_price: https://www.ine.cn/statements/daily/?paramid=kx trade_note: https://www.ine.cn/data/datanote.dat :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 上海国际能源交易中心-日频率-量价数据 :rtype: pandas.DataFrame or None """ day = cons.convert_date(date) if date is not None else datetime.date.today() if day.strftime("%Y%m%d") not in calendar: # warnings.warn(f"{day.strftime('%Y%m%d')}非交易日") return pd.DataFrame() url = f"https://www.ine.cn/data/tradedata/future/dailydata/kx{day.strftime('%Y%m%d')}.dat" r = requests.get(url, headers=cons.shfe_headers) result_df = pd.DataFrame() try: data_json = r.json() except: # noqa: E722 return pd.DataFrame() temp_df = pd.DataFrame(data_json["o_curinstrument"]).iloc[:-1, :] temp_df = temp_df[temp_df["DELIVERYMONTH"] != "小计"] temp_df = temp_df[~temp_df["PRODUCTNAME"].str.contains("总计")] try: result_df["symbol"] = ( temp_df["PRODUCTGROUPID"].str.upper().str.strip() + temp_df["DELIVERYMONTH"] ) except: # noqa: E722 result_df["symbol"] = ( temp_df["PRODUCTID"] .str.upper() .str.strip() .str.split("_", expand=True) .iloc[:, 0] + temp_df["DELIVERYMONTH"] ) result_df["date"] = day.strftime("%Y%m%d") result_df["open"] = temp_df["OPENPRICE"] result_df["high"] = temp_df["HIGHESTPRICE"] result_df["low"] = temp_df["LOWESTPRICE"] result_df["close"] = temp_df["CLOSEPRICE"] result_df["volume"] = temp_df["VOLUME"] result_df["open_interest"] = temp_df["OPENINTEREST"] try: result_df["turnover"] = temp_df["TURNOVER"] except: # noqa: E722 result_df["turnover"] = 0 result_df["settle"] = temp_df["SETTLEMENTPRICE"] result_df["pre_settle"] = temp_df["PRESETTLEMENTPRICE"] try: result_df["variety"] = temp_df["PRODUCTGROUPID"].str.upper().str.strip() except: # noqa: E722 result_df["variety"] = ( temp_df["PRODUCTID"] .str.upper() .str.strip() .str.split("_", expand=True) .iloc[:, 0] ) result_df = result_df[result_df["symbol"] != "总计"] result_df = result_df[~result_df["symbol"].str.contains("efp")] return result_df def get_czce_daily(date: str = "20050525") -> pd.DataFrame: """ 郑州商品交易所-日频率-量价数据 http://www.czce.com.cn/cn/jysj/mrhq/H770301index_1.htm :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date 对象,默认为当前交易日; 日期需要大于 20100824 :type date: str or datetime.date :return: 郑州商品交易所-日频率-量价数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/108.0.0.0 Safari/537.36" } url = "" if day.strftime("%Y%m%d") not in calendar: # warnings.warn(f"{day.strftime('%Y%m%d')}非交易日") return pd.DataFrame() if day > datetime.date(2010, 8, 24): if day > datetime.date(2015, 11, 11): u = cons.CZCE_DAILY_URL_3 url = u % (day.strftime("%Y"), day.strftime("%Y%m%d")) elif day <= datetime.date(2015, 11, 11): u = cons.CZCE_DAILY_URL_2 url = u % (day.strftime("%Y"), day.strftime("%Y%m%d")) listed_columns = cons.CZCE_COLUMNS output_columns = cons.OUTPUT_COLUMNS try: r = requests.get(url, headers=headers) if datetime.date(2015, 11, 12) <= day <= datetime.date(2017, 12, 27): html = str(r.content, encoding="gbk") else: html = r.text except requests.exceptions.HTTPError as reason: if reason.response.status_code != 404: print( cons.CZCE_DAILY_URL_3 % (day.strftime("%Y"), day.strftime("%Y%m%d")), reason, ) return pd.DataFrame() if html.find("您的访问出错了") >= 0 or html.find("无期权每日行情交易记录") >= 0: return pd.DataFrame() html = [ i.replace(" ", "").split("|") for i in html.split("\n")[:-3] if i[0][0] != "小" ] if day > datetime.date(2015, 11, 11): if html[1][0] not in ["品种月份", "品种代码", "合约代码"]: return pd.DataFrame() dict_data = list() day_const = int(day.strftime("%Y%m%d")) for row in html[2:]: m = cons.FUTURES_SYMBOL_PATTERN.match(row[0]) if not m: continue row_dict = { "date": day_const, "symbol": row[0], "variety": m.group(1), } for i, field in enumerate(listed_columns): if row[i + 1] == "\r" or row[i + 1] == "": row_dict[field] = 0.0 elif field in [ "volume", "open_interest", "oi_chg", "exercise_volume", ]: row[i + 1] = row[i + 1].replace(",", "") row_dict[field] = int(row[i + 1]) else: row[i + 1] = row[i + 1].replace(",", "") row_dict[field] = float(row[i + 1]) dict_data.append(row_dict) return pd.DataFrame(dict_data)[output_columns] elif day <= datetime.date(2015, 11, 11): dict_data = list() day_const = int(day.strftime("%Y%m%d")) for row in html[1:]: row = row[0].split(",") m = cons.FUTURES_SYMBOL_PATTERN.match(row[0]) if not m: continue row_dict = { "date": day_const, "symbol": row[0], "variety": m.group(1), } for i, field in enumerate(listed_columns): if row[i + 1] == "\r": row_dict[field] = 0.0 elif field in [ "volume", "open_interest", "oi_chg", "exercise_volume", ]: row_dict[field] = int(float(row[i + 1])) else: row_dict[field] = float(row[i + 1]) dict_data.append(row_dict) return pd.DataFrame(dict_data)[output_columns] if day <= datetime.date(2010, 8, 24): _futures_daily_czce_df = _futures_daily_czce(date) return _futures_daily_czce_df def get_shfe_daily(date: str = "20220415") -> pd.DataFrame: """ 上海期货交易所-日频率-量价数据 https://tsite.shfe.com.cn/statements/dataview.html?paramid=kx :param date: 日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象, 默认为当前交易日 :type date: str or datetime.date :return: 上海期货交易所-日频率-量价数据 :rtype: pandas.DataFrame or None 上期所日交易数据(DataFrame): symbol 合约代码 date 日期 open 开盘价 high 最高价 low 最低价 close 收盘价 volume 成交量 open_interest 持仓量 turnover 成交额 settle 结算价 pre_settle 前结算价 variety 合约类别 或 None(给定交易日没有交易数据) """ day = cons.convert_date(date) if date is not None else datetime.date.today() if day.strftime("%Y%m%d") not in calendar: # warnings.warn("%s非交易日" % day.strftime("%Y%m%d")) return pd.DataFrame() try: json_data = json.loads( requests_link( cons.SHFE_DAILY_URL_20250630 % (day.strftime("%Y%m%d")), headers=cons.shfe_headers, ).text ) except requests.HTTPError as reason: if reason.response != 404: print(cons.SHFE_DAILY_URL_20250630 % (day.strftime("%Y%m%d")), reason) return pd.DataFrame() if len(json_data["o_curinstrument"]) == 0: return pd.DataFrame() df = pd.DataFrame( [ row for row in json_data["o_curinstrument"] if row["DELIVERYMONTH"] not in ["小计", "合计"] and row["DELIVERYMONTH"] != "" ] ) try: df["variety"] = df["PRODUCTGROUPID"].str.upper().str.strip() except KeyError: df["variety"] = ( df["PRODUCTID"] .str.upper() .str.split("_", expand=True) .iloc[:, 0] .str.strip() ) df["symbol"] = df["variety"] + df["DELIVERYMONTH"] df["date"] = day.strftime("%Y%m%d") df["VOLUME"] = df["VOLUME"].apply(lambda x: 0 if x == "" else x) try: df["turnover"] = df["TURNOVER"].apply(lambda x: 0 if x == "" else x) except KeyError: df["turnover"] = np.nan df.rename(columns=cons.SHFE_COLUMNS, inplace=True) df = df[~df["symbol"].str.contains("efp")] df = df[cons.OUTPUT_COLUMNS] df.reset_index(inplace=True) return df def get_dce_daily(date: str = "20251027") -> pd.DataFrame: """ 大连商品交易所日交易数据 http://www.dce.com.cn/dalianshangpin/xqsj/tjsj26/rtj/rxq/index.html :param date: 交易日, e.g., 20200416 :type date: str :return: 具体交易日的个品种行情数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() if day.strftime("%Y%m%d") not in calendar: # warnings.warn("%s非交易日" % day.strftime("%Y%m%d")) return pd.DataFrame() url = "http://www.dce.com.cn/dcereport/publicweb/dailystat/dayQuotes" payload = { "contractId": "", "lang": "zh", "optionSeries": "", "statisticsType": "0", "tradeDate": date, "tradeType": "1", "varietyId": "all", } r = requests.post(url, json=payload) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]) temp_df.rename( columns={ "variety": "品种名称", "contractId": "合约", "open": "开盘价", "high": "最高价", "low": "最低价", "close": "收盘价", "lastClear": "前结算价", "clearPrice": "结算价", "diff": "涨跌", "diff1": "涨跌1", "volumn": "成交量", "openInterest": "持仓量", "diffI": "持仓量变化", "turnover": "成交额", }, inplace=True, ) temp_df = temp_df[~temp_df["品种名称"].str.contains("小计")] temp_df = temp_df[~temp_df["品种名称"].str.contains("总计")] temp_df["variety"] = temp_df["品种名称"].map(lambda x: cons.DCE_MAP[x]) temp_df["symbol"] = temp_df["合约"] del temp_df["品种名称"] del temp_df["合约"] temp_df.columns = [ "open", "high", "low", "close", "pre_settle", "settle", "_", "_", "_", "volume", "open_interest", "_", "turnover", "_", "_", "_", "_", "_", "_", "_", "_", "variety", "symbol", ] temp_df["date"] = date temp_df = temp_df[ [ "symbol", "date", "open", "high", "low", "close", "volume", "open_interest", "turnover", "settle", "pre_settle", "variety", ] ] temp_df = temp_df.astype( { "open": "float", "high": "float", "low": "float", "close": "float", "volume": "float", "open_interest": "float", "turnover": "float", "settle": "float", "pre_settle": "float", } ) temp_df.reset_index(inplace=True, drop=True) return temp_df def get_futures_daily( start_date: str = "20220208", end_date: str = "20220208", market: str = "CFFEX", ) -> pd.DataFrame: """ 交易所日交易数据 :param start_date: 开始日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :type start_date: str :param end_date: 结束数据 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象 为空时为当天 :type end_date: str :param market: 'CFFEX' 中金所, 'CZCE' 郑商所, 'SHFE' 上期所, 'DCE' 大商所 之一, 'INE' 上海国际能源交易中心, "GFEX" 广州期货交易所。默认为中金所 :type market: str :return: 交易所日交易数据 :rtype: pandas.DataFrame """ if market.upper() == "CFFEX": f = get_cffex_daily elif market.upper() == "CZCE": f = get_czce_daily elif market.upper() == "SHFE": f = get_shfe_daily elif market.upper() == "DCE": f = get_dce_daily elif market.upper() == "INE": f = get_ine_daily elif market.upper() == "GFEX": f = get_gfex_daily else: print("Invalid Market Symbol") return pd.DataFrame() start_date = ( cons.convert_date(start_date) if start_date is not None else datetime.date.today() ) end_date = ( cons.convert_date(end_date) if end_date is not None else cons.convert_date(cons.get_latest_data_date(datetime.datetime.now())) ) df_list = list() while start_date <= end_date: df = f(date=str(start_date).replace("-", "")) if not df.empty: df_list.append(df) start_date += datetime.timedelta(days=1) if len(df_list) == 0: return pd.DataFrame() elif len(df_list) > 0: temp_df = pd.concat(df_list).reset_index(drop=True) temp_df = temp_df[~temp_df["symbol"].str.contains("efp")] return temp_df else: return pd.DataFrame() if __name__ == "__main__": get_futures_daily_df = get_futures_daily( start_date="20250708", end_date="20250708", market="DCE" ) print(get_futures_daily_df) get_dce_daily_df = get_dce_daily(date="20251029") print(get_dce_daily_df) get_cffex_daily_df = get_cffex_daily(date="20230810") print(get_cffex_daily_df) get_ine_daily_df = get_ine_daily(date="20230818") print(get_ine_daily_df) get_czce_daily_df = get_czce_daily(date="20210513") print(get_czce_daily_df) get_shfe_daily_df = get_shfe_daily(date="20250630") print(get_shfe_daily_df) get_gfex_daily_df = get_gfex_daily(date="20221228") print(get_gfex_daily_df) ================================================ FILE: akshare/futures/futures_foreign.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/3/5 18:00 Desc: 外盘期货-历史行情数据-日频率 https://finance.sina.com.cn/money/future/hf.html """ from datetime import datetime from io import StringIO import pandas as pd import requests from akshare.futures.futures_hq_sina import ( futures_foreign_commodity_subscribe_exchange_symbol, ) def futures_foreign_hist(symbol: str = "ZSD") -> pd.DataFrame: """ 外盘期货-历史行情数据-日频率 https://finance.sina.com.cn/money/future/hf.html :param symbol: 外盘期货代码, 可以通过 ak.futures_foreign_commodity_subscribe_exchange_symbol() 来获取所有品种代码 :type symbol: str :return: 历史行情数据-日频率 :rtype: pandas.DataFrame """ today = f"{datetime.today().year}_{datetime.today().month}_{datetime.today().day}" url = ( f"https://stock2.finance.sina.com.cn/futures/api/jsonp.php/var%20_S{today}=/" f"GlobalFuturesService.getGlobalFuturesDailyKLine" ) params = { "symbol": symbol, "_": today, "source": "web", } r = requests.get(url, params=params) data_text = r.text data_df = pd.read_json(StringIO(data_text[data_text.find("[") : -2])) return data_df def futures_foreign_detail(symbol: str = "ZSD") -> pd.DataFrame: """ foreign futures contract detail data :param symbol: futures symbol, you can get it from hf_subscribe_exchange_symbol function :type symbol: str :return: contract detail :rtype: pandas.DataFrame """ url = f"https://finance.sina.com.cn/futures/quotes/{symbol}.shtml" r = requests.get(url) r.encoding = "gbk" data_text = r.text data_df = pd.read_html(StringIO(data_text))[6] return data_df if __name__ == "__main__": futures_foreign_hist_df = futures_foreign_hist(symbol="JY") print(futures_foreign_hist_df) subscribes = futures_foreign_commodity_subscribe_exchange_symbol() for item in subscribes: futures_foreign_detail_df = futures_foreign_detail(symbol=item) print(futures_foreign_detail_df) for item in subscribes: futures_foreign_hist_df = futures_foreign_hist(symbol=item) print(futures_foreign_hist_df) ================================================ FILE: akshare/futures/futures_hf_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/3/9 22:00 Desc: 东方财富网-行情中心-期货市场-国际期货 https://quote.eastmoney.com/center/gridlist.html#futures_global """ import math from typing import Optional import pandas as pd import requests from akshare.utils.tqdm import get_tqdm def __futures_global_hist_market_code(symbol: str = "HG00Y") -> Optional[int]: """ 东方财富网-行情中心-期货市场-国际期货-品种市场对照表 https://quote.eastmoney.com/center/gridlist.html#futures_global :param symbol: HG00Y, 品种代码;可以通过 ak.futures_global_spot_em() 来获取所有可获取历史行情数据的品种代码 :type symbol: str :return: 品种所属于的市场 :rtype: str """ # 提取品种代码(去掉年份和月份部分) base_symbol = "" i = 0 while i < len(symbol) and not symbol[i].isdigit(): base_symbol += symbol[i] i += 1 # 如果代码中没有数字(异常情况),则返回整个代码作为基础品种代码 if not base_symbol and i == len(symbol): base_symbol = symbol # 金属和贵金属品种 - 101 if base_symbol in ["HG", "GC", "SI", "QI", "QO", "MGC", "LTH"]: return 101 # 能源品种 - 102 if base_symbol in ["CL", "NG", "RB", "HO", "PA", "PL", "QM"]: return 102 # 农产品和金融品种 - 103 if base_symbol in [ "ZW", "ZM", "ZS", "ZC", "XC", "XK", "XW", "YM", "TY", "US", "EH", "ZL", "ZR", "ZO", "FV", "TU", "UL", "NQ", "ES", ]: return 103 # 中国市场特有品种 - 104 if base_symbol in ["TF", "RT", "CN"]: return 104 # 软商品期货 - 108 if base_symbol in ["SB", "CT", "SF"]: return 108 # 特殊L开头品种 - 109 if base_symbol in ["LCPT", "LZNT", "LALT", "LTNT", "LLDT", "LNKT"]: return 109 # MPM开头品种 - 110 if base_symbol == "MPM": return 110 # 日本市场品种 - 111 if base_symbol.startswith("J"): return 111 # 单字母代码品种 - 112 if base_symbol in ["M", "B", "G"]: return 112 # 如果没有匹配到任何规则,返回一个默认值或者错误 return None def futures_global_spot_em() -> pd.DataFrame: """ 东方财富网-行情中心-期货市场-国际期货 https://quote.eastmoney.com/center/gridlist.html#futures_global :return: 行情数据 :rtype: pandas.DataFrame """ url = "https://futsseapi.eastmoney.com/list/COMEX,NYMEX,COBOT,SGX,NYBOT,LME,MDEX,TOCOM,IPE" params = { "orderBy": "dm", "sort": "desc", "pageSize": "20", "pageIndex": "0", "token": "58b2fa8f54638b60b87d69b31969089c", "field": "dm,sc,name,p,zsjd,zde,zdf,f152,o,h,l,zjsj,vol,wp,np,ccl", "blockName": "callback", } r = requests.get(url, params=params) data_json = r.json() total_num = data_json["total"] total_page = math.ceil(total_num / 20) - 1 tqdm = get_tqdm() big_df = pd.DataFrame() for page in tqdm(range(total_page), leave=False): params.update({"pageIndex": page}) r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["list"]) big_df = pd.concat(objs=[big_df, temp_df], ignore_index=True) big_df.reset_index(inplace=True) big_df["index"] = big_df["index"] + 1 big_df.rename( columns={ "index": "序号", "np": "卖盘", "h": "最高", "dm": "代码", "zsjd": "-", "l": "最低", "ccl": "持仓量", "o": "今开", "p": "最新价", "sc": "-", "vol": "成交量", "name": "名称", "wp": "买盘", "zde": "涨跌额", "zdf": "涨跌幅", "zjsj": "昨结", }, inplace=True, ) big_df = big_df[ [ "序号", "代码", "名称", "最新价", "涨跌额", "涨跌幅", "今开", "最高", "最低", "昨结", "成交量", "买盘", "卖盘", "持仓量", ] ] big_df["最新价"] = pd.to_numeric(big_df["最新价"], errors="coerce") big_df["涨跌额"] = pd.to_numeric(big_df["涨跌额"], errors="coerce") big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce") big_df["今开"] = pd.to_numeric(big_df["今开"], errors="coerce") big_df["最高"] = pd.to_numeric(big_df["最高"], errors="coerce") big_df["最低"] = pd.to_numeric(big_df["最低"], errors="coerce") big_df["昨结"] = pd.to_numeric(big_df["昨结"], errors="coerce") big_df["成交量"] = pd.to_numeric(big_df["成交量"], errors="coerce") big_df["买盘"] = pd.to_numeric(big_df["买盘"], errors="coerce") big_df["卖盘"] = pd.to_numeric(big_df["卖盘"], errors="coerce") big_df["持仓量"] = pd.to_numeric(big_df["持仓量"], errors="coerce") return big_df def futures_global_hist_em(symbol: str = "HG00Y") -> pd.DataFrame: """ 东方财富网-行情中心-期货市场-国际期货-历史行情数据 https://quote.eastmoney.com/globalfuture/HG25J.html :param symbol: 品种代码;可以通过 ak.futures_global_spot_em() 来获取所有可获取历史行情数据的品种代码 :type symbol: str :return: 历史行情数据 :rtype: pandas.DataFrame """ url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" market_code = __futures_global_hist_market_code(symbol) params = { "secid": f"{market_code}.{symbol}", "klt": "101", "fqt": "1", "lmt": "6600", "end": "20500000", "iscca": "1", "fields1": "f1,f2,f3,f4,f5,f6,f7,f8", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64", "ut": "f057cbcbce2a86e2866ab8877db1d059", "forcect": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) temp_df["code"] = data_json["data"]["code"] temp_df["name"] = data_json["data"]["name"] temp_df.columns = [ "日期", "开盘", "最新价", "最高", "最低", "总量", "-", "-", "涨幅", "-", "-", "-", "持仓", "日增", "代码", "名称", ] temp_df = temp_df[ [ "日期", "代码", "名称", "开盘", "最新价", "最高", "最低", "总量", "涨幅", "持仓", "日增", ] ] 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") 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") temp_df["日增"] = pd.to_numeric(temp_df["日增"], errors="coerce") # 日增修复为有符号32位整数值 unsigned_max, signed_max = (2**32) - 1, (2**31) - 1 mask = temp_df["日增"] > signed_max temp_df.loc[mask, "日增"] = temp_df.loc[mask, "日增"] - (unsigned_max + 1) return temp_df if __name__ == "__main__": futures_global_spot_em_df = futures_global_spot_em() print(futures_global_spot_em_df) futures_global_hist_em_df = futures_global_hist_em(symbol="HG00Y") print(futures_global_hist_em_df) ================================================ FILE: akshare/futures/futures_hist_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/2/20 17:00 Desc: 东方财富网-期货行情 https://qhweb.eastmoney.com/quote """ import re from functools import lru_cache from typing import Tuple, Dict import pandas as pd import requests def __futures_hist_separate_char_and_numbers_em(symbol: str = "焦煤2506") -> tuple: """ 东方财富网-期货行情-交易所品种对照表原始数据 https://quote.eastmoney.com/qihuo/al2505.html :param symbol: 股票代码 :type symbol: str :return: 交易所品种对照表原始数据 :rtype: pandas.DataFrame """ char = re.findall(pattern="[\u4e00-\u9fa5a-zA-Z]+", string=symbol) numbers = re.findall(pattern=r"\d+", string=symbol) return char[0], numbers[0] @lru_cache() def __fetch_exchange_symbol_raw_em() -> list: """ 东方财富网-期货行情-交易所品种对照表原始数据 https://quote.eastmoney.com/qihuo/al2505.html :return: 交易所品种对照表原始数据 :rtype: pandas.DataFrame """ url = "https://futsse-static.eastmoney.com/redis" params = {"msgid": "gnweb"} r = requests.get(url, params=params) data_json = r.json() all_exchange_symbol_list = [] for item in data_json: params = {"msgid": str(item["mktid"])} r = requests.get(url, params=params) inner_data_json = r.json() for num in range(1, len(inner_data_json) + 1): params = {"msgid": str(item["mktid"]) + f"_{num}"} r = requests.get(url, params=params) inner_data_json = r.json() all_exchange_symbol_list.extend(inner_data_json) return all_exchange_symbol_list @lru_cache() def __get_exchange_symbol_map() -> Tuple[Dict, Dict, Dict, Dict]: """ 东方财富网-期货行情-交易所品种映射 https://quote.eastmoney.com/qihuo/al2505.html :return: 交易所品种映射 :rtype: pandas.DataFrame """ all_exchange_symbol_list = __fetch_exchange_symbol_raw_em() c_contract_mkt = {} c_contract_to_e_contract = {} e_symbol_mkt = {} c_symbol_mkt = {} for item in all_exchange_symbol_list: c_contract_mkt[item["name"]] = item["mktid"] c_contract_to_e_contract[item["name"]] = item["code"] e_symbol_mkt[item["vcode"]] = item["mktid"] c_symbol_mkt[item["vname"]] = item["mktid"] return c_contract_mkt, c_contract_to_e_contract, e_symbol_mkt, c_symbol_mkt def futures_hist_table_em() -> pd.DataFrame: """ 东方财富网-期货行情-交易所品种对照表 https://quote.eastmoney.com/qihuo/al2505.html :return: 交易所品种对照表 :rtype: pandas.DataFrame """ all_exchange_symbol_list = __fetch_exchange_symbol_raw_em() temp_df = pd.DataFrame(all_exchange_symbol_list) temp_df = temp_df[["mktname", "name", "code"]] temp_df.columns = ["市场简称", "合约中文代码", "合约代码"] return temp_df def futures_hist_em( symbol: str = "热卷主连", period: str = "daily", start_date: str = "19900101", end_date: str = "20500101", ) -> pd.DataFrame: """ 东方财富网-期货行情-行情数据 https://qhweb.eastmoney.com/quote :param symbol: 期货代码 :type symbol: str :param period: choice of {'daily', 'weekly', 'monthly'} :type period: str :param start_date: 开始日期 :type start_date: str :param end_date: 结束日期 :type end_date: str :return: 行情数据 :rtype: pandas.DataFrame """ url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" period_dict = {"daily": "101", "weekly": "102", "monthly": "103"} c_contract_mkt, c_contract_to_e_contract, e_symbol_mkt, c_symbol_mkt = ( __get_exchange_symbol_map() ) try: sec_id = f"{c_contract_mkt[symbol]}.{c_contract_to_e_contract[symbol]}" except KeyError: symbol_char, numbers = __futures_hist_separate_char_and_numbers_em(symbol) if re.match(pattern="^[\u4e00-\u9fa5]+$", string=symbol_char): sec_id = str(c_symbol_mkt[symbol_char]) + "." + symbol else: sec_id = str(e_symbol_mkt[symbol_char]) + "." + symbol params = { "secid": sec_id, "klt": period_dict[period], "fqt": "1", "lmt": "10000", "end": "20500000", "iscca": "1", "fields1": "f1,f2,f3,f4,f5,f6,f7,f8", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64", "ut": "7eea3edcaed734bea9cbfc24409ed989", "forcect": "1", } r = requests.get(url, timeout=15, params=params) data_json = r.json() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) if temp_df.empty: return temp_df temp_df.columns = [ "时间", "开盘", "收盘", "最高", "最低", "成交量", "成交额", "-", "涨跌幅", "涨跌", "_", "_", "持仓量", "_", ] temp_df = temp_df[ [ "时间", "开盘", "最高", "最低", "收盘", "涨跌", "涨跌幅", "成交量", "成交额", "持仓量", ] ] temp_df.index = pd.to_datetime(temp_df["时间"]) temp_df = temp_df[start_date:end_date] temp_df.reset_index(drop=True, inplace=True) 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") 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") 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") temp_df["时间"] = pd.to_datetime(temp_df["时间"], errors="coerce").dt.date return temp_df if __name__ == "__main__": futures_hist_table_em_df = futures_hist_table_em() print(futures_hist_table_em_df) futures_hist_em_df = futures_hist_em(symbol="热卷主连", period="daily") print(futures_hist_em_df) ================================================ FILE: akshare/futures/futures_hq_sina.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/3/5 18:00 Desc: 新浪财经-外盘期货 https://finance.sina.com.cn/money/future/hf.html """ import time from typing import Union, List import pandas as pd import requests from bs4 import BeautifulSoup from akshare.utils import demjson def _get_real_name_list() -> list: """ 新浪-外盘期货所有品种的中文名称 https://finance.sina.com.cn/money/future/hf.html :return: 外盘期货所有品种的中文名称 :rtype: list """ url = "https://finance.sina.com.cn/money/future/hf.html" r = requests.get(url) r.encoding = "gb2312" data_text = r.text need_text = data_text[ data_text.find("var oHF_1 = ") + 12 : data_text.find("var oHF_2") - 2 ].replace("\n\t", "") data_json = demjson.decode(need_text) name_list = [item[0].strip() for item in data_json.values()] return name_list def futures_foreign_commodity_subscribe_exchange_symbol() -> list: """ 需要订阅的行情的代码 https://finance.sina.com.cn/money/future/hf.html :return: 需要订阅的行情的代码 :rtype: list """ url = "https://finance.sina.com.cn/money/future/hf.html" r = requests.get(url) r.encoding = "gb2312" data_text = r.text data_json = demjson.decode( data_text[ data_text.find("var oHF_1 = ") + 12 : data_text.find("var oHF_2 = ") - 2 ] ) code_list = list(data_json.keys()) return code_list def futures_hq_subscribe_exchange_symbol() -> pd.DataFrame: """ 将品种字典转化为 pandas.DataFrame https://finance.sina.com.cn/money/future/hf.html :return: 品种对应表 :rtype: pandas.DataFrame """ inner_dict = { "新加坡铁矿石": "FEF", "马棕油": "FCPO", "日橡胶": "RSS3", "美国原糖": "RS", "CME比特币期货": "BTC", "NYBOT-棉花": "CT", "LME镍3个月": "NID", "LME铅3个月": "PBD", "LME锡3个月": "SND", "LME锌3个月": "ZSD", "LME铝3个月": "AHD", "LME铜3个月": "CAD", "CBOT-黄豆": "S", "CBOT-小麦": "W", "CBOT-玉米": "C", "CBOT-黄豆油": "BO", "CBOT-黄豆粉": "SM", "日本橡胶": "TRB", "COMEX铜": "HG", "NYMEX天然气": "NG", "NYMEX原油": "CL", "COMEX白银": "SI", "COMEX黄金": "GC", "CME-瘦肉猪": "LHC", "布伦特原油": "OIL", "伦敦金": "XAU", "伦敦银": "XAG", "伦敦铂金": "XPT", "伦敦钯金": "XPD", "欧洲碳排放": "EUA", } temp_df = pd.DataFrame.from_dict(inner_dict, orient="index") temp_df.reset_index(inplace=True) temp_df.columns = ["symbol", "code"] return temp_df def futures_foreign_commodity_realtime(symbol: Union[str, List[str]]) -> pd.DataFrame: """ 新浪-外盘期货-行情数据 https://finance.sina.com.cn/money/future/hf.html :param symbol: 通过调用 ak.futures_hq_subscribe_exchange_symbol() 函数来获取 :type symbol: list or str :return: 行情数据 :rtype: pandas.DataFrame """ if isinstance(symbol, list): payload = "?list=" + ",".join(["hf_" + item for item in symbol]) else: symbol = symbol.split(",") payload = "?list=" + ",".join(["hf_" + item for item in symbol]) url = "https://hq.sinajs.cn/" + payload headers = { "Accept": "*/*", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "hq.sinajs.cn", "Pragma": "no-cache", "Referer": "https://finance.sina.com.cn/", "sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "Sec-Fetch-Dest": "script", "Sec-Fetch-Mode": "no-cors", "Sec-Fetch-Site": "cross-site", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/97.0.4692.71 Safari/537.36", } r = requests.get(url, headers=headers) data_text = r.text data_df = pd.DataFrame( [ item.strip().split("=")[1].split(",") for item in data_text.split(";") if item.strip() != "" ] ) data_df.iloc[:, 0] = data_df.iloc[:, 0].str.replace('"', "") data_df.iloc[:, -1] = data_df.iloc[:, -1].str.replace('"', "") # 处理伦敦金 XAU 的情况 if len(data_df.columns) == 14: data_df["temp"] = None data_df.columns = [ "current_price", "-", "bid", "ask", "high", "low", "time", "last_settle_price", "open", "hold", "-", "-", "date", "symbol", "current_price_rmb", ] temp_symbol_code_df = futures_hq_subscribe_exchange_symbol() temp_symbol_code_dict = dict( zip(temp_symbol_code_df["code"], temp_symbol_code_df["symbol"]) ) data_df["symbol"] = [temp_symbol_code_dict[subscribe] for subscribe in symbol] data_df = data_df[ [ "symbol", "current_price", "current_price_rmb", "bid", "ask", "high", "low", "time", "last_settle_price", "open", "hold", "date", ] ] data_df.columns = [ "名称", "最新价", "人民币报价", "买价", "卖价", "最高价", "最低价", "行情时间", "昨日结算价", "开盘价", "持仓量", "日期", ] data_df.dropna(how="all", inplace=True) data_df["最新价"] = pd.to_numeric(data_df["最新价"], errors="coerce") data_df["人民币报价"] = pd.to_numeric(data_df["人民币报价"], errors="coerce") data_df["买价"] = pd.to_numeric(data_df["买价"], errors="coerce") data_df["卖价"] = pd.to_numeric(data_df["卖价"], errors="coerce") data_df["最高价"] = pd.to_numeric(data_df["最高价"], errors="coerce") data_df["最低价"] = pd.to_numeric(data_df["最低价"], errors="coerce") data_df["昨日结算价"] = pd.to_numeric(data_df["昨日结算价"], errors="coerce") data_df["开盘价"] = pd.to_numeric(data_df["开盘价"], errors="coerce") data_df["持仓量"] = pd.to_numeric(data_df["持仓量"], errors="coerce") data_df["涨跌额"] = data_df["最新价"] - data_df["昨日结算价"] data_df["涨跌幅"] = ( (data_df["最新价"] - data_df["昨日结算价"]) / data_df["昨日结算价"] * 100 ) data_df = data_df[ [ "名称", "最新价", "人民币报价", "涨跌额", "涨跌幅", "开盘价", "最高价", "最低价", "昨日结算价", "持仓量", "买价", "卖价", "行情时间", "日期", ] ] # 获取转换比例数据 url = "https://finance.sina.com.cn/money/future/hf.html" r = requests.get(url) r.encoding = "utf-8" soup = BeautifulSoup(r.text, features="lxml") data_text = soup.find_all(name="script", attrs={"type": "text/javascript"})[ -2 ].string.strip() raw_text = data_text[data_text.find("oHF_1 = ") : data_text.find("oHF_2")] need_text = raw_text[raw_text.find("{") : raw_text.rfind("}") + 1] data_json = demjson.decode(need_text) price_mul = pd.DataFrame( [ [item[0] for item in data_json.values()], [item[1][0] for item in data_json.values()], ] ).T price_mul.columns = ["symbol", "price"] price_mul = price_mul[price_mul["symbol"].isin(data_df["名称"])] price_mul.reset_index(inplace=True, drop=True) price_mul["price"] = pd.to_numeric(price_mul["price"], errors="coerce") # 获取汇率数据 url = "https://hq.sinajs.cn/?list=USDCNY" r = requests.get(url, headers=headers) data_text = r.text usd_rmb = float( data_text[data_text.find('"') + 1 : data_text.find(",美元人民币")].split(",")[ -1 ] ) # 计算人民币报价 data_df["最新价"] = pd.to_numeric(data_df["最新价"], errors="coerce") data_df["人民币报价"] = data_df["最新价"] * price_mul["price"] * float(usd_rmb) data_df.dropna(thresh=4, inplace=True) return data_df if __name__ == "__main__": futures_hq_subscribe_exchange_symbol_df = futures_hq_subscribe_exchange_symbol() print(futures_hq_subscribe_exchange_symbol_df) print("开始接收实时行情, 每秒刷新一次") subscribes = futures_foreign_commodity_subscribe_exchange_symbol() futures_foreign_commodity_realtime_df = futures_foreign_commodity_realtime( symbol="CT,NID" ) print(futures_foreign_commodity_realtime_df) futures_foreign_commodity_realtime_df = futures_foreign_commodity_realtime( symbol=["XAU"] ) print(futures_foreign_commodity_realtime_df) while True: futures_foreign_commodity_realtime_df = futures_foreign_commodity_realtime( symbol=subscribes ) print(futures_foreign_commodity_realtime_df) time.sleep(3) ================================================ FILE: akshare/futures/futures_index_ccidx.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2025/10/29 15:00 Desc: 中证商品指数 http://www.ccidx.com/ """ import json import pandas as pd import requests def futures_index_ccidx(symbol: str = "中证商品期货指数") -> pd.DataFrame: """ 中证商品指数-商品指数-日频率 http://www.ccidx.com/index.html :param symbol: choice of {"中证商品期货指数", "中证商品期货价格指数"} :type symbol: str :return: 商品指数-日频率 :rtype: pandas.DataFrame """ futures_index_map = { "中证商品期货指数": "100001.CCI", "中证商品期货价格指数": "000001.CCI", } url = "http://www.ccidx.com/CCI-ZZZS/index/getDateLine" params = {"indexId": futures_index_map[symbol]} r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame( [json.loads(item) for item in data_json["data"]["dateLineJson"]] ) temp_df.rename( columns={ "tradeDate": "日期", "indexId": "指数代码", "closingPrice": "收盘点位", "settlePrice": "结算点位", "dailyIncreaseAndDecrease": "涨跌", "dailyIncreaseAndDecreasePercentage": "涨跌幅", }, inplace=True, ) 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") temp_df["涨跌幅"] = pd.to_numeric(temp_df["涨跌幅"], errors="coerce") temp_df.sort_values(by=["日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df if __name__ == "__main__": futures_index_ccidx_df = futures_index_ccidx(symbol="中证商品期货指数") print(futures_index_ccidx_df) ================================================ FILE: akshare/futures/futures_inventory_99.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/11/25 18:00 Desc: 99 期货网-大宗商品库存数据 https://www.99qh.com/ """ import json from datetime import datetime from functools import lru_cache import pandas as pd import requests from bs4 import BeautifulSoup @lru_cache(maxsize=32) def __get_99_symbol_map() -> pd.DataFrame: """ 99 期货网-品种代码对照表 https://www.99qh.com/data/stockIn?productId=12 :return: 品种代码对照表 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings("ignore") url = "https://www.99qh.com/data/stockIn" r = requests.get(url, verify=False) soup = BeautifulSoup(r.text, features="lxml") raw_data = soup.find(attrs={"id": "__NEXT_DATA__"}).text data_json = json.loads(raw_data) df_list = [] for i, item in enumerate( data_json["props"]["pageProps"]["data"]["varietyListData"] ): temp_df = pd.DataFrame( data_json["props"]["pageProps"]["data"]["varietyListData"][i]["productList"] ) df_list.append(temp_df) big_df = pd.concat(df_list, ignore_index=True) return big_df def futures_inventory_99(symbol: str = "豆一") -> pd.DataFrame: """ 99 期货网-大宗商品库存数据 https://www.99qh.com/data/stockIn?productId=12 :param symbol: 交易所对应的具体品种; 如:大连商品交易所的 豆一 :type symbol: str :return: 大宗商品库存数据 :rtype: pandas.DataFrame """ import warnings warnings.filterwarnings("ignore") temp_df = __get_99_symbol_map() symbol_name_map = dict(zip(temp_df["name"], temp_df["productId"])) symbol_code_map = dict(zip(temp_df["code"], temp_df["productId"])) if symbol in symbol_name_map: # 如果输入的是中文名称 product_id = symbol_name_map[symbol] elif symbol in symbol_code_map: # 如果输入的是代码 product_id = symbol_code_map[symbol] else: raise ValueError(f"未找到品种 {symbol} 对应的编号") url = "https://centerapi.fx168api.com/app/qh/api/stock/trend" headers = { "Content-Type": "application/json;charset=UTF-8", "_pcc": "EsaNkne9QG4I9UVJ7SWrJg2qdijCOn5B9HYFtyP0ybvBJxY4rhONnGQLU4QwEICzum+cJJR2/iQXf" "DOrqvK3JYgLxJ5bchYkyUU8qRQ3mwcpA/kyYUSioAs4gd+9s1xPhWF7YOp8bAlEGumxbGCziTq2A8up6sdOYV+hnU/b1iM=", "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/58.0.3029.110 Safari/537.3", "referer": "https://www.99qh.com", "origin": "https://www.99qh.com", } params = { "productId": product_id, "type": "1", "pageNo": "1", "pageSize": "5000", "startDate": "", "endDate": f"{datetime.now().date().isoformat()}", "appCategory": "web", } r = requests.get(url, params, headers=headers, verify=False) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["list"]) temp_df.columns = ["日期", "收盘价", "库存"] temp_df.sort_values(by=["日期"], ignore_index=True, inplace=True) 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") return temp_df if __name__ == "__main__": futures_inventory_99_df = futures_inventory_99(symbol="豆一") print(futures_inventory_99_df) ================================================ FILE: akshare/futures/futures_inventory_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/3/5 17:30 Desc: 东方财富网-数据中心-期货库存数据 https://data.eastmoney.com/ifdata/kcsj.html """ import pandas as pd import requests from akshare.futures.cons import futures_inventory_em_symbol_dict def futures_inventory_em(symbol: str = "a") -> pd.DataFrame: """ 东方财富网-数据中心-期货库存数据 https://data.eastmoney.com/ifdata/kcsj.html :param symbol: 支持品种代码和中文名称,中文名称参见:https://data.eastmoney.com/ifdata/kcsj.html :type symbol: str :return: 指定品种的库存数据 :rtype: pandas.DataFrame """ url = "https://datacenter-web.eastmoney.com/api/data/v1/get" params = { "reportName": "RPT_FUTU_POSITIONCODE", "columns": "TRADE_MARKET_CODE,TRADE_CODE,TRADE_TYPE", "filter": '(IS_MAINCODE="1")', "pageNumber": "1", "pageSize": "500", "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) symbol_dict = dict(zip(temp_df["TRADE_TYPE"], temp_df["TRADE_CODE"])) if symbol in symbol_dict.keys(): product_id = symbol_dict[symbol] elif symbol in futures_inventory_em_symbol_dict.keys(): # 如果输入的是代码 product_id = futures_inventory_em_symbol_dict[symbol] else: raise ValueError(f"请输入正确的 symbol, 可选项为: {symbol_dict}") params = { "reportName": "RPT_FUTU_STOCKDATA", "columns": "SECURITY_CODE,TRADE_DATE,ON_WARRANT_NUM,ADDCHANGE", "filter": f"""(SECURITY_CODE="{product_id}")(TRADE_DATE>='2020-10-28')""", "pageNumber": "1", "pageSize": "500", "sortTypes": "-1", "sortColumns": "TRADE_DATE", "source": "WEB", "client": "WEB", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame(data_json["result"]["data"]) temp_df.columns = ["-", "日期", "库存", "增减"] temp_df = temp_df[["日期", "库存", "增减"]] temp_df.sort_values(["日期"], inplace=True) temp_df.reset_index(inplace=True, drop=True) temp_df["库存"] = pd.to_numeric(temp_df["库存"], errors="coerce") temp_df["增减"] = pd.to_numeric(temp_df["增减"], errors="coerce") temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date return temp_df if __name__ == "__main__": futures_inventory_em_df = futures_inventory_em(symbol="a") print(futures_inventory_em_df) ================================================ FILE: akshare/futures/futures_news_shmet.py ================================================ # -*- coding:utf-8 -*- # !/usr/bin/env python """ Date: 2024/12/26 18:00 Desc: 上海金属网-快讯 https://www.shmet.com/newsFlash/newsFlash.html?searchKeyword= """ import pandas as pd import requests def futures_news_shmet(symbol: str = "全部") -> pd.DataFrame: """ 上海金属网-快讯 https://www.shmet.com/newsFlash/newsFlash.html?searchKeyword= :param symbol: choice of {"全部", "要闻", "VIP", "财经", "铜", "铝", "铅", "锌", "镍", "锡", "贵金属", "小金属"} :type symbol: str :return: 上海金属网-快讯 :rtype: pandas.DataFrame """ url = "https://www.shmet.com/api/rest/news/queryNewsflashList" if symbol == "全部": payload = {"currentPage": 1, "pageSize": 100} else: symbol_map = { "要闻": "0", "VIP": "100", "财经": "999", "铜": "1002", "铝": "1003", "铅": "1005", "锌": "1004", "镍": "1006", "锡": "1007", "贵金属": "1008", "小金属": "1009", } payload = { "currentPage": 1, "pageSize": 2000, "content": "", "flashTag": symbol_map[symbol], } r = requests.post(url, json=payload) data_json = r.json() temp_df = pd.DataFrame(data_json["data"]["dataList"]) temp_df.columns = [ "-", "-", "-", "发布时间", "-", "内容", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", ] temp_df = temp_df[ [ "发布时间", "内容", ] ] temp_df["发布时间"] = pd.to_datetime( temp_df["发布时间"], unit="ms", utc=True ).dt.tz_convert("Asia/Shanghai") temp_df.sort_values(["发布时间"], inplace=True) temp_df.reset_index(inplace=True, drop=True) return temp_df if __name__ == "__main__": futures_news_shmet_df = futures_news_shmet(symbol="铜") print(futures_news_shmet_df) for item in [ "全部", "要闻", "VIP", "财经", "铜", "铝", "铅", "锌", "镍", "锡", "贵金属", "小金属", ]: futures_news_shmet_df = futures_news_shmet(symbol=item) print(futures_news_shmet_df) ================================================ FILE: akshare/futures/futures_roll_yield.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/7/16 17:40 Desc: 中国期货各合约展期收益率 日线数据从 daily_bar 函数获取, 需要在收盘后运行 """ import datetime import re import warnings import math import pandas as pd from akshare.futures import cons from akshare.futures.futures_daily_bar import get_futures_daily from akshare.futures.symbol_var import symbol_market, symbol_varieties calendar = cons.get_calendar() def get_roll_yield(date=None, var="BB", symbol1=None, symbol2=None, df=None): """ 指定交易日指定品种(主力和次主力)或任意两个合约的展期收益率 Parameters ------ date: string 某一天日期 format: YYYYMMDD var: string 合约品种如 RB、AL 等 symbol1: string 合约 1 如 rb1810 symbol2: string 合约 2 如 rb1812 df: DataFrame或None 从dailyBar得到合约价格,如果为空就在函数内部抓dailyBar,直接喂给数据可以让计算加快 """ # date = "20100104" date = cons.convert_date(date) if date is not None else datetime.date.today() if date.strftime("%Y%m%d") not in calendar: warnings.warn("%s非交易日" % date.strftime("%Y%m%d")) return None if symbol1: var = symbol_varieties(symbol1) if not isinstance(df, pd.DataFrame): market = symbol_market(var) df = get_futures_daily(start_date=date, end_date=date, market=market) if var: df = df[ ~df["symbol"].str.contains("efp") ] # 20200304 由于交易所获取的数据中会有比如 "CUefp",所以在这里过滤 df = df[df["variety"] == var].sort_values(by=["open_interest"], ascending=False) # df["close"] = df["close"].astype("float") df["close"] = pd.to_numeric(df["close"]) if len(df["close"]) < 2: return None symbol1 = df["symbol"].tolist()[0] symbol2 = df["symbol"].tolist()[1] close1 = df["close"][df["symbol"] == symbol1].tolist()[0] close2 = df["close"][df["symbol"] == symbol2].tolist()[0] a = re.sub(r"\D", "", symbol1) a_1 = int(a[:-2]) a_2 = int(a[-2:]) b = re.sub(r"\D", "", symbol2) b_1 = int(b[:-2]) b_2 = int(b[-2:]) c = (a_1 - b_1) * 12 + (a_2 - b_2) if close1 == 0 or close2 == 0: return False if c > 0: return math.log(close2 / close1) / c * 12, symbol2, symbol1 else: return math.log(close2 / close1) / c * 12, symbol1, symbol2 def get_roll_yield_bar( type_method: str = "var", var: str = "RB", date: str = "20201030", start_day: str = None, end_day: str = None, ): """ 展期收益率 :param type_method: 'symbol': 获取指定交易日指定品种所有交割月合约的收盘价; 'var': 获取指定交易日所有品种两个主力合约的展期收益率(展期收益率横截面); 'date': 获取指定品种每天的两个主力合约的展期收益率(展期收益率时间序列) :param var: 合约品种如 "RB", "AL" 等 :param date: 指定交易日 format: YYYYMMDD :param start_day: 开始日期 format:YYYYMMDD :param end_day: 结束日期 format:YYYYMMDD :return: pandas.DataFrame 展期收益率数据(DataFrame) ry 展期收益率 index 日期或品种 """ date = cons.convert_date(date) if date is not None else datetime.date.today() start_day = ( cons.convert_date(start_day) if start_day is not None else datetime.date.today() ) end_day = ( cons.convert_date(end_day) if end_day is not None else cons.convert_date(cons.get_latest_data_date(datetime.datetime.now())) ) if type_method == "symbol": df = get_futures_daily( start_date=date, end_date=date, market=symbol_market(var) ) df = df[df["variety"] == var] return df if type_method == "var": df = pd.DataFrame() for market in ["dce", "cffex", "shfe", "czce", "gfex"]: df = pd.concat( [ df, get_futures_daily(start_date=date, end_date=date, market=market), ] ) var_list = list(set(df["variety"])) for i_remove in ["IO", "MO", "HO"]: if i_remove in var_list: var_list.remove(i_remove) df_l = pd.DataFrame() for var in var_list: ry = get_roll_yield(date, var, df=df) if ry: df_l = pd.concat( [ df_l, pd.DataFrame( [ry], index=[var], columns=["roll_yield", "near_by", "deferred"], ), ] ) df_l["date"] = date df_l = df_l.sort_values("roll_yield") return df_l if type_method == "date": df_l = pd.DataFrame() while start_day <= end_day: try: ry = get_roll_yield(start_day, var) if ry: df_l = pd.concat( [ df_l, pd.DataFrame( [ry], index=[start_day], columns=["roll_yield", "near_by", "deferred"], ), ] ) except: # noqa: E722 pass start_day += datetime.timedelta(days=1) return df_l if __name__ == "__main__": get_roll_yield_bar_range_df = get_roll_yield_bar( type_method="date", var="RB", start_day="20230801", end_day="20230810", ) print(get_roll_yield_bar_range_df) get_roll_yield_bar_range_df = get_roll_yield_bar( type_method="var", date="20191008", ) print(get_roll_yield_bar_range_df) get_roll_yield_bar_symbol = get_roll_yield_bar(type_method="var", date="20210201") print(get_roll_yield_bar_symbol) ================================================ FILE: akshare/futures/futures_rule.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2025/3/31 18:00 Desc: 国泰君安期货-交易日历数据表 https://www.gtjaqh.com/pc/calendar.html """ from io import StringIO import pandas as pd import requests def futures_rule(date: str = "20231205") -> pd.DataFrame: """ 国泰君安期货-交易日历数据表 https://www.gtjaqh.com/pc/calendar.html :param date: 需要指定为交易日, 且是近期的日期 :type date: str :return: 交易日历数据 :rtype: pandas.DataFrame """ import urllib3 urllib3.disable_warnings() url = " https://www.gtjaqh.com/pc/calendar" params = {"date": f"{date}"} r = requests.get(url, params=params, verify=False) big_df = pd.read_html(StringIO(r.text), header=1)[0] big_df["交易保证金比例"] = big_df["交易保证金比例"].str.strip("%") big_df["交易保证金比例"] = pd.to_numeric(big_df["交易保证金比例"], errors="coerce") big_df["涨跌停板幅度"] = big_df["涨跌停板幅度"].str.strip("%") big_df["涨跌停板幅度"] = pd.to_numeric(big_df["涨跌停板幅度"], errors="coerce") big_df["合约乘数"] = pd.to_numeric(big_df["合约乘数"], errors="coerce") big_df["最小变动价位"] = pd.to_numeric(big_df["最小变动价位"], errors="coerce") big_df["限价单每笔最大下单手数"] = pd.to_numeric( big_df["限价单每笔最大下单手数"], errors="coerce" ) return big_df if __name__ == "__main__": futures_rule_df = futures_rule(date="20250328") print(futures_rule_df) ================================================ FILE: akshare/futures/futures_rule_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/1/17 19:30 Desc: 东方财富网-期货行情-品种及交易规则 https://portal.eastmoneyfutures.com/pages/service/jyts.html#jyrl """ import pandas as pd import requests from akshare.utils.cons import headers def futures_rule_em() -> pd.DataFrame: """ 东方财富网-期货行情-品种及交易规则 https://portal.eastmoneyfutures.com/pages/service/jyts.html#jyrl :return: 品种及交易规则 :rtype: pandas.DataFrame """ url = "https://eastmoneyfutures.com/api/ComManage/GetPZJYInfo" r = requests.get(url, headers=headers) data_json = r.json() temp_df = pd.DataFrame(data_json["Data"]) return temp_df def futures_trading_hours_em(): """ 东方财富网-期货交易时间 https://qhweb.eastmoney.com/tradinghours """ pass if __name__ == "__main__": futures_rule_em_df = futures_rule_em() print(futures_rule_em_df) ================================================ FILE: akshare/futures/futures_settle.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2026/2/20 10:00 Desc: 期货结算信息 期货交易所结算参数数据 - 中金所: 结算参数(保证金、手续费等) - 已实现 - 郑商所: 结算参数 - 已实现 - 上期所: 结算参数 - 已实现 - 广期所: 结算参数 - 已实现 - 上能中心: 结算参数 - 已实现 - 大商所: 待解决(网站反爬虫保护,所有接口返回412错误) """ import datetime import pandas as pd import requests from io import StringIO from akshare.futures import cons from akshare.utils.cons import headers gfex_headers = { "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Origin": "http://www.gfex.com.cn", "Referer": "http://www.gfex.com.cn/gfex/rjycs/ywcs.shtml", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36", "X-Requested-With": "XMLHttpRequest", } # 统一的结算参数字段 SETTLE_OUTPUT_COLUMNS = [ "date", "symbol", "variety", "settle_price", "long_margin_ratio", "short_margin_ratio", "spec_long_margin_ratio", "spec_short_margin_ratio", "hedge_long_margin_ratio", "hedge_short_margin_ratio", "trade_fee_ratio", "close_today_fee_ratio", "delivery_fee_ratio", "is_single_market", "single_market_days", "limit_ratio", "position_limit", "trade_limit", "rise_limit_rate", "fall_limit_rate", ] def _normalize_settle_columns(df: pd.DataFrame) -> pd.DataFrame: """ 统一结算参数字段,将各交易所的字段映射到统一字段 :param df: 原始DataFrame :type df: pandas.DataFrame :return: 统一格式的DataFrame :rtype: pandas.DataFrame """ if df.empty: return pd.DataFrame(columns=SETTLE_OUTPUT_COLUMNS) # 字段映射关系 field_mapping = { # 统一字段 -> 可能的来源字段 "settle_price": ["settle_price", "SETTLEMENTPRICE", "当日结算价"], "long_margin_ratio": ["long_margin_ratio", "margin_ratio", "SPECLONGMARGINRATIO", "specBuyRate", "spec_buy_rate"], "short_margin_ratio": ["short_margin_ratio", "SPECSHORTMARGINRATIO", "hedgeBuyRate", "hedge_buy_rate"], "spec_long_margin_ratio": ["spec_long_margin_ratio", "SPECLONGMARGINRATIO", "spec_buy_rate"], "spec_short_margin_ratio": ["spec_short_margin_ratio", "SPECSHORTMARGINRATIO", "hedge_buy_rate"], "hedge_long_margin_ratio": ["hedge_long_margin_ratio", "HEDGLONGMARGINRATIO", "hedge_buy_rate"], "hedge_short_margin_ratio": ["hedge_short_margin_ratio", "HEDGSHORTMARGINRATIO", "spec_buy_rate"], "trade_fee_ratio": ["trade_fee_ratio", "TRADEFEERATIO", "交易手续费"], "close_today_fee_ratio": ["close_today_fee_ratio", "TTRADEFEERATIO", "日内平今仓交易手续费"], "delivery_fee_ratio": ["delivery_fee_ratio", "COMMODITYDELIVFEERATIO", "交割手续费"], "is_single_market": ["is_single_market", "是否单边市"], "single_market_days": ["single_market_days", "连续单边市天数"], "limit_ratio": ["limit_ratio", "涨跌停板(%)"], "position_limit": ["position_limit", "日持仓限额", "clientBuyPosiQuota", "client_buy_posi_quota"], "trade_limit": ["trade_limit", "交易限额"], "rise_limit_rate": ["rise_limit_rate", "riseLimitRate", "rise_limit_rate"], "fall_limit_rate": ["fall_limit_rate", "fallLimit", "fall_limit"], } # 确保必要的字段存在 for col in ["date", "symbol", "variety"]: if col not in df.columns: if col == "variety" and "symbol" in df.columns: df["variety"] = df["symbol"].str.extract(r"([A-Za-z]+)", expand=False) else: df[col] = None # 映射字段 for target_field, possible_sources in field_mapping.items(): if target_field not in df.columns: for source in possible_sources: if source in df.columns: df[target_field] = df[source] break else: df[target_field] = None # 返回统一格式 return df[SETTLE_OUTPUT_COLUMNS] def _parse_pipe_data(text: str) -> pd.DataFrame: """ 解析管道符分隔的数据 :param text: 原始文本数据 :type text: str :return: 解析后的DataFrame :rtype: pandas.DataFrame """ lines = text.strip().split("\n") if len(lines) < 2: return pd.DataFrame() columns = [col.strip() for col in lines[1].split("|")] data_lines = [line for line in lines[2:] if line.strip()] data_list = [] for line in data_lines: row = [col.strip() for col in line.split("|")] if len(row) >= len(columns): data_list.append(row[:len(columns)]) return pd.DataFrame(data_list, columns=columns) def futures_settle_cffex(date: str = "20260119") -> pd.DataFrame: """ 中国金融期货交易所-结算参数 http://www.cffex.com.cn/jscs/ :param date: 结算参数日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 结算参数数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() date = day.strftime("%Y%m%d") url = f"http://www.cffex.com.cn/sj/jscs/{date[:4]}{date[4:6]}/{date[6:8]}/{date}_1.csv" r = requests.get(url, headers=headers) r.encoding = "gbk" if r.status_code != 200: return pd.DataFrame() # 检查是否返回的是 HTML 页面(页面不存在或数据未发布) if r.text.strip().startswith("<") or "要查看的页面不存在" in r.text: return pd.DataFrame() try: data_df = pd.read_csv(StringIO(r.text), skiprows=1) except: # noqa: E722 return pd.DataFrame() if data_df.shape[0] < 5: return pd.DataFrame() data_df.columns = [ "symbol", "long_margin_ratio", "short_margin_ratio", "trade_fee_ratio", "delivery_fee_ratio", "close_today_fee_ratio", ] data_df = data_df[data_df["symbol"].notna()] data_df = data_df[data_df["symbol"].str.contains( r"^[A-Z]+", na=False, regex=True)] data_df["variety"] = data_df["symbol"].str.extract(r"([A-Z]+)") data_df["date"] = date data_df = data_df[ ["date", "symbol", "variety", "long_margin_ratio", "short_margin_ratio", "trade_fee_ratio", "delivery_fee_ratio", "close_today_fee_ratio"] ] return data_df def futures_settle_czce(date: str = "20260119") -> pd.DataFrame: """ 郑州商品交易所-结算参数 http://www.czce.com.cn/cn/jysj/jscs/H077003003index_1.htm :param date: 结算参数日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 结算参数数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() date = day.strftime("%Y%m%d") url = f"http://www.czce.com.cn/cn/DFSStaticFiles/Future/{date[:4]}/{date}/FutureDataClearParams.txt" r = requests.get(url, headers=headers) r.encoding = "utf-8" if r.status_code != 200: return pd.DataFrame() try: data_df = _parse_pipe_data(r.text) except: # noqa: E722 return pd.DataFrame() if data_df.shape[0] < 5: return pd.DataFrame() data_df.columns = [ "symbol", "settle_price", "is_single_market", "single_market_days", "margin_ratio", "limit_ratio", "trade_fee", "fee_type", "delivery_fee", "close_today_fee", "position_limit", "trade_limit" ] data_df = data_df[data_df["symbol"].notna()] data_df = data_df[~data_df["symbol"].str.contains("小计|合计|总计", na=False)] data_df["variety"] = data_df["symbol"].str.extract(r"([A-Za-z]+)") data_df["date"] = date data_df = data_df[ ["date", "symbol", "variety", "settle_price", "is_single_market", "single_market_days", "margin_ratio", "limit_ratio", "trade_fee", "fee_type", "delivery_fee", "close_today_fee", "position_limit", "trade_limit"] ] return data_df def futures_settle_gfex(date: str = "20260119") -> pd.DataFrame: """ 广州期货交易所-结算参数 http://www.gfex.com.cn/gfex/rjycs/ywcs.shtml :param date: 结算参数日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 结算参数数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() date = day.strftime("%Y%m%d") url = "http://www.gfex.com.cn/u/interfacesWebTtQueryTradPara/loadDayList" payload = {"trade_type": "0"} r = requests.post(url, data=payload, headers=gfex_headers) if r.status_code != 200: return pd.DataFrame() # 检查是否返回了反爬虫的 JavaScript 代码 if r.text.strip().startswith(" pd.DataFrame: """ 上海期货交易所-结算参数 https://www.shfe.com.cn/reports/tradedata/dailyandweeklydata/ :param date: 结算参数日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 结算参数数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() date = day.strftime("%Y%m%d") url = f"https://www.shfe.com.cn/data/tradedata/future/dailydata/js{date}.dat" r = requests.get(url, headers=cons.shfe_headers) if r.status_code != 200: return pd.DataFrame() try: data_json = r.json() data_list = data_json.get("o_cursor", []) except: # noqa: E722 return pd.DataFrame() if not data_list: return pd.DataFrame() data_df = pd.DataFrame(data_list) data_df.columns = [ "symbol", "trade_fee_ratio", "close_today_fee_ratio", "delivery_fee_unit", "spec_long_margin_ratio", "hedge_long_margin_ratio", "delivery_fee_ratio", "product_id", "product_name", "close_today_fee_unit", "trade_fee_unit", "hedge_short_margin_ratio", "settle_price", "uni_direction", "spec_short_margin_ratio", "is_close_today" ] data_df["variety"] = data_df["symbol"].str.extract(r"([A-Za-z]+)") data_df["date"] = date data_df = data_df[ ["date", "symbol", "variety", "settle_price", "spec_long_margin_ratio", "hedge_long_margin_ratio", "spec_short_margin_ratio", "hedge_short_margin_ratio", "trade_fee_ratio", "close_today_fee_ratio", "is_close_today"] ] return data_df def futures_settle_ine(date: str = "20260119") -> pd.DataFrame: """ 上海国际能源交易中心-结算参数 https://www.ine.cn/reports/businessdata/prmsummary/ :param date: 结算参数日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :return: 结算参数数据 :rtype: pandas.DataFrame """ day = cons.convert_date(date) if date is not None else datetime.date.today() date = day.strftime("%Y%m%d") url = f"https://www.ine.cn/data/tradedata/future/dailydata/js{date}.dat" r = requests.get(url, headers=cons.shfe_headers) if r.status_code != 200: return pd.DataFrame() try: data_json = r.json() data_list = data_json.get("o_cursor", []) except: # noqa: E722 return pd.DataFrame() if not data_list: return pd.DataFrame() data_df = pd.DataFrame(data_list) data_df.columns = [ "symbol", "trade_fee_ratio", "close_today_fee_ratio", "delivery_fee_unit", "spec_long_margin_ratio", "hedge_long_margin_ratio", "delivery_fee_ratio", "product_id", "product_name", "close_today_fee_unit", "trade_fee_unit", "hedge_short_margin_ratio", "settle_price", "uni_direction", "spec_short_margin_ratio", "is_close_today" ] data_df["variety"] = data_df["symbol"].str.extract(r"([A-Za-z]+)") data_df["date"] = date data_df = data_df[ ["date", "symbol", "variety", "settle_price", "spec_long_margin_ratio", "hedge_long_margin_ratio", "spec_short_margin_ratio", "hedge_short_margin_ratio", "trade_fee_ratio", "close_today_fee_ratio", "is_close_today"] ] return data_df def futures_settle(date: str = "20260119", market: str = "CFFEX") -> pd.DataFrame: """ 期货交易所结算参数 :param date: 结算日期 format:YYYY-MM-DD 或 YYYYMMDD 或 datetime.date对象,默认为当前交易日 :type date: str or datetime.date :param market: 交易所代码: CFFEX-中金所, CZCE-郑商所, SHFE-上期所, DCE-大商所, INE-上能中心, GFEX-广期所 :type market: str :return: 结算参数数据(统一格式) :rtype: pandas.DataFrame """ if market.upper() == "CFFEX": df = futures_settle_cffex(date) elif market.upper() == "CZCE": df = futures_settle_czce(date) elif market.upper() == "SHFE": df = futures_settle_shfe(date) elif market.upper() == "GFEX": df = futures_settle_gfex(date) elif market.upper() == "INE": df = futures_settle_ine(date) else: print(f"Unsupported market: {market}") return pd.DataFrame(columns=SETTLE_OUTPUT_COLUMNS) temp_df = _normalize_settle_columns(df) return temp_df if __name__ == "__main__": futures_settle_cffex_df = futures_settle_cffex(date="20260119") print("=== 中金所结算参数 ===") print(futures_settle_cffex_df) futures_settle_czce_df = futures_settle_czce(date="20260119") print("\n=== 郑商所结算参数 ===") print(futures_settle_czce_df) futures_settle_shfe_df = futures_settle_shfe(date="20260119") print("\n=== 上期所结算参数 ===") print(futures_settle_shfe_df) futures_settle_gfex_df = futures_settle_gfex(date="20260119") print("\n=== 广期所结算参数 ===") print(futures_settle_gfex_df) futures_settle_ine_df = futures_settle_ine(date="20250117") print("\n=== 上能中心结算参数 ===") print(futures_settle_ine_df) futures_settle_df = futures_settle(date="20260119", market="CFFEX") print("\n=== 通用接口-CFFEX ===") print(futures_settle_df) futures_settle_df = futures_settle(date="20260119", market="CZCE") print("\n=== 通用接口-CZCE ===") print(futures_settle_df) futures_settle_df = futures_settle(date="20260119", market="SHFE") print("\n=== 通用接口-SHFE ===") print(futures_settle_df) futures_settle_df = futures_settle(date="20260119", market="GFEX") print("\n=== 通用接口-GFEX ===") print(futures_settle_df) futures_settle_df = futures_settle(date="20260119", market="INE") print("\n=== 通用接口-INE ===") print(futures_settle_df) ================================================ FILE: akshare/futures/futures_settlement_price_sgx.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/1/18 16:25 Desc: 新加坡交易所-衍生品-历史数据-历史结算价格 https://www.sgx.com/zh-hans/research-education/derivatives https://links.sgx.com/1.0.0/derivatives-daily/5888/FUTURE.zip """ import zipfile from io import BytesIO from io import StringIO import pandas as pd import requests def __fetch_ftse_index_futu(date: str = "20231108") -> int: """ 新加坡交易所-日历计算 https://wap.eastmoney.com/quote/stock/100.STI.html :param date: 交易日 :type date: str :return: 日期计算结果 :rtype: int """ url = "https://push2his.eastmoney.com/api/qt/stock/kline/get" params = { "secid": "100.STI", "klt": "101", "fqt": "0", "lmt": "10000", "end": date, "iscca": "1", "fields1": "f1,f2,f3,f4,f5,f6,f7,f8", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63,f64", "ut": "f057cbcbce2a86e2866ab8877db1d059", "forcect": "1", } r = requests.get(url, params=params) data_json = r.json() temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]["klines"]]) temp_df.columns = [ "date", "-", "open", "close", "high", "low", "volume", "amount", "_", "-", "open", "close", "high", "low", ] num = temp_df["date"].index[-1] + 791 return num def futures_settlement_price_sgx(date: str = "20231107") -> pd.DataFrame: """ 新加坡交易所-衍生品-历史数据-历史结算价格 https://www.sgx.com/zh-hans/research-education/derivatives :param date: 交易日 :type date: str :return: 所有期货品种的在指定交易日的历史结算价格 :rtype: pandas.DataFrame """ num = __fetch_ftse_index_futu(date) url = f"https://links.sgx.com/1.0.0/derivatives-daily/{num}/FUTURE.zip" r = requests.get(url) with zipfile.ZipFile(BytesIO(r.content)) as file: with file.open(file.namelist()[0]) as my_file: data = my_file.read().decode() if file.namelist()[0].endswith("txt"): data_df = pd.read_table(StringIO(data)) else: data_df = pd.read_csv(StringIO(data)) return data_df if __name__ == "__main__": futures_settlement_price_sgx_df = futures_settlement_price_sgx(date="20240110") print(futures_settlement_price_sgx_df) ================================================ FILE: akshare/futures/futures_spot_stock_em.py ================================================ #!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2024/3/21 12:00 Desc: 东方财富网-数据中心-现货与股票 https://data.eastmoney.com/ifdata/xhgp.html """ import pandas as pd import requests from akshare.utils import demjson def futures_spot_stock(symbol: str = "能源") -> pd.DataFrame: """ 东方财富网-数据中心-现货与股票 https://data.eastmoney.com/ifdata/xhgp.html :param symbol: choice of {'能源', '化工', '塑料', '纺织', '有色', '钢铁', '建材', '农副'} :type symbol: str :return: 现货与股票上下游对应数据 :rtype: pandas.DataFrame """ map_dict = { "能源": 0, "化工": 1, "塑料": 2, "纺织": 3, "有色": 4, "钢铁": 5, "建材": 6, "农副": 7, } url = "https://data.eastmoney.com/ifdata/xhgp.html" headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif," "image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", "Cache-Control": "no-cache", "Connection": "keep-alive", "Host": "data.eastmoney.com", "Pragma": "no-cache", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " "(KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36", } r = requests.get(url, headers=headers) data_text = r.text temp_json = demjson.decode( data_text[ data_text.find("pagedata") : data_text.find( "/newstatic/js/common/emdataview.js" ) ] .strip("pagedata= ") .strip(';\n \n