1 Star 0 Fork 0

潘志浩 / ai_quant_trade

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

股票AI操盘手

ENGLISH VERSION

License Python-Version

AI炒股教程 | 本地策略 | 辅助操盘 | 因子挖掘 | 文本分析 | 数据处理 | 在线投研平台 | 使用文档

drawing如果喜欢本项目,或希望随时关注动态,请给我点个赞吧 (页面右上角的小星星),欢迎分享到社区!

股票AI操盘手

  • 一站式平台:从学习、模拟到实盘
  • 炒股策略:因子挖掘、传统策略、机器学习、深度学习、强化学习、图网络、高频交易等
  • 提供辅助操盘工具:辅助盯盘、股票推荐
  • 实盘部署工具:C++/CPU/GPU等部署

:newspaper: 新特性 :fire:

时间 特性 代码路径
2023.04.09 StructBERT市场情绪分析 egs_fin_nlp/emotion_analysis/01_StructBert_Binary_Class
2023.03.28 强化学习多股票交易:年化收益53% egs_trade/rl/a002_finRL/a01_Stock_NeurIPS2018
2023.02.28 机器学习自动挖掘5000个因子及股票趋势预测 egs_alpha/auto_alpha/tsfresh
2023.02.05 定制化看盘软件 egs_aide/看盘神器/v1
2023.01.01 本地深度强化学习策略 egs_trade/rl/a001_proto_sb3
2022.11.07 Wind本地实盘模拟 egs_trade/real_bid_simulate/wind
2022.08.03 基础回测框架 + 双均线策略 egs_trade/vanilla/double_ma

目录

1. 简介

  1. 本系统适合的人群:

    • 机构
    • 散户
      • 有编程基础
      • 无编程基础
  2. 本仓库代码结构和内容简介

    ai_quant_trade
    ├── ai_wiki (AI全栈教学知识,以Markdown, Jupyter Notebook汇总知识体系)
    │   ├── 基础:操作系统、软件编程、数学基础
    │   ├── 进阶:机器学习、深度学习、强化学习、图网络
    │   ├── 实战:量化交易与投资、模型部署
    ├── docs (本仓库使用说明文档)
    ├── egs_aide (辅助操盘工具)
    │   ├── 看盘神器
    ├── egs_alpha (因子库)
    ├── egs_data (数据获取及处理)
    │   ├── wind (Wind万得数据处理)
    ├── egs_fin_nlp (文本分析)
    │   ├── emotion_analysis (情感分析)
    ├── egs_online_platform (在线投研平台策略)
    │   ├── 优矿_Uqer
    │   ├── 聚宽_JoinQuant
    ├── egs_trade (本地量化炒股策略)
    │   ├── paper_trade (实盘模拟)
    │       ├── wind万得实盘模拟
    │   ├── rl (强化学习炒股)
    │   ├── vanilla (传统规则类策略)
    ├── quant_brain (核心算法库)
    ├── runtime (模型的部署和实际使用)
    ├── tools (辅助工具)
    ├── requirements.txt
    └── README.md
    

2. 使用

本仓库暂未进行封装成python包,拷贝整个项目源代码,

  1. 安装所需库

    pip install -r requirements.txt
  2. 查看egs策略文件夹下文档, 并运行对应实例即可

3. 本地量化平台

本地量化平台

代码详细参见目录:egs_trade

可在本地可构建一套独立的量化交易系统,包含的策略:

  • AI策略
    • 强化学习
    • 图网络
    • 深度学习
    • 机器学习
    • 高频交易
    • 因子挖掘
  • 传统规则类策略

3.1 强化学习策略

  代码详细参见目录:egs_trade/rl

  自从2017年AlphaGo与柯洁围棋大战之后,深度强化学习大火。

  相比于机器学习和深度学习, 强化学习是以最终目标为导向 (以交互作为目标) , 而很多其他方法是考虑孤立的子问题 (如“股价预测”,“大盘预测”,“交易决策”等) , 这并不能直接获得交互的动作, 比如“命令机器人炒股盈利”, 这个任务包含了“股价预测”,”大盘预测”等等, 而强化学习的目标则是“完成命令者的任务”, 可以直接得到“炒股盈利”的一连贯动作。

trades_on_k_line

  1. 样例介绍:

    序号 策略 代码路径 论文
    1 原型 egs_trade/rl/a001_proto_sb3
    2 FinRL教程0-NeurIPS2018 egs_trade/rl/a002_finRL_tutorial/a01_Stock_NeurIPS2018 Practical Deep Reinforcement Learning Approach for Stock Trading (https://arxiv.org/abs/1811.07522)
  2. 样例回测详情

    序号 策略 市场 年化收益 最大回撤 夏普率
    1 原型 中国A股
    2 FinRL教程0-NeurIPS2018 美股道儿琼斯30 53.1% -10.4% 2.17

3.2 图网络策略

  图网络可以更好的构建股票和股票之间的关系,同时关联股票、新闻、情绪等各类信息,能更好的挖掘全局关系网。

(构建中,尽请期待。。。)

3.3 深度学习策略

  自从2012年AlexNet在图像分类任务上,性能碾压传统机器学习性能后,深度学习大火, 随机开启第一波人工智能热潮。其主要用于股价和大盘的预测等。

(构建中,尽请期待。。。)

3.4 机器学习策略

  机器学习以统计学为基础,以其坚实的数据基础,可解性,数据依赖少,资源占用低,训练速度快,在表格任务上, 仍然可以追平深度学习等优势,任有其应用价值。

(构建中,尽请期待。。。)

3.5 高频交易

(构建中,尽请期待。。。)

3.6 传统策略

  传统策略虽然看似昨日黄花,但其可操作性更强,仍又一定使用价值。深度学习和机器学习,往往需要配合规则使用。

  1. 双均线策略

    trades_on_k_line

  2. 投资组合管理7节教学

4. 实盘

4.1 实盘模拟

参见目录:egs_trade/paper_trade

5. 辅助操盘

代码详细参见目录:egs_aide

序号 工具 代码路径
1 定制化看盘工具 egs_aide/看盘神器/v1

6. 因子挖掘

代码详细参见目录:egs_alpha

6.1 因子挖掘

序号 策略 代码路径 论文
1 机器学习自动挖掘5000个因子及股票趋势预测 egs_alpha/auto_alpha/tsfresh

6.2 因子库

序号 因子库
1 alpha101
2 stockstats
3 ta_lib

7. 数据处理

  • 各类常见数据源使用详解
  • 统一数据源接口

8. 文本分析

序号 工具 代码路径
1 StructBERT市场情绪分析 egs_fin_nlp/emotion_analysis/01_StructBert_Binary_Class

9. AI-实践指南

AI-实践指南

  代码参见:ai_wiki

  本部分代码独立同步至仓库AI-实践指南-

  这里汇总了各种量化相关的平台、开源资源和知识。这里是一个丰富的知识仓库和导航地图。

  这里将汇总包括量化投资,windows, linux, shell, vim, markdown,python, c++,机器学习数学基础,

leetcode(c++, python),机器学习、 深度学习、强化学习、图神经网络,语音识别、NLP和图像识别等基础知识

  1. 代码结构和内容简介

    ai_wiki (AI全栈教学知识,以Markdown, Jupyter Notebook汇总知识体系)
    ├── 01_系统平台 
    │   ├── 基础:常用网站、通用工具
    │   ├── 系统:Windows/Linux
    ├── 02_程序代码 
    │   ├── 编程:python, c, c++, 数据库, LeetCode
    │   ├── 实战:常用工具、常见问题汇总
    ├── 03_数学基础(程序员必备数学知识)
    ├── 04_算法原理(传统算法,优化算法,遗传算法)
    ├── 05_机器学习(资源+原理+实战)
    ├── 06_深度学习(资源+原理+实战)
    ├── 07_强化学习(资源+原理+实战)
    ├── 08_图网络(资源+原理+实战)
    ├── 09_模型部署(资源+原理+实战)
    ├── 10_实践应用
    │   ├── 01_开源平台
    │   ├── 02_音频 (语音识别、唤醒、声纹、语音合成、语音增强)
    │   ├── 03_文本处理 
    │   ├── 04_时间序列 
    │   ├── 05_图像识别 
    ├── 11_面试
    ├── 12_量化交易与投资
    └── README.md
    
  2. 量化相关资源

    序号 工具 路径
    1 全网量化资源汇总 ai_wiki/12_量化交易与投资/01_资源

10. 在线投研平台

在线投研平台样例

  国内量化平台,如聚宽、优矿、米筐、果仁和BigQuant等,如果感兴趣,也可以自行尝试。

  投研平台是为量化爱好者(宽客)量身打造的云平台,提供免费股票数据获取、精准的回测功能、 高速实盘交易接口、易用的API文档、由易入难的策略库,便于快速实现和验证策略。( 注:如下策略仅在所述回测段有效,没有进行详细的调优和全周期验证。另外,没有策略能保证全周期有效的, 如果实盘使用如下策略,请慎重使用)

10.1 聚宽平台

聚宽平台

欢迎在聚宽平台关注我:量客攻城狮

  1. 股票量化策略

    策略 收益 最大回撤
    机器学习-动态因子选择策略 12.3% 38.93%
    小市值+多均线量化炒股 58.4% 46.61%
    龙虎榜-看长做短 41.82% 26.89%
    强势股+趋势线判断+止损止盈 10.09% 21.449%
  2. 股票分析研究

关注我

讨论

欢迎在 Github Discussions 中发起讨论。

技术支持

欢迎在 Github Issues 中提交问题。

常见问题

请查看文档常见问题

引用

@misc{ai_quant_trade,
  author={Yi Li},
  title={ai_quant_trade},
  year={2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/charliedream1/ai_quant_trade}},
}
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

暂无描述 展开 收起
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/BrucePan/ai_quant_trade.git
git@gitee.com:BrucePan/ai_quant_trade.git
BrucePan
ai_quant_trade
ai_quant_trade
master

搜索帮助