# Qbot **Repository Path**: tremble/Qbot ## Basic Information - **Project Name**: Qbot - **Description**: fock from github - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-05-26 - **Last Updated**: 2023-10-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

🤖 Qbot

[![CodeQL](https://github.com/UFund-Me/Qbot/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/UFund-Me/Qbot/actions/workflows/codeql-analysis.yml) [![AutoTrade](https://github.com/UFund-Me/Qbot/actions/workflows/auto-trade.yml/badge.svg)](https://github.com/UFund-Me/Qbot/actions/workflows/auto-trade.yml) [![Pylint](https://github.com/UFund-Me/Qbot/actions/workflows/pylint.yml/badge.svg)](https://github.com/UFund-Me/Qbot/actions/workflows/pylint.yml) [![Coverage](https://github.com/UFund-Me/Qbot/actions/workflows/coverage.yml/badge.svg)](https://github.com/UFund-Me/Qbot/actions/workflows/coverage.yml) 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 = 智能交易策略 + 回测系统 + 自动化量化交易 (+ 可视化分析工具) | | | | | | | \_ quantstats (dashboard\online operate) | | \______________ Qbot - vnpy, pytrader, pyfunds | \____________________________ BackTest - backtrader, easyquant \________________________________________ quant.ai - qlib, deep learning strategies ```
***不建议 fork 项目,本项目会持续更新,只 fork 看不到更新,建议 Star ⭐️ ~*** 喜欢这个项目吗?请考虑[ ❤️赞助](#sponsors--support) 本项目,以帮助改进!
## Quick Start
Mac系统在安装之前需要手动安装tables库的依赖hdf5,以及pythonw https://github.com/UFund-Me/Qbot/issues/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](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/UFund-Me/Qbot) ```bash 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

## Highlight
## USAGE ʕ •ᴥ•ʔ ### Installation [Install Guide](./docs/01-新手指引/Install_guide.md) | [Online documents](https://ufund-me.github.io/Qbot/#/) ``` ____________________________________ < Run ``./env_setup.sh`` to say hello > ------------------------------------ \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || ``` ### Get Started 主要包含四个窗口,如果启动界面有问题可以参考这里的启动方式。 ![image](https://github.com/UFund-Me/Qbot/assets/29084184/9f1dcc07-ca76-4600-a02c-76104fb28c51) 👉 点击[这里](gui/mainframe.py)查看源码 #### Local ```shell export USER_ID="admin" # replace your info export PASSWORD="admin1234." # replace your info pip install -r requirements.txt cd pytrader python test_backtrade.py python test_trader.py # visualization python main.py # if run on Mac, please use 'pythonw main.py' ``` #### Web - 1. 基金策略在线分析 需要 node 开发环境: `npm`、`node`,点击[查看](pyfunds/fund-strategies/README.md)详细操作文档 版本信息(作为参考): ``` ▶ go version go version go1.20.4 darwin/amd64 ~ ▶ node --version v19.7.0 ~ ▶ npm --version 9.5.0 ``` 运行命令 ``` cd pyfunds/fund-strategies npm install npm start ``` 或者使用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`访问网页。 - 2. 选基、选股助手 运行命令 ``` cd investool go build ./investool webserver # 仓库中默认的版本为MacOS ``` ## No-code operation (TODO) dagster 体验下来,dagster是很适合金融数据采集、处理,还有机器学习的场景。当然这里的场景更偏向于“批处理”,“定时任务”的处理与编排。 ``` dagster-daemon run & dagit -h 0.0.0.0 -p 3000 ``` ## Strategies 部分未整理。。。
经典策略
股票 基金 期货
智能策略
GBDT RNN Reinforcement Learning :fire: 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](docs/03-智能策略/model_zoo.md). AI strategies is shown at [here](./pytrader/strategies/), local run ``python pytrader/strategies/workflow_by_code.py``, also provide [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/UFund-Me/Qbot/blob/main/pytrader/strategies/workflow_by_code.ipynb/HEAD)
    点击展开查看具体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](./docs/03-智能策略/model_zoo.md) can be trained or used in this codebase.
    ## 策略原理及源码分析 [在线文档](https://ufund-me.github.io/Qbot/#/) | [❓ 常见问题](https://ufund-me.github.io/Qbot/#/04-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98/FQA) | [Jupyter Notebook](./pytrader/strategies/notebook) ## Quantstats Report ![Quantstats Report](https://user-images.githubusercontent.com/29084184/207054856-44d1815b-f92f-40a7-b82e-e4a6b3960f2f.png) Click [HERE](quantstats#visualize-stock-performance) 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](pytrader/doc/02.easy_macd_strategy/Figure_macd.png) ![image](https://github.com/UFund-Me/Qbot/assets/29084184/dfef65ba-0d32-4f5f-b413-d6ec02fc700e) 👉 点击[查看](pytrader/doc/02.easy_macd_strategy/macd.py)源码 A股回测KDJ策略: ![KDJ](pytrader/doc/04.kdj_with_macd/Figure_kdj.png) ![image](https://github.com/UFund-Me/Qbot/assets/29084184/ef8e945b-59d6-4220-87e3-08ec1196cc2c) 👉 点击[查看](pytrader/doc/04.kdj_with_macd/kdj.py)源码 A股回测 KDJ+MACD 策略: ![KDJ with MACD](pytrader/doc/04.kdj_with_macd/Figure_kdj_with_macd.png) ![image](https://github.com/UFund-Me/Qbot/assets/29084184/67338ec5-a6b1-4aa7-9792-1a2c61f353da) 👉 点击[查看](pytrader/doc/04.kdj_with_macd/kdj_macd.py)源码 ## TODO - [x] 把策略回测整合在一个上位机中,包括:选基、选股策略、交易策略,模拟交易,实盘交易 - [ ] 很多策略需要做回测验证; - [ ] 本项目由前后端支持,有上位机app支持,但目前框架还比较乱,需要做调整; - [ ] 各种策略需要抽象设计,支持统一调用; - [ ] 增强数据获取的实时性,每秒数据,降低延迟; - [ ] 在线文档的完善,目前主要几个部分:新手使用指引、经典策略原理和源码、智能策略原理和源码、常见问题等; - [ ] 新的feature开发,欢迎在[issues](https://github.com/UFund-Me/Qbot/issues/)交流; ## Contributing We appreciate all contributions to improve Qbot. Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md) for the contributing guideline. ## 🍮 Community - Github discussions 💬 or issues 💭 - 微信: Yida_Zhang2 - Email: yidazhang1#gmail.com - 知乎:[@Charmve](https://www.zhihu.com/people/MaiweiE-com)
    - 知识星球:AI量化投资 (加我微信,邀请)
    添加个人微信
    个人微信
    加入微信交流群
    Qbot用户微信交流群
    加入知识星球(付费)
    AI量化交易策略分享、实盘交易教程、实时数据接口
    知识星球(付费)
    若二维码因 Github 网络无法打开,请点击[二维码](https://charmve.github.io/img/contact-card.png)直接打开图片。 ## :warning: Disclaimer 交易策略和自动化工具只是提供便利,并不代表实际交易收益。该项目任何内容不构成任何投资建议。市场有风险,投资需谨慎。 ## 🔥 Stargazers Over Time [![Star History Chart](https://api.star-history.com/svg?repos=UFund-Me/Qbot,ailabx/ailabx,jadepeng/pytrader&type=Timeline)](https://star-history.com/#UFund-Me/Qbot&ailabx/ailabx&jadepeng/pytrader&Timeline) ## Sponsors & support If you like the project, you can become a sponsor at [Open Collective](https://opencollective.com/qbot) or use [GitHub Sponsors](https://github.com/sponsors/Charmve). Thank you for supporting Qbot! Sponsor Last but not least, we're thankful to these open-source repo for sharing their services for free: 基于Backtrader、vnpy、qlib、tushare、backtest、easyquant等开源项目,感谢开发者。

    感谢大家的支持与喜欢! Code with ❤️ & ☕️ @Charmve 2022-2023