This software will only work with python3 3+!
To install all the required python packages run the following command:
pip3 install -r requirements.txt
The other thing you will need are all the historical prices from the S&P500. Luckily someone named Sentdex already collected all these files. These can be downloaded from:
On his page you will find a file named intraQuarter.zip
, which you should download, unzip, and place in your working directory.
After that you can finally use the software!
To use this code please run the following commands in this order.
python download_historical_prices.py
python parsing_keystats.py
python current_data.py
python backtesting.py
python stock_prediction.py
python download_historical_prices.py
This file will download all the historical prices from yahoo finance.
python parsing_keystats.py
This file will parse the collected html pages using regex. (Could be improved with BeautifulSoup.)
python current_data.py
This file will collect the current data and parse it the same way as parse_keystats.py.
python backtesting.py
This file will split the training data and train on the first half. The second half is used to simulate trading. After trading it will return how succesful it was.
python stock_prediction.py
This file will return all the S&P500 companies which will outperform by a set ammount. This ammount can be adjusted in the config. (Default is 15%.)