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

说明 捐赠链接(与下方二维码同)
请作者喝杯☕️(30元) https://pay.ldxp.cn/item/gflv3v
订阅180天(50元) https://pay.ldxp.cn/item/du4h8s
订阅365天(100元) https://pay.ldxp.cn/item/ehbz9b
加入星球
(3台设备及其他,
首年300元, 续费半价)
https://t.zsxq.com/YSATD

img

⭐️ 支持项目,点亮你的星

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
mimalloc https://github.com/microsoft/mimalloc MIT

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.8.1-py3-none-win_amd64.whl (44.1 MB view details)

Uploaded Python 3Windows x86-64

hikyuu-2.7.8.1-py3-none-manylinux2014_x86_64.whl (70.7 MB view details)

Uploaded Python 3

hikyuu-2.7.8.1-py3-none-manylinux2014_aarch64.whl (56.8 MB view details)

Uploaded Python 3

hikyuu-2.7.8.1-py3-none-macosx_11_0_arm64.whl (71.6 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: hikyuu-2.7.8.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 44.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.8.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 663cb10a5372a3f735ccb69ce7cbaffd563f7d73855c6d4f0f4cf847103e87fe
MD5 6268f4ad2ec24a8e05fa7aefd4664e46
BLAKE2b-256 d5605bcebb214165e71f743373dca5bd5be12efac96ec7b6904f193f480494a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hikyuu-2.7.8.1-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3cfe073e9dde3d433fa07baffb8839529dccddb958ede5efc836b880dfba2816
MD5 0147909725e7932f8827b6c4b7f383f4
BLAKE2b-256 916ec7eb5c2f3e1e87a34eae2303118640a49d7e6aae76428f3df38300fa4d12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hikyuu-2.7.8.1-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6df822bde4f8b0583fb98816263f90d4b356099c8f8dc9547b755b9065169573
MD5 48b334472ddb7b9e7b93c3f624b7501f
BLAKE2b-256 e5268bfa0a73a4ba6a114d0874877b626cc25712378ae9b16836bfa8b1e682d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hikyuu-2.7.8.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 08f5eeda8673cace95b98bd11115dc8da8e3af3446a2e6e58fc2a9c0b268fa0a
MD5 ac5a5eb186fc8dc03155bd541d471d4f
BLAKE2b-256 5d59e0c84a2f52efabb3ef630f843fd14aa64ca7cb102550c501e0ad2d4d262f

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