AlgorithmicTrading
No description available
Install / Use
/learn @manhkhanhad/AlgorithmicTradingREADME
MMLab Trading is an open source Python framework apply reinforcement learning for automatic stock trading and Linear Programming for portflio optimization.
🔧 Install
- Clone repository:
git clone https://github.com/manhkhanhad/AlgorithmicTrading
- Install dependency
pip install -r requirement.txt
✨ Getting Started
Portfolio Optimization
- Download stock historical prices and Market Index (i.e VNIndex) into
Datafolder - Setting the hyperparameter in
PortfolioOptimization/config_LP.yaml
Evaluate portfolio optimization
python LinearOptimization.py
<p align="center">
<img width="600" align="center" src="Image/evaluation.png" alt="Evaluate portfolio optimization"/>
</p>
Running
- Train the Senario Classifier for determining whether the current is good time to start inverst
python SenarioClassification.py
- Optimize the stock portfolio
python app.py
Stock trading
- Setting the hyperparameter in
config.yaml - Download stock historical prices and Market Index (i.e VNIndex) into
Datafolder - Preprocess data
python data_processer.py
- Training
python train.py
- Testing
python test.py
The strcuture of result folder will be organize as follow
Result folder
│
└───1st Period
│ ├── result.png # Portpolio value of all agent during trading period
│ ├── result.html
│ └─── Agent 1
│ ├── sell_buy.csv #Trading action of agent
│ ├── account_value.csv #Portpolio value during trading
│ └─── trading action
│ ├── html
| | ├── stock_1.html #Visualize trading action of each stock
| | ...
| └── png
| ├── stock_1.png
| ....
...
Backtesting
Backtesting is an evaluation technique that simulates the use of an agent in a live trading environment. First, we train all agents for a certain period, and then we divide the remaining time into short periods with specified window size. We have all agents trade on a small-time period and save their actions and portfolio values. We then update the training set with the previous trading period and retrain all agents. This process is repeated until there are no trading periods left.
<p align="center"> <img width="600" align="center" src="Image/backtesting.png" alt="Backtesting"/> </p>👤 Author
Manh-Khanh Ngo Huu manhkhanhad
🔰 References
Acknowledgement
Give a ⭐️ if this project helped you!
Related Skills
node-connect
346.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
