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 那样需要实时抓取数据。
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.1.tar.gz (2.3 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.1-py3-none-any.whl (2.3 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jh_quant-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0cd6ec16d598f476c7d9a1d58d81044a6a2062261f55af75d7843b14966b95f3
MD5 158c2ece0c0ade6e16a7bedf5df86957
BLAKE2b-256 9c63bf2bae3286a991be3a0aa9184c1beb3c16ccf4ba76ceef59b479fcf6a0ff

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for jh_quant-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bd2b563975043dce87fdafd6f186f13357e891ded76d913b0958b5f95dcdde6f
MD5 6d12212f75e7bfd3df517ecd2d5c7dd8
BLAKE2b-256 5c7e6c6492f02fc30df5177e456734cab180af24db9d8254f0db41f585ba2d85

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