GithubHelp home page GithubHelp logo

ghost-lzy / qbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ufund-me/qbot

0.0 0.0 0.0 208.7 MB

[🔥updating ...] AI 自动量化交易机器人 Qbot is an AI-oriented quantitative investment platform, which aims to realize the potential, empower AI technologies in quantitative investment. 📃 online docs: https://ufund-me.github.io/Qbot ✨ :news: qbot-mini: https://github.com/Charmve/iQuant

Home Page: https://github.com/Charmve

License: MIT License

Shell 0.12% JavaScript 0.34% Python 5.95% Go 1.31% TypeScript 0.61% CSS 0.04% Makefile 0.01% HTML 19.38% Batchfile 0.01% Vue 1.01% Jupyter Notebook 71.21% Dockerfile 0.01% EJS 0.01%

qbot's Introduction

👆 右上角点击 告诉我,你希望这个项目继续加速开发迭代 ❤️ & ☕️

🤖 Qbot

CodeQL AutoTrade Pylint Coverage Python version Documentation status

Qbot
 
Qbot website HOT      Qbot platform TRY IT OUT
 

AI智能量化投研平台

Qbot is an AI-oriented automated quantitative investment platform, which aims to realize the potential, empower AI technologies in quantitative investment. Qbot supports diverse machine learning modeling paradigms. including supervised learning, market dynamics modeling, and RL.


🤖 Qbot = 智能交易策略 + 回测系统 + 自动化量化交易 (+ 可视化分析工具)
            |           |            |            |
            |           |            |             \_ quantstats (dashboard\online operation)
            |           |             \______________ Qbot - vnpy, pytrader, pyfunds
            |           \____________________________ BackTest - backtrader, easyquant
            \________________________________________ quant.ai - qlib, deep learning strategies

🎺 号外:Qbot微信小程序开发招募 UFund-miniprogram

不建议 fork 项目,本项目会持续更新,只 fork 看不到更新,建议 Star ⭐️ ~

喜欢这个项目吗?请考虑 ❤️赞助 本项目,以帮助改进!

Quick Start

Qbot是一个免费的投研平台,提供从数据获取、交易策略开发、策略回测、模拟交易到最终实盘交易的全闭环流程。在实盘接入前,有股票、基金评测和策略回测,在模拟环境下做交易验证,近乎实盘的时延、滑点仿真。故,本平台提供GUI前端/客户端(部分功能也支持网页),后端做数据处理、交易调度,实现事件驱动的交易流程。对于策略研究部分,尤其强调机器学习、强化学习的AI策略,结合多因子模型提高收益比。

但本项目可能需要一一点python基础知识,有一点点交易经验,会更容易体会作者的初衷,解决当下产品空缺和广大散户朋友的交易痛点,现在直接免费开源出来!

cd ~ # $HOME as workspace
git clone https://github.com/UFund-Me/Qbot.git

cd Qbot
pip install -r requirements.txt

python main.py  #if run on Mac, please use 'pythonw main.py'

demo

Mac系统在安装之前需要手动安装tables库的依赖hdf5,以及pythonw UFund-Me#11
brew install hdf5
brew install c-blosc
export HDF5_DIR=/opt/homebrew/opt/hdf5 
export BLOSC_DIR=/opt/homebrew/opt/c-blosc

Open in Gitpod

Highlight

1. 多种交易方式:在线回测 + 模拟交易 + 实盘自动化交易

以策略研究为目标,提供多种交易方式验证策略和提高收益。

2. 多种提示方式:邮件 + 飞书 + 弹窗 + 微信

这是qbot的消息提示模块,多种方式提示交易信息:交易买卖信息、每日交易收益结果、股票每日推荐等。

USAGE ʕ •ᴥ•ʔ

Installation

Install Guide | Online documents

 ____________________________________
< Run ``./env_setup.sh`` to say hello >
 ------------------------------------
            \   ^__^
             \  (oo)\_______
                (__)\       )\/\
                    ||----w |
                    ||     ||

Get Started

本项目分为前端(客户端)和后端两部分,前端由wxPython编写的轻量化GUI客户端,后端分为策略开发、策略回测 qbot/strategies、股票基金评测、模拟交易、在线回测几个部分,对应于客户端从左到右的三个菜单。

前端/客户端

➕ 请注意:本项目建议使用python 3.8、3.9版本,推荐使用conda搭建环境,参考 Install Guide

export USER_ID="admin"                   # replace your info
export PASSWORD="admin1234."             # replace your info

pip install -r requirements.txt

# if run on Mac, please use 'pythonw main.py'
python main.py

主要包含四个窗口,如果启动界面有问题可以参考这里的启动方式。

image

👉 点击这里查看源码

后端/服务端

  1. 选基、选股助手(对应客户端第二个菜单:AI选股/选基)

运行命令

cd investool
go build
./investool webserver
  1. 基金策略在线分析(对应客户端第四个菜单:基金投资策略分析)

需要 node 开发环境: npmnode,点击查看详细操作文档

版本信息(作为参考) ``` ▶ go version go version go1.20.4 darwin/amd64 ~ ▶ node --version v19.7.0 ~ ▶ npm --version 9.5.0 ```

使用docker运行项目,在项目路径下运行以下命令构建项目的docker镜像

docker build -t fund_strategy .

镜像构建完毕后运行

docker run -dp 8000:8000 fund_strategy --name="fund_strategy_instance"

等待项目启动过程中,可通过以下命令查看启动日志:

docker log -f fund_strategy_instance

启动后,可通过http://locahost:8000访问网页。

No-code operation (TODO)

dagster

体验下来,dagster是很适合金融数据采集、处理,还有机器学习的场景。当然这里的场景更偏向于“批处理”,“定时任务”的处理与编排。

dagster-daemon run &
dagit -h 0.0.0.0 -p 3000

Strategies

部分未整理。。。

经典策略
股票 基金 期货
智能策略
GBDT RNN Reinforcement Learning 🔥 Transformer
  • GBDT
  • BOOST
  • LR
  • CNN
  • RNN
  • TFT (IJoF'2019)
  • GATs (NIPS'2017)
  • SFM (KDD'2017)
  • Transformer (NeurIPS'2017)
  • TCTS (ICML'2021)
  • TRA (KDD'2021)
  • TCN (KDD'2018)
  • IGMTF (KDD'2021)
  • HIST (KDD'2018)
  • Localformer ('2021)
  • Benchmark and Model zoo

    Results and models are available in the model zoo. AI strategies is shown at here, local run python pytrader/strategies/workflow_by_code.py, also provide Binder

    👉 点击展开查看具体AI模型benchmark结果
    status benchmark framework DGCNN RegNetX addition arXiv
    GBDT XGBoost Tianqi Chen, et al. KDD 2016
    GBDT LightGBM Guolin Ke, et al. NIPS 2017
    GBDT Catboost Liudmila Prokhorenkova, et al. NIPS 2018
    MLP pytorch --
    LSTM pytorch Sepp Hochreiter, et al. Neural computation 1997
    LightGBM pytorch --
    GRU pytorch Kyunghyun Cho, et al. 2014
    ALSTM pytorch Yao Qin, et al. IJCAI 2017
    GATs pytorch Petar Velickovic, et al. 2017
    SFM pytorch Liheng Zhang, et al. KDD 2017
    TFT tensorflow Bryan Lim, et al. International Journal of Forecasting 2019
    TabNet pytorch Sercan O. Arik, et al. AAAI 2019
    DoubleEnsemble LightGBM Chuheng Zhang, et al. ICDM 2020
    TCTS pytorch Xueqing Wu, et al. ICML 2021
    Transformer pytorch Ashish Vaswani, et al. NeurIPS 2017
    Localformer pytorch Juyong Jiang, et al.
    TRA pytorch Hengxu, Dong, et al. KDD 2021
    TCN pytorch Shaojie Bai, et al. 2018
    ADARNN pytorch YunTao Du, et al. 2021
    ADD pytorch Hongshun Tang, et al.2020
    IGMTF pytorch Wentao Xu, et al.2021
    HIST pytorch Wentao Xu, et al.2021

    Note: All the about 300+ models, methods of 40+ papers in quant.ai supported by Model Zoo can be trained or used in this codebase.


    策略原理及源码分析

    本项目编写了详细的策略原理说明和平台搭建到使用的详细文档,尤其适合量化小白。欢迎加群交流!

    在线文档 | ❓ 常见问题 | Jupyter Notebook

    Quantstats Report

    Quantstats Report

    Click HERE to more detail.

    Some strategy backtest results:

    声明:别轻易用于实盘,市场有风险,投资需谨慎。

    symbol:华正新材(603186)
    Starting Portfolio Value: 10000.00
    Startdate=datetime.datetime(2010, 1, 1),
    Enddate=datetime.datetime(2020, 4, 21),
    # 设置佣金为0.001, 除以100去掉%号
    cerebro.broker.setcommission(commission=0.001)
    

    A股回测MACD策略:

    MACD

    image

    👉 点击查看源码

    A股回测KDJ策略:

    KDJ

    image

    👉 点击查看源码

    A股回测 KDJ+MACD 策略:

    KDJ with MACD

    image

    👉 点击查看源码

    TODO

    👆 右上角点击 告诉我,你希望这个项目继续加速开发迭代 ❤️ & ☕️

    • 把策略回测整合在一个上位机中,包括:选基、选股策略、交易策略,模拟交易,实盘交易
    • 很多策略需要做回测验证;
    • 本项目由前后端支持,有上位机app支持,但目前框架还比较乱,需要做调整;
    • 各种策略需要抽象设计,支持统一调用;
    • 增强数据获取的实时性,每秒数据,降低延迟;
    • 在线文档的完善,目前主要几个部分:新手使用指引、经典策略原理和源码、智能策略原理和源码、常见问题等;
    • 新的feature开发,欢迎在issues交流;

    Contributing

    We appreciate all contributions to improve Qbot. Please refer to CONTRIBUTING.md for the contributing guideline.

    🍮 Community


    • 知识星球:AI量化投研实验室 (加我微信,邀请)

    添加个人微信
    个人微信
    加入微信交流群
    Qbot用户微信交流群
    加入知识星球(付费)
    AI量化交易策略分享、实盘交易教程、实时数据接口
    知识星球(付费)

    若二维码因 Github 网络无法打开,请点击二维码直接打开图片。


    🎉 本项目刚上线就收到了两次GitHub官方趋势榜Top5、Top1好成绩!

    现对于转发本项目到朋友圈或100人以上微信群等,可获得知识星球价值20元的 🎫优惠券 一张, 限时10张。

    Qbot   

    🔥Among the top 10 Quant & Trade repos on GitHub

      主要包含两部分:在本项目的基础下,
    • 增加更多策略研究,包含回测源码(请先学会有本项目中的策略库);
    • 增加实盘接入方式的源代码;
    • 策略交流,AI投研实验室MeetUp线上/线下活动(对于基础薄弱的同学,欢迎进微信群答疑)
    • 最近较为受欢迎的一个福利点:AI选股推荐列表邮件订阅,这有个样例 UFund-Me#37
    知识星球优惠券

    ⚠️ Disclaimer

    👨‍🏫 重点重点! 交易策略和自动化工具只是提供便利,并不代表实际交易收益。该项目任何内容不构成任何投资建议。市场有风险,投资需谨慎。

    🔥 Stargazers Over Time

    Star History Chart

    Sponsors & support

    If you like the project, you can become a sponsor at Open Collective or use GitHub Sponsors.

    Thank you for supporting Qbot!

    Sponsor

    Go for it!

    Last but not least, we're thankful to these open-source repo for sharing their services for free:

    基于Backtrader、vnpy、qlib、tushare、backtest、easyquant、fund-strategies、investool等开源项目,感谢开发者。



    感谢大家的支持与喜欢!

    Code with ❤️ & ☕️ @Charmve 2022-2023

    qbot's People

    Contributors

    charmve avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.