- Introduction
- Features
- Project Walkthrough
- Flask API Implementation
- Installation
- Usage
- Contributing
- License
- Contact Information
DRL Trader is an intelligent system designed to revolutionize multi-stock portfolio trading. Leveraging the power of Deep Reinforcement Learning (DRL), it generates precise trading signals based on comprehensive analysis of technical indicators and historical market data. The bot's main objective is to optimize investment strategies by making informed decisions, thereby maximizing returns and minimizing risks in the complex stock market.
- Deep Reinforcement Learning (DRL): Uses advanced DRL algorithms to generate trading signals.
- Technical Indicators: Analyzes key technical indicators such as MACD, RSI, CCI, and ADX.
- Dynamic Portfolio Management: Continuously updates and optimizes portfolio value.
- Flask API: Seamless execution and interaction with the trading bot through a user-friendly API.
At each time step, market data, including open-high-low-close prices of Dow 30 stocks, are collected. Essential technical indicators such as MACD, RSI, CCI, and ADX are calculated, forming the "states" for our DRL model.
Our trained DRL model processes the states and generates a list of trading actions, each representing a specific stock. These actions, ranging from strong buy to strong sell, are meticulously determined to maximize gains.
The trading actions are translated into tangible trading steps by calculating the number of shares to trade for each stock. Our predefined parameter, h_max
, controls the maximum amount of shares to trade, ensuring optimal trading decisions.
As the trading day progresses, our portfolio value is updated using the balance and dollar amount of stocks held. This dynamic updating reflects the ever-changing positions and performance.
The DRL model's performance is evaluated by calculating the step reward (r) – the change in portfolio value from one time step to the next. This reward reinforces learning, enabling the model to adapt and optimize its strategies.
This iterative process continues, allowing the DRL Trader to learn and evolve in response to varying market dynamics. The model's ability to swiftly capture returns amidst volatility is refined, leading to improved trading decisions.
As we move towards real-world applications, the DRL Trader undergoes seamless integration, ensuring its performance aligns with real-time market conditions and adheres to the learned strategies.
To facilitate seamless execution and interaction with the "DRL Trader," we implemented a Flask API. This API serves as a bridge between the user and the bot. Upon user request, the API triggers the DRL model's execution, generating trading signals for each stock in the portfolio. These signals, reflecting strong buy or sell recommendations, offer a clear strategy for each stock.
Our team is continuously thriving and making changes in the experiments
subfolder. We are actively working on setting up the MT5 connection to our broker to execute all of our DRL decisions simultaneously and seamlessly. This integration aims to enhance the real-world applicability and efficiency of the DRL Trader by automating trade execution.
To install and run the DRL Trader, follow these steps:
-
Clone the Repository
git clone https://github.com/yourusername/drl-trader.git cd drl-trader
-
Create a Virtual Environment
python3 -m venv env source env/bin/activate # On Windows use `env\Scripts\activate`
-
Install Dependencies
pip install -r requirements.txt
-
Set Up Environment Variables
- Create a
.env
file in the root directory of the project and add necessary environment variables.
- Create a
-
Run the Flask API
flask run
Once the Flask API is running, you can interact with the DRL Trader through API endpoints.
-
Trigger Trading Signal Generation
curl -X POST http://localhost:5000/api/trade -d '{"stocks": ["AAPL", "MSFT", "GOOGL"]}'
-
Check Portfolio Value
curl -X GET http://localhost:5000/api/portfolio
We welcome contributions to enhance the DRL Trader. To contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
Please ensure your code adheres to our coding standards and includes relevant tests.
This project is licensed under the MIT License. See the LICENSE file for more details.
For questions or support, please contact:
- Email: [email protected]
- GitHub Issues: https://github.com/DebjyotiRay/Trader/issues
Feel free to adjust any sections or add more details as necessary for your project.