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.2.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.2-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jh_quant-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 066aaa1e7e8aeea48e7648486c836f55501b1af8e0595ac1667d4e43168a0c0e
MD5 72af1c8cf9dd95a728600a32b500de84
BLAKE2b-256 6c6d5ec2d435e3c220284a54fd9aff4a96c93df654b36f014638008d754d25f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jh_quant-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32af9228bf8ee6e85bd8bcc7ae5782d9e4d11408d5bdd59ab1523cdf884c8256
MD5 630084008ecf8ac638cd28b12f18f2b7
BLAKE2b-256 d51bc91566b9656c570dd2300e07252a2d2689a0ff4aad5f5a3678c1973dbc35

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