Predict future stock prices based on historical data using simplified linear regression model. Historical stock data are shared at Google Finance.
####Download the data
- Clone this repo to your computer.
- Get into the folder using
cd stock-prediction-lr
. - Run
mkdir data
. - Switch into the data directory using
cd data
. - Download the data files from Google Finance into the data directory.
- It's recommended to download all the data from first date to last.
- Change
DATA_FILENAME
variable to your data file name insettings.py
.
- Switch back into the stock-prediction-lr directory using
cd ..
.
####Install the requirements
Install the requirements using pip install -r requirements.txt
.
- Make sure you use Python 3.
- You may want to use a virtual environment for this.
- Run
mkdir processed
to create a directory for our processed datasets. - Run
python trend.py
, which will:
- include
prepare.py
, which clean and prepare data, - create
trainX.csv
andtrainY.csv
in the processed folder, - run linear regression across the training set,
- print the accuracy score,
- show charts with test set and all data.
If you want to extend this work, here are a few places to start:
- Modify cleaning data, for example remove '-' values or replace it with some values.
- Generate more features in
prepare.py
. - Modify features in
prepare.py
. - Switch algorithms in
trend.py
.