This repository contains a set of Python scripts for stock prediction and analysis, utilizing various machine learning techniques and data visualization tools.
- Stock data retrieval from Alpha Vantage API
- Linear regression-based stock price prediction
- LSTM-based stock price prediction
- Moving average calculations
- Bollinger Bands visualization
- Firebase integration for data storage and retrieval
- Plotly-based interactive charts
stock_to_firebase.py
: Fetches stock information and stores it in Firebase.stock_yahoo.py
: Retrieves stock news from Yahoo Finance.
stockPrediction_linear.py
: Implements linear regression for stock price prediction.stockPrediction_lstm.py
: Uses LSTM neural networks for stock price prediction.
- Both prediction scripts include functions to create interactive Plotly charts.
- Firebase is used for storing and retrieving stock data and prediction results.
-
Install required dependencies:
pip install pandas numpy sklearn tensorflow plotly firebase-admin requests-html
-
Set up Firebase:
- Place your Firebase credentials JSON file in the project root.
- Update the Firebase configuration in the scripts.
-
Set up Alpha Vantage API:
- Obtain an API key from Alpha Vantage.
- Add the API key to the
.env
file:ALPHAVANTAGE_API_KEY=your_api_key_here
-
To fetch stock data and store it in Firebase:
python stock_to_firebase.py
-
To run linear regression prediction:
python stockPrediction_linear.py
-
To run LSTM prediction:
python stockPrediction_lstm.py
This project is for educational purposes only. Always do your own research and consult with financial professionals before making investment decisions.