ENGLISH VERSION
AI stock trading tutorial | Local strategy | Auxiliary trading | Factor mining | Text analysis | Data processing | Online investment research platform | Usage documents
If you like this project or want to follow the news at any time, please give me a like (the little star in the upper right corner of the page), welcome to share it in the community!

Stock AI trader
Knowledge Planet
Welcome to join my knowledge planet to get more knowledge and services! New opening, welcome to follow! The content will continue to be updated!

WeChat public account

The warehouse related items
| time | characteristic | Code path |
|---|---|---|
| 2023.04.09 | StructBERT Market Sentiment Analysis | egs_fin_nlp/emotion_analysis/01_StructBert_Binary_Class |
| 2023.03.28 | Reinforcement Learning Multi-stock Trading: Annualized Return 53% | egs_trade/rl/a002_finRL/a01_Stock_NeurIPS2018 |
| 2023.02.28 | Machine Learning Automatically Mining 5,000 Factors and Stock Trend Forecast | egs_alpha/auto_alpha/tsfresh |
| 2023.02.05 | Customized disk viewing software | egs_aide/Disk Watch Artifact/v1 |
| 2023.01.01 | Local deep reinforcement learning strategy | egs_trade/rl/a001_proto_sb3 |
| 2022.11.07 | Wind local real-disk simulation | egs_trade/real_bid_simulate/wind |
| 2022.08.03 | Basic backtesting framework + double moving average strategy | egs_trade/vanilla/double_ma |
The appropriate population of this system:
Introduction to the code structure and content of this warehouse
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
This repository has not been encapsulated into a python package yet, copying the entire project source code.
Install the required libraries
pip install -r requirements.txtCheck the document under the egs policy folder and run the corresponding instance
Local quantitative platform
For details, please refer to the directory: egs_trade
An independent quantitative trading system can be built locally, including strategies:
For details, please refer to the directory: egs_trade/rl
Since the battle between AlphaGo and Ke Jie in 2017, deep reinforcement learning has become popular.
Compared with machine learning and deep learning, reinforcement learning is based on the ultimate goal (interaction is the goal), and many other methods are to consider isolated sub-problems (such as "stock price prediction", "market prediction", "trading decision", etc.), which cannot directly obtain interactive actions, such as "command robot stock trading profit", this task includes "stock price prediction", "market prediction", etc., while the goal of reinforcement learning is to "complete the task of the commander", and you can directly obtain a continuous action of "stock trading profit".

Sample introduction:
| Serial number | Strategy | Code path | paper |
|---|---|---|---|
| 1 | prototype | egs_trade/rl/a001_proto_sb3 | |
| 2 | FinRL Tutorial 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) |
Sample backtest details
| Serial number | Strategy | market | Annualized income | Maximum retracement | Sharp rate |
|---|---|---|---|---|---|
| 1 | prototype | China A-shares | |||
| 2 | FinRL Tutorial 0-NeurIPS2018 | Dow Jones 30, US stocks | 53.1% | -10.4% | 2.17 |
The map network can better build the relationship between stocks, and at the same time, it can also link various information such as stocks, news, emotions, etc., which can better explore the global relationship network.
(Please look forward to it while building...)
Since AlexNet's performance crushed traditional machine learning performance in image classification tasks in 2012, deep learning has become a big hit and randomly started the first wave of artificial intelligence. It is mainly used for stock price and market forecasting, etc.
(Please look forward to it while building...)
Machine learning is based on statistics, with its solid data foundation, solvability, low data dependence, low resource utilization, and fast training speed. In table tasks, it can still match the advantages of deep learning and other advantages, and can have its application value.
(Please look forward to it while building...)
(Please look forward to it while building...)
Although traditional strategies seem to be yesterday's yellow flower, they are more operational and still have certain usefulness. Deep learning and machine learning often need to be used in conjunction with rules.
Double moving average strategy

7 Sections of Portfolio Management Teaching
See the directory: egs_trade/paper_trade
For details, please refer to the directory: egs_aide
| Serial number | tool | Code path |
|---|---|---|
| 1 | Customized viewing tools | egs_aide/Disk Watch Artifact/v1 |
For details, please refer to the directory: egs_alpha
| Serial number | Strategy | Code path | paper |
|---|---|---|---|
| 1 | Machine Learning Automatically Mining 5,000 Factors and Stock Trend Forecast | egs_alpha/auto_alpha/tsfresh |
| Serial number | Factor library |
|---|---|
| 1 | alpha101 |
| 2 | stockstats |
| 3 | ta_lib |

| Serial number | tool | Code path |
|---|---|---|
| 1 | StructBERT Market Sentiment Analysis | egs_fin_nlp/emotion_analysis/01_StructBert_Binary_Class |
AI-Practice Guide
See: ai_wiki
This part of the code is independently synchronized to the warehouse AI - Practice Guide -
Here we summarize various quantitative related platforms, open source resources and knowledge. Here is a rich knowledge warehouse and navigation map.
Here we will summarize quantitative investment, windows, linux, shell, vim, markdown, python, c++, machine learning mathematics basics,
leetcode(c++, python), basic knowledge such as machine learning, deep learning, reinforcement learning, graph neural networks, speech recognition, NLP and image recognition
Code structure and content introduction
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
Quantitative Related Resources
| Serial number | tool | path |
|---|---|---|
| 1 | Quantitative resource summary of the entire network | ai_wiki/12_Quantitative Trading and Investment/01_Resources |
Examples of online investment research platform
Domestic quantitative platforms such as Jukuan, Youmin, Rice Basket, Nut and BigQuant, etc., can also try it yourself if you are interested.
Investment Research Platform is a cloud platform tailored for quantitative enthusiasts (Kuanke), providing free stock data acquisition, accurate backtesting functions, high-speed real-time trading interface, easy-to-use API documents, and a strategy library that is easy to implement and verify strategies quickly. ( Note: The following strategy is only valid in the backtest segment, and no detailed tuning and full-cycle verification is performed. In addition, no strategy can ensure full-cycle effectiveness. If the following strategy is used in the real-time trading, please use it with caution )
Jukuan Platform
Welcome to follow me on Jukuan platform: Liangke Siege City Lion
Stock Quantitative Strategy
| Strategy | income | Maximum retracement |
|---|---|---|
| Machine Learning - Dynamic Factor Selection Strategy | 12.3% | 38.93% |
| Small market value + multi-mode average quantitative stock speculation | 58.4% | 46.61% |
| Dragon and Tiger List - Look at the long and make the short | 41.82% | 26.89% |
| Strong stocks + trend line judgment + stop loss and stop profit | 10.09% | 21.449% |
Stock analysis research
Your support is my motivation to move forward. Even if it is "10 cents", I am very happy. Thank you for your rewards and support (^o^)/


Welcome to initiate a discussion in Github Discussions.
Welcome to submit questions in Github Issues.
Please check the documentation for FAQ
@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} } ,
}