Skip to main content

Jiuhuang quant python sdk

Project description

JH_QUANT

banner 量化交易研究与执行平台。支持:免费数据获取回测因子计算模拟交易组合优化可视化仪表盘

模块

模块 说明 文档
data 多种数据获取,兼容akshare和tushare数据类型及调用风格 README
trading 交易运行层,模拟(实时)交易与会话编排 README
backtest 回测引擎,快速策略验证,多种内置策略 README
factors 因子计算,内置多种因子模型 README
dashboard PyWebView可视化仪表盘 README

快速开始

安装

pip install jh_quant

数据获取

import os
from jh_quant.data import JHData, DataTypes

load_dotenv()   # 读取.env文件, 必须设置JIUHUANG_API_KEY变量

jh = JHData(apt_key=os.getenv("JIUHUANG_API_KEY"))
stock_price = jh.get_data(
    DataTypes.AK_STOCK_ZH_A_HIST_QFQ,  #akshare日线前复盘数据
    symbol="000001",
    start="2025-01-01",
    end="2025-12-10",
)

重要

jh_quant 仅做了对 akshare 数据类型的兼容,数据真实来源为:JiuHuang API

实时模拟交易

jh_quant支持同时开启多个模拟交易会话,每个会话对应一个模拟账户, 下面是示例运行:

python run_paper.py

run_paper.py的完整代码参考本repo根目录的run_paper.py

在回填模式下(可以通过enable_backfill=False关闭),会完成历史交易模拟,并在本地开启服务

开启控制台仪表盘 开启本地服务之后, 可以通过如下代码开启控制台仪表盘

from jh_quant.dashboard import display_trading

display_trading()

dashboard

License

This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

jh_quant-0.1.3.tar.gz (7.6 MB view details)

Uploaded Source

Built Distribution

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

jh_quant-0.1.3-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file jh_quant-0.1.3.tar.gz.

File metadata

  • Download URL: jh_quant-0.1.3.tar.gz
  • Upload date:
  • Size: 7.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.26

File hashes

Hashes for jh_quant-0.1.3.tar.gz
Algorithm Hash digest
SHA256 74367b7350b4e2ba7aa1f4a85468e9ad5bbb8eaa141652a243e92230c5cb36a1
MD5 9964a4e50b66afd7a8492f32c0881b4b
BLAKE2b-256 847034bc0269c2b86e4be768e1984c6ff5e33f64f77667865687213d5ceff806

See more details on using hashes here.

File details

Details for the file jh_quant-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: jh_quant-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.26

File hashes

Hashes for jh_quant-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 940834f54d51e955efc3681657be8c6c69223975ed0a817ae7e25098152d6bc9
MD5 43e1ea46eebffde431bf363596f0e7a4
BLAKE2b-256 e5cf58cd2cc30db308f490da092c352cefdb6985b3285e5dc4105be7884584a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page