An automated stock trading with Deep Reinforcement Learning (DQN & DDPG) for AAPL, BA, and TSLA with news sentiment and one/ multi-step stock price prediction.
For complete report & slide, navigate to reports
.
To run locally:
-
Clone this repository.
NOTE: Scripts are written with Python 3.7.
-
Install Open MPI from here
MacOS: brew install cmake openmpi
- Create conda environment
conda create --name rl_stock python=3.7 -y
- Activate the conda environment
conda activate rl_stock
- Install requirements
pip install -r requirements.txt
Arguments
- -a, --agent, DQN or DDPG
- -f, --forecast, one or multi
- -s, --sentiment, True or False
Baseline
python run.py -a {DQN|DDPG}
Baseline + News Sentiment Analysis
python run.py -a {DQN|DDPG} -s True
Baseline + One/Multi-step Stock Forecast
python run.py -a {DQN|DDPG} -f {one|multi}
Baseline + One/Multi-step Stock Forecast + News Sentiment Analysis
python run.py -a {DQN|DDPG} -f {one|multi} -s True
Stock Forecast and Portfolio Reward plots will pop up during runtime. It is intended behavior for visual reports and it is fine to exit (X) and run.py will continue running through its course.
This repo is self-contained with data.
To self-collect for your own stock data, navigate to utils/collect_data.py
and modify accordingly.