Skip to main content

Hikyuu Quant Framework for System Trading Analysis and backtester

Project description

title


img img img img img img

Hikyuu Quant Framework是一款基于C++/Python的开源量化交易研究框架,用于策略分析及回测(目前主要用于国内A股市场)。专注于量化交易领域的核心技术构建,涵盖交易模型开发、极速计算引擎、高效回测框架及实盘拓展能力。其核心思想基于当前成熟的系统化交易方法,将整个系统化交易抽象为由市场环境判断策略、系统有效条件、信号指示器、止损/止盈策略、资金管理策略、盈利目标策略、移滑价差算法等组件,你可以分别构建这些组件的策略资产库,在实际研究中对它们自由组合来观察系统的有效性、稳定性以及单一种类策略的效果。

安装及使用,请先看帮助文档,谢谢!

👉 项目地址:

👉 项目首页:https://hikyuu.org/

👉 帮助文档:https://hikyuu.readthedocs.io/zh-cn/latest/index.html

👉 Wiki文档(AI生成):https://github.com/fasiondog/hikyuu/wiki

👉 入门示例: https://nbviewer.org/github/fasiondog/hikyuu/blob/master/hikyuu/examples/notebook/000-Index.ipynb?flush_cache=True

👉 策略部件库:https://gitee.com/fasiondog/hikyuu_hub

👉 感谢网友提供的 Hikyuu Ubuntu虚拟机环境, 百度网盘下载(提取码: ht8j): https://pan.baidu.com/s/1CAiUWDdgV0c0VhPpe4AgVw?pwd=ht8j

示例:

    #创建模拟交易账户进行回测,初始资金30万
    my_tm = crtTM(init_cash = 300000)

    #创建信号指示器(以5日EMA为快线,5日EMA自身的10日EMA作为慢线,快线向上穿越慢线时买入,反之卖出)
    my_sg = SG_Flex(EMA(CLOSE(), n=5), slow_n=10)

    #固定每次买入1000股
    my_mm = MM_FixedCount(1000)

    #创建交易系统并运行
    sys = SYS_Simple(tm = my_tm, sg = my_sg, mm = my_mm)
    sys.run(sm['sz000001'], Query(-150))

img

完整示例参见:https://nbviewer.jupyter.org/github/fasiondog/hikyuu/blob/master/hikyuu/examples/notebook/000-Index.ipynb?flush_cache=True

🔥 为什么选择 Hikyuu?

  • 💹 组合灵活,分类构建策略资产库 Hikyuu对系统化交易方法进行了良好的抽象:市场环境判断策略、系统有效条件、信号指示器、止损/止盈策略、资金管理策略、盈利目标策略、移滑价差算法、交易对象选择策略、资金分配策略。可以在此基础上构建自己的策略库,并进行灵活的组合和测试。在进行策略探索时,可以更加专注于某一方面的策略性能与影响。其主要功能模块如下:img
  • 🚀 性能保障,打造自己的专属应用 目前项目包含了3个主要组成部分:基于C++的核心库、对C++进行包装的Python库(hikyuu)、基于Python的交互式工具。
    • AMD 7950x 实测:A股全市场(1913万日K线)仅加载全部日线计算 20日 MA 并求最后 MA 累积和,首次执行含数据加载 耗时 6秒,数据加载完毕后计算耗时 166 毫秒,详见: 性能实测
    • C++核心库,提供了整体的策略框架,在保证性能的同时,已经考虑了对多线程和多核处理的支持,在未来追求更高运算速度提供便利。C++核心库,可以单独剥离使用,自行构建自己的客户端工具。
    • Python库(hikyuu),提供了对C++库的包装,同时集成了talib库(如TA_SMA,对应talib.SMA),可以与numpy、pandas数据结构进行互相转换,为使用其他成熟的python数据分析工具提供了便利。
    • hikyuu.interactive 交互式探索工具,提供了K线、指标、系统信号等的基本绘图功能,用于对量化策略的探索和回测。
  • 🍳 代码简洁,探索更便捷、自由 同时支持面向对象和命令行编程范式。其中,命令行在进行策略探索时,代码简洁、探索更便捷、自由。
  • 🔐 安全、自由、隐私,搭建自己的专属云量化平台 结合 Python + Jupyter 的强大能力与云服务器,可以搭建自己专属的云量化平台。将Jupyter部署在云服务器上,随时随地的访问自己的云平台,即刻实现自己新的想法,如下图所示通过手机访问自己的云平台。结合Python强大成熟的数据分析、人工智能工具(如 numpy、scipy、pandas、TensorFlow)搭建更强大的人工智能平台。
  • 🎁 数据存储方式可扩展 目前支持本地HDF5格式、MySQL存储。默认使用HDF5,数据文件体积小、速度更快、备份更便利。截止至2017年4月21日,沪市日线数据文件149M、深市日线数据文件184M、5分钟线数据各不到2G。

🍺 想要更多了解Hikyuu?请使用以下方式联系:

作者精力有限,仅保证对捐赠用户的有问必答,其他渠道视情况,当然另发红包的除外😁

微信群为主,QQ群为辅。

img

🎉 项目捐赠,感谢你的支持 🎉

🎁 捐赠计划与附赠参见:https://hikyuu.readthedocs.io/zh-cn/latest/vip/vip-plan.html

说明 捐赠链接(与下方二维码同)
请作者加个🍗(10元) https://pay.ldxp.cn/item/bet8w6
请作者喝杯☕️(30元) https://pay.ldxp.cn/item/gflv3v
订阅180天(50元) https://pay.ldxp.cn/item/du4h8s
订阅365天(100元) https://pay.ldxp.cn/item/ehbz9b

img

👉👉👉 或者加入知识星球,获取更多 👉👉👉

知识星球

⭐️ 来,点亮你的 star

img

私域定制

img

项目依赖说明

Hikyuu C++部分直接依赖以下开源项目(由以下项目间接依赖的项目及 python 项目未列出, python依赖项目请参考 requirements.txt),感谢所有开源作者的贡献:

名称 项目地址 License
xmake https://github.com/xmake-io/xmake Apache 2.0
hdf5 https://github.com/HDFGroup/hdf5 hdf5 license
mysql(client) https://github.com/mysql/mysql-server mysql license
fmt https://github.com/fmtlib/fmt fmt license
spdlog https://github.com/gabime/spdlog MIT
sqlite https://www.sqlite.org/ sqlite license
flatbuffers https://github.com/google/flatbuffers Apache 2.0
nng https://github.com/nanomsg/nng MIT
nlohmann_json https://github.com/nlohmann/json MIT
boost https://www.boost.org/ Boost Software License
python https://www.python.org/ Python license
pybind11 https://github.com/pybind/pybind11 pybind11 license
gzip-hpp https://github.com/mapbox/gzip-hpp BSD-2-Clause license
doctest https://github.com/doctest/doctest MIT
ta-lib https://github.com/TA-Lib/ta-lib.git BSD-3-Clause license
clickhouse https://github.com/ClickHouse/ClickHouse Apache 2.0
xxhash https://github.com/Cyan4973/xxHash BSD 2-Clause License
utf8proc https://github.com/JuliaStrings/utf8proc MIT
arrow https://github.com/apache/arrow Apache 2.0
eigen https://gitlab.com/libeigen/eigen Apache 2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

hikyuu-2.7.6-py3-none-win_amd64.whl (41.1 MB view details)

Uploaded Python 3Windows x86-64

hikyuu-2.7.6-py3-none-manylinux2014_x86_64.whl (64.9 MB view details)

Uploaded Python 3

hikyuu-2.7.6-py3-none-manylinux2014_aarch64.whl (51.2 MB view details)

Uploaded Python 3

hikyuu-2.7.6-py3-none-macosx_11_0_arm64.whl (68.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file hikyuu-2.7.6-py3-none-win_amd64.whl.

File metadata

  • Download URL: hikyuu-2.7.6-py3-none-win_amd64.whl
  • Upload date:
  • Size: 41.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for hikyuu-2.7.6-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 734f788d255b776d90163638440f0e32f571178dc9cf6c288e8ff44b2204a021
MD5 f537021a666ee9de0d3d18e05832abb9
BLAKE2b-256 2898da53581fc89809db6a3793a9a8b296eb91fbe2f74485f8275008ed3e90e3

See more details on using hashes here.

File details

Details for the file hikyuu-2.7.6-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hikyuu-2.7.6-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 697f03cd66986e31f797c592e1965dbdf364c625353e41c426dd91677fea6075
MD5 0dc27eb808ec793ebcc5bdbcb91f30cb
BLAKE2b-256 6c3c75a77a0790f74d698350b770da7a0cf57ec630f90b391cb6cc9464d44781

See more details on using hashes here.

File details

Details for the file hikyuu-2.7.6-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for hikyuu-2.7.6-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80eeb9bebe99385046b0a1bcd78d5d3fd833083b27f9eeae420e88395a35b55b
MD5 ab0184eaae7db4c7026d5b56da726e89
BLAKE2b-256 39149687d6b6892de9b540e1c76faa001e891431c1a1d2cb5778f7637a83a357

See more details on using hashes here.

File details

Details for the file hikyuu-2.7.6-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hikyuu-2.7.6-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5fb5588cadf5cb54c53f4f3bd145c0b35c678da0eacad9a9b89d3bd3a9cc5af0
MD5 8fccd1808e0ed275175c066f8e6dcde5
BLAKE2b-256 ed2185bc1a9f29bbd474a32d21143fc6962758be5670091758b5523376254cf7

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