Skip to main content

股票量化代码,包括通过qmt、同花顺问题和东财api等获取金融数据,以及处理量化这些数据。

查看库中的函数文档,请前往:https://wd.sanrenjz.com/yuhanbolh/about

代码是从多个渠道获取金融数据,在运行过程中提示没有什么模块,就用pip安装什么模块。 但迅投的xtdata和xttrade是不能通过pip安装的,需要把官网http://dict.thinktrader.net/nativeApi/download_xtquant.html 下载,然后放到python的...\Lib\site-packages路径中。

需要证券开户开QMT的可以联系我,微信:yuhanbo758

联系我们

主站:三人聚智-余汉波 - QMT量化、效率工具和财经知识的搬运工

程序小店(个人开发的所有程序,包括开源和不开源):首页 | 三人聚智-余汉波程序小店

文档站点(财经、代码和库文档等):余汉波 文档 | 财经、python与效率工具的知识搬运工

python 程序管理工具下载:sanrenjz - 三人聚智-余汉波

三码合一

余汉波打赏码

schedule akshare scipy yfinance baostock pytdx MetaTrader5 yuhanbolh

安装

本次源码要求 Python >=3.11、AKShare >=1.18.94。大QMT独立服务端仍使用其内置 Python 3.6。

python -m pip install --upgrade yuhanbolh

项目不再锁死 NumPy 与 pandas 的补丁版本,当前兼容范围为 numpy>=1.26.4pandas>=2.2.2,并通过 NumPy 2.x 与 pandas 3.x 回归测试。需要在 Jupyter 中使用时,可安装 Notebook 可选依赖:

python -m pip install --upgrade "yuhanbolh[notebook]"

ipykernel 7 与 Spyder 自带的 spyder-kernels 2.x/3.x 当前存在上游约束冲突 (后者要求 ipykernel<7)。请把最新版 Jupyter 内核放在独立虚拟环境中;若必须 使用 Spyder 控制台,则应遵循 Spyder 的环境要求保留 ipykernel 6.x。这不是 yuhanbolh 的运行依赖冲突。

QMT 的 xtquant 仍需按迅投官方方式安装。包入口已改为按需加载,因此只使用 技术指标、SQLite 等功能时,不会因为缺少 xtquant 而无法导入 yuhanbolh

自动发布到 PyPI

仓库的 .github/workflows/publish.yml 会在代码推送到 main 后自动完成以下操作:

  1. 查询 PyPI 上 yuhanbolh 的当前版本。
  2. 按每位逢十进一的规则生成下一版本,例如 0.6.8 → 0.6.9 → 0.7.0
  3. 构建并校验 wheel 和源码发行包。
  4. 自动提交 setup.py 中的新版本、创建 v版本号 标签并发布到 PyPI。

首次使用前,需要在 GitHub 仓库中完成一次配置:

  1. 打开 Settings → Secrets and variables → Actions,新增仓库 Secret:PYPI_API_TOKEN
  2. Secret 的值填写从 PyPI Account settings → API tokens 创建的 API Token(建议限定到 yuhanbolh 项目)。
  3. 打开 Settings → Actions → General → Workflow permissions,选择 Read and write permissions

自动生成的版本提交带有 [skip ci],不会递归触发下一次发布。

问财 OpenAPI 与标准大QMT桥接

问财凭据仅从环境变量 IWENCAI_API_KEY 读取,可选 IWENCAI_BASE_URL。 配置后重新启动 Python 进程;不要将密钥写入源码或提交到仓库。

import yuhanbolh as lh

data = lh.get_wencai("可转债;债券余额", query_type="conbond")
bonds = lh.wencai_conditional_query("可转债;债券余额;转股溢价率")
client = lh.BridgeClient()  # 构造不联网;业务调用前自动校验服务健康和协议。
# 显式调用时只生成文件,不启动QMT;目标须为新建或空目录。
# directory = lh.export_qmt_bridge("./qmt_bridge")

迁移、异常行为、数据库参数及文档变更见 本次迁移说明。 桥接订单默认 dry_run=True,模板账户及真实报单默认关闭;不包含撤单、条件单或算法单。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yuhanbolh-0.6.5.tar.gz (128.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yuhanbolh-0.6.5-py3-none-any.whl (132.2 kB view details)

Uploaded Python 3

File details

Details for the file yuhanbolh-0.6.5.tar.gz.

File metadata

  • Download URL: yuhanbolh-0.6.5.tar.gz
  • Upload date:
  • Size: 128.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for yuhanbolh-0.6.5.tar.gz
Algorithm Hash digest
SHA256 f1044606f324a77a332264f30a68ef42eb37c36e38c46f670b499abda41e1ffd
MD5 2c6ed735d9e5050689fb8ff87d028cbb
BLAKE2b-256 adfb4ec253e50f5ab24bf4a284c2a27593a824af652ec30950d5c788116e1336

See more details on using hashes here.

File details

Details for the file yuhanbolh-0.6.5-py3-none-any.whl.

File metadata

  • Download URL: yuhanbolh-0.6.5-py3-none-any.whl
  • Upload date:
  • Size: 132.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for yuhanbolh-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 86a91bb8d09476a78f4023370c1b7ebfab91ca3abcad055a0c92db4200078f04
MD5 d4a7a15961cfbd53b1444c762ce9cdd2
BLAKE2b-256 bfbc24d56904d204263ef8487e9cfb77c4b908d16544797209e2312126d9b601

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.6

2 files

This release

0.6.5 This release

2 files

0.6.4

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.9

2 files

0.3.7

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.2.1

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page