In this project I developed a machine learning model and a web app with flask for the backend and html, css for the frontend to predict stock prices.
The data used was gotten from Yahoo Finance using the yfinance api. To use the api run the following:
pip install yfinance
import yfinance as yf
data = yf.download("Name of Stock","Starting date", "Ending Date", auto_adjust = true)
- The name of stock I used was USD
- Starting date: 2010-01-01
- Closing date: 2022-04-30
In this project I tested 3 different algorithms namely:
- Linear Regression
- Lasso Regression
- Ridge Regression
- Support Vector Machine The final model used for the flask app was the linear regression model which had a r2 score of 0.999.
To run a demo do the following:
- Clone the repository.
- Install the requirements from the requirements.txt file:
pip install -r requirements.txt
- Then from your command line run:
python app.py
Then you can view the site on your local server: http://127.0.0.1:5000/
The site can be deployed to heroku and can also be viewed here: https://stock-price-predictors.herokuapp.com/