FinRL-Trading: Deep Reinforcement Learning for Automated Stock Trading

Summary
FinRL-Trading is a powerful GitHub repository built upon the FinRL framework, designed to develop advanced AI stock-selection and trading strategies. It leverages both Supervised Learning and Deep Reinforcement Learning to create robust models, with capabilities extending to deployment on online trading platforms. This project offers a comprehensive approach to algorithmic trading, from data processing to live paper trading.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
The FinRL-Trading
repository, an extension of the acclaimed FinRL framework, provides a robust platform for developing AI-driven stock selection and trading strategies. It integrates Supervised Learning (SL) for stock selection and Deep Reinforcement Learning (DRL) for portfolio allocation, culminating in the deployment of agents to online trading platforms like Alpaca. This project aims to empower users to build sophisticated automated trading systems.
Installation
To get started with FinRL-Trading
, you typically begin by cloning the repository and installing its dependencies. While specific pip install
commands are not detailed in the README, it's a Python-based project, and you would generally follow these steps:
git clone https://github.com/AI4Finance-Foundation/FinRL-Trading.git
cd FinRL-Trading
# Install required packages (check for a requirements.txt file or install common ML/DL libraries)
# pip install -r requirements.txt
Users should consult the repository's requirements.txt
file or individual notebook dependencies for a complete list of necessary packages.
Examples
FinRL-Trading
outlines a four-phase approach to building and deploying trading strategies:
- Phase I: Financial Data Processing and Technical Indicators: Learn how to download financial data (Dow-30, NASDAQ-100, S&P 500) and perform feature engineering, including technical indicators (MACD, RSI) and fundamental indicators (EPS, ROI, P/E).
- Phase II: Stock Selection and Portfolio Allocation with Backtesting Results:
- Stock Selection: Utilize supervised machine learning algorithms (LSTM, Random Forest, SVM) to select top-performing stocks based on fundamental multi-factor data.
- Portfolio Allocation: Apply DRL ensemble strategies (PPO, DDPG, A2C, SAC, TD3) from FinRL for asset allocation and position output.
- Phase III: Deploy a DRL agent to an online trading platform: Deploy your developed strategies to platforms such as Alpaca for paper trading.
- Phase IV: Execute paper trading: Execute real orders (in paper trading mode) and log results.
python alpaca_batch_order_by_weights.py --log-csv orders_today.csv
The repository's README provides links to specific FinRL-Meta tutorials and reference papers for each phase, offering practical guidance and theoretical background.
Why Use FinRL-Trading?
FinRL-Trading
offers several compelling reasons for its use:
- Comprehensive Workflow: It covers the entire algorithmic trading pipeline, from data acquisition and feature engineering to stock selection, portfolio optimization, and live deployment.
- Advanced AI Techniques: It leverages state-of-the-art Supervised Learning and Deep Reinforcement Learning algorithms, including ensemble strategies, for robust decision-making.
- Practical Deployment: The framework supports deployment to real-world trading platforms like Alpaca, enabling users to test strategies in a live paper trading environment.
- Educational Resource: With links to academic papers and detailed tutorials, it serves as an excellent resource for learning and applying AI in finance.
Links
- GitHub Repository: https://github.com/AI4Finance-Foundation/FinRL-Trading
- Reference Paper (Stock Recommendation): https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3302088
- Reference Paper (Portfolio Allocation): https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3690996
- FinRL-Meta Portfolio Allocation Tutorial: FinRL_PortfolioAllocation_NeurIPS_2020.ipynb
- FinRL-Meta Paper Trading Demo: FinRL_PaperTrading_Demo.ipynb