Deep Reinforcement Learning driven trading agent.
This project is an implementation of Q-learning applied to stock trading. The agent uses n-day windows of closing prices to determine the best action at a given time is to buy, sell or sit.
This is agent is good as predicting peaks and troughs in short-term and not very good at making decisions over long-term trends, but is quite good at predicting peaks and troughs.
Some of the results are shown below:
Total profit: $ 972.43
Total profit: $1243.72
Total profit: $1945.50
Total profit: -$178.58
setup the data
folder and download historical dataset from Yahoo/finance into data
folder
mkdir data
setup the model
folder where we save our trained models, starting training with python train.py [stock_name] [window_size] [epochs]
mkdir model
python train.py ^GSPC 10 1000
setup plots
folder where we save our evaluate plots, run evaluate script with command python evaulate.py [stock_name] [model_name]
mkdir plots
python evaluate.py ^GSPC_2018 model_ep500
Deep Q-Learning with Keras and Gym - Q-learning overview and Agent skeleton code