This project is a simple web application that performs stock analysis using historical data. It fetches data from Yahoo Finance, calculates technical indicators, and displays the results on an HTML page using Flask.
- Fetch historical stock data from Yahoo Finance
- Calculate technical indicators such as Simple Moving Average (SMA) and Relative Strength Index (RSI)
- Display the stock data and indicators in interactive plots on a web page
- Python
- Flask
- pandas
- pandas-ta
- yfinance
- matplotlib
- Python 3.7+
- Git
-
Clone the repository
git clone https://github.com/yourusername/stock-analysis.git cd stock-analysis
-
Create and activate a virtual environment
python -m venv venv venv\Scripts\activate
python3 -m venv venv source venv/bin/activate
-
Install the dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Open your browser and visit
http://127.0.0.1:8080/
stock-analysis/
├── venv/ # Virtual environment
├── app.py # Flask application
├── requirements.txt # Python dependencies
└── templates/
└── index.html # HTML template
- The application uses the
yfinance
library to fetch historical stock data. - It calculates the 14-day Simple Moving Average (SMA) and the 14-day Relative Strength Index (RSI) using
pandas-ta
. - The data is plotted using
matplotlib
and displayed on a web page using Flask. - The plots are rendered as images and embedded in the HTML template.
- Fork the repository
- Create a new branch (
git checkout -b feature-branch
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature-branch
) - Create a new Pull Request
This project is licensed under the MIT License.